From c540ba2750cda518beb13725c70d8a58efd979d1 Mon Sep 17 00:00:00 2001 From: Jonghyun Park Date: Wed, 7 Dec 2016 18:54:54 +0900 Subject: [PATCH] Move JIT_EndCatch from asmhelpers.asm into jithelp.asm (dotnet/coreclr#8492) * Move JIT_EndCatch from asmhelpers.asm into jithelp.asm The name of JIT_EndCatch suggests that it is a JIT helper, but its implementation is inside asmhelpers.asm (not in jithelp.asm). This commit moves its implementation into jithelp.asm. * Move COMPlusEndCatch declaration Commit migrated from https://github.com/dotnet/coreclr/commit/eb582352acec56cc9744cae32a34900d6de987ea --- src/coreclr/src/vm/i386/asmhelpers.asm | 28 ---------------------------- src/coreclr/src/vm/i386/jithelp.asm | 30 ++++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 28 deletions(-) diff --git a/src/coreclr/src/vm/i386/asmhelpers.asm b/src/coreclr/src/vm/i386/asmhelpers.asm index 66a22b7..0456be8 100644 --- a/src/coreclr/src/vm/i386/asmhelpers.asm +++ b/src/coreclr/src/vm/i386/asmhelpers.asm @@ -43,7 +43,6 @@ TlsGetValue PROTO stdcall ifdef FEATURE_HIJACK EXTERN _OnHijackWorker@4:PROC endif ;FEATURE_HIJACK -EXTERN _COMPlusEndCatch@20:PROC EXTERN _COMPlusFrameHandler:PROC ifdef FEATURE_COMINTEROP EXTERN _COMPlusFrameHandlerRevCom:PROC @@ -1005,33 +1004,6 @@ OnHijackFPTripThread ENDP endif ; FEATURE_HIJACK -; Note that the debugger skips this entirely when doing SetIP, -; since COMPlusCheckForAbort should always return 0. Excep.cpp:LeaveCatch -; asserts that to be true. If this ends up doing more work, then the -; debugger may need additional support. -; void __stdcall JIT_EndCatch(); -JIT_EndCatch PROC stdcall public - - ; make temp storage for return address, and push the address of that - ; as the last arg to COMPlusEndCatch - mov ecx, [esp] - push ecx; - push esp; - - ; push the rest of COMPlusEndCatch's args, right-to-left - push esi - push edi - push ebx - push ebp - - call _COMPlusEndCatch@20 ; returns old esp value in eax, stores jump address - ; now eax = new esp, [esp] = new eip - - pop edx ; edx = new eip - mov esp, eax ; esp = new esp - jmp edx ; eip = new eip - -JIT_EndCatch ENDP ;========================================================================== ; This function is reached only via the embedded ImportThunkGlue code inside diff --git a/src/coreclr/src/vm/i386/jithelp.asm b/src/coreclr/src/vm/i386/jithelp.asm index ac76728..9d2f6b7 100644 --- a/src/coreclr/src/vm/i386/jithelp.asm +++ b/src/coreclr/src/vm/i386/jithelp.asm @@ -92,6 +92,8 @@ EXTERN _TransparentProxyStub_CrossContext@0:PROC EXTERN _InContextTPQuickDispatchAsmStub@0:PROC endif +EXTERN _COMPlusEndCatch@20:PROC + .686P .XMM ; The following macro is needed because of a MASM issue with the @@ -2571,4 +2573,32 @@ ChkCastInterfaceIsNullInst: @JIT_ChkCastInterface@8 endp +; Note that the debugger skips this entirely when doing SetIP, +; since COMPlusCheckForAbort should always return 0. Excep.cpp:LeaveCatch +; asserts that to be true. If this ends up doing more work, then the +; debugger may need additional support. +; void __stdcall JIT_EndCatch(); +JIT_EndCatch PROC stdcall public + + ; make temp storage for return address, and push the address of that + ; as the last arg to COMPlusEndCatch + mov ecx, [esp] + push ecx; + push esp; + + ; push the rest of COMPlusEndCatch's args, right-to-left + push esi + push edi + push ebx + push ebp + + call _COMPlusEndCatch@20 ; returns old esp value in eax, stores jump address + ; now eax = new esp, [esp] = new eip + + pop edx ; edx = new eip + mov esp, eax ; esp = new esp + jmp edx ; eip = new eip + +JIT_EndCatch ENDP + end -- 2.7.4