From: Jonghyun Park Date: Fri, 3 Mar 2017 23:56:06 +0000 (+0900) Subject: [x86/Linux] Revise VirtualMethodFixupStub (dotnet/coreclr#9929) X-Git-Tag: submit/tizen/20210909.063632~11030^2~7851 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9f2aedb165af2549745617ee09c5013e33a48968;p=platform%2Fupstream%2Fdotnet%2Fruntime.git [x86/Linux] Revise VirtualMethodFixupStub (dotnet/coreclr#9929) * [x86/Linux] Revise VirtualMethodFixupStub Commit migrated from https://github.com/dotnet/coreclr/commit/ad9153147dcc2045041c178a49a69cc441758c79 --- 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