From 9f2aedb165af2549745617ee09c5013e33a48968 Mon Sep 17 00:00:00 2001 From: Jonghyun Park Date: Sat, 4 Mar 2017 08:56:06 +0900 Subject: [PATCH] [x86/Linux] Revise VirtualMethodFixupStub (dotnet/coreclr#9929) * [x86/Linux] Revise VirtualMethodFixupStub Commit migrated from https://github.com/dotnet/coreclr/commit/ad9153147dcc2045041c178a49a69cc441758c79 --- src/coreclr/src/vm/i386/asmhelpers.S | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/coreclr/src/vm/i386/asmhelpers.S b/src/coreclr/src/vm/i386/asmhelpers.S index 921e09f..060bb02 100644 --- a/src/coreclr/src/vm/i386/asmhelpers.S +++ b/src/coreclr/src/vm/i386/asmhelpers.S @@ -821,8 +821,8 @@ NESTED_END DelayLoad_MethodCall, _TEXT // to optionally patch the target of the jump so that we do not take this slow path again. // NESTED_ENTRY VirtualMethodFixupStub, _TEXT, NoHandler - // Pop the return address. It points right after the call instruction in the thunk. - pop eax + // Get the return address. It points right after the call instruction in the thunk. + mov eax, [esp] // Calculate the address of the thunk sub eax, 5 @@ -836,9 +836,12 @@ NESTED_ENTRY VirtualMethodFixupStub, _TEXT, NoHandler // Set frame pointer PROLOG_END + sub esp, 8 push eax // address of the thunk push ecx // this ptr + CHECK_STACK_ALIGNMENT call C_FUNC(VirtualMethodFixupWorker) + add esp, 8 // Restore stack pointer EPILOG_BEG @@ -850,6 +853,9 @@ NESTED_ENTRY VirtualMethodFixupStub, _TEXT, NoHandler // Pop ebp frame EPILOG_END + // Pop return address + add esp, 4 + PATCH_LABEL VirtualMethodFixupPatchLabel // Proceed to execute the actual method. jmp eax -- 2.7.4