From 6d28f3d7fd6e038fcb0ccacd00f918804871991c Mon Sep 17 00:00:00 2001 From: Jonghyun Park Date: Mon, 27 Feb 2017 19:07:05 +0900 Subject: [PATCH] [x86/Linux] 16-byte aligned Funclet Helpers (dotnet/coreclr#9810) Commit migrated from https://github.com/dotnet/coreclr/commit/38a7266eb596e56511b4503eb8c92e49de1f97ef --- src/coreclr/src/pal/inc/unixasmmacrosx86.inc | 19 ++++++++++++ src/coreclr/src/vm/i386/ehhelpers.S | 43 ++++++++++++++++------------ 2 files changed, 43 insertions(+), 19 deletions(-) diff --git a/src/coreclr/src/pal/inc/unixasmmacrosx86.inc b/src/coreclr/src/pal/inc/unixasmmacrosx86.inc index 61ad946..7730505 100644 --- a/src/coreclr/src/pal/inc/unixasmmacrosx86.inc +++ b/src/coreclr/src/pal/inc/unixasmmacrosx86.inc @@ -69,12 +69,31 @@ C_FUNC(\Name\()_End): .macro ESP_PROLOG_BEG .endm +.macro ESP_PROLOG_PUSH Reg + PROLOG_PUSH \Reg +.endm + +.macro ESP_PROLOG_ALLOC Size + sub esp, \Size + .cfi_adjust_cfa_offset \Size +.endm + .macro ESP_PROLOG_END + .cfi_def_cfa_register esp .endm .macro ESP_EPILOG_BEG .endm +.macro ESP_EPILOG_POP Reg + EPILOG_POP \Reg +.endm + +.macro ESP_EPILOG_FREE Size + add esp, \Size + .cfi_adjust_cfa_offset -\Size +.endm + .macro ESP_EPILOG_END .endm diff --git a/src/coreclr/src/vm/i386/ehhelpers.S b/src/coreclr/src/vm/i386/ehhelpers.S index 9f959b1..43ef37f 100644 --- a/src/coreclr/src/vm/i386/ehhelpers.S +++ b/src/coreclr/src/vm/i386/ehhelpers.S @@ -11,13 +11,15 @@ NESTED_ENTRY CallEHFunclet, _TEXT, NoHandler ESP_PROLOG_BEG - PROLOG_PUSH ebp - mov ebp, esp - PROLOG_PUSH ebx - PROLOG_PUSH esi - PROLOG_PUSH edi + ESP_PROLOG_PUSH ebp + ESP_PROLOG_PUSH ebx + ESP_PROLOG_PUSH esi + ESP_PROLOG_PUSH edi + ESP_PROLOG_ALLOC 12 ESP_PROLOG_END + lea ebp, [esp + 3*4 + 12] + // On entry: // // [ebp+ 8] = throwable @@ -43,10 +45,11 @@ NESTED_ENTRY CallEHFunclet, _TEXT, NoHandler call edx ESP_EPILOG_BEG - EPILOG_POP edi - EPILOG_POP esi - EPILOG_POP ebx - EPILOG_POP ebp + ESP_EPILOG_FREE 12 + ESP_EPILOG_POP edi + ESP_EPILOG_POP esi + ESP_EPILOG_POP ebx + ESP_EPILOG_POP ebp ESP_EPILOG_END ret 16 @@ -58,13 +61,15 @@ NESTED_END CallEHFunclet, _TEXT NESTED_ENTRY CallEHFilterFunclet, _TEXT, NoHandler ESP_PROLOG_BEG - PROLOG_PUSH ebp - mov ebp, esp - PROLOG_PUSH ebx - PROLOG_PUSH esi - PROLOG_PUSH edi + ESP_PROLOG_PUSH ebp + ESP_PROLOG_PUSH ebx + ESP_PROLOG_PUSH esi + ESP_PROLOG_PUSH edi + ESP_PROLOG_ALLOC 12 ESP_PROLOG_END + lea ebp, [esp + 3*4 + 12] + // On entry: // // [ebp+ 8] = throwable @@ -86,13 +91,13 @@ NESTED_ENTRY CallEHFilterFunclet, _TEXT, NoHandler call edx ESP_EPILOG_BEG - EPILOG_POP edi - EPILOG_POP esi - EPILOG_POP ebx - EPILOG_POP ebp + ESP_EPILOG_FREE 12 + ESP_EPILOG_POP edi + ESP_EPILOG_POP esi + ESP_EPILOG_POP ebx + ESP_EPILOG_POP ebp ESP_EPILOG_END ret 16 NESTED_END CallEHFunclet, _TEXT - -- 2.7.4