diff options
-rw-r--r-- | src/vm/i386/asmhelpers.S | 23 | ||||
-rw-r--r-- | src/vm/i386/unixstubs.cpp | 5 | ||||
-rw-r--r-- | src/vm/virtualcallstub.cpp | 7 | ||||
-rw-r--r-- | src/vm/virtualcallstub.h | 7 |
4 files changed, 37 insertions, 5 deletions
diff --git a/src/vm/i386/asmhelpers.S b/src/vm/i386/asmhelpers.S index 89e946dc0f..921e09fef1 100644 --- a/src/vm/i386/asmhelpers.S +++ b/src/vm/i386/asmhelpers.S @@ -1104,3 +1104,26 @@ LOCAL_LABEL(fail): NESTED_END ResolveWorkerChainLookupAsmStub, _TEXT #endif // CROSSGEN_COMPILE + +// backpatch a call site to point to a different stub +NESTED_ENTRY BackPatchWorkerAsmStub, _TEXT, NoHandler + PROLOG_BEG + PROLOG_PUSH eax // it may contain siteAddrForRegisterIndirect + PROLOG_PUSH ecx + PROLOG_PUSH edx + PROLOG_END + + sub esp, 4 // for 16 bytes align + push eax // push any indirect call address as the second arg to BackPatchWorker + push [ebp+8] // and push return address as the first arg to BackPatchWorker + + call C_FUNC(BackPatchWorkerStaticStub) + add esp, 12 + + EPILOG_BEG + EPILOG_POP edx + EPILOG_POP ecx + EPILOG_POP eax + EPILOG_END + ret +NESTED_END BackPatchWorkerAsmStub, _TEXT diff --git a/src/vm/i386/unixstubs.cpp b/src/vm/i386/unixstubs.cpp index 9705ab0580..8441b0794e 100644 --- a/src/vm/i386/unixstubs.cpp +++ b/src/vm/i386/unixstubs.cpp @@ -31,11 +31,6 @@ extern "C" } }; -EXTERN_C VOID BackPatchWorkerAsmStub() -{ - PORTABILITY_ASSERT("BackPatchWorkerAsmStub"); -} - EXTERN_C VOID JIT_TailCall() { PORTABILITY_ASSERT("JIT_TailCall"); diff --git a/src/vm/virtualcallstub.cpp b/src/vm/virtualcallstub.cpp index 6681b312f4..01b15c689e 100644 --- a/src/vm/virtualcallstub.cpp +++ b/src/vm/virtualcallstub.cpp @@ -4047,3 +4047,10 @@ BOOL VirtualCallStubManagerManager::TraceManager( // Forward the call to the appropriate manager. return pMgr->TraceManager(thread, trace, pContext, pRetAddr); } + +#if defined(_TARGET_X86_) && defined(FEATURE_PAL) +void BackPatchWorkerStaticStub(PCODE returnAddr, TADDR siteAddrForRegisterIndirect) +{ + VirtualCallStubManager::BackPatchWorkerStatic(returnAddr, siteAddrForRegisterIndirect); +} +#endif diff --git a/src/vm/virtualcallstub.h b/src/vm/virtualcallstub.h index 4bdc1da916..7b6fedf2b2 100644 --- a/src/vm/virtualcallstub.h +++ b/src/vm/virtualcallstub.h @@ -164,6 +164,9 @@ extern "C" void ResolveWorkerChainLookupAsmStub(); // for chaining of entries #ifdef _TARGET_X86_ extern "C" void BackPatchWorkerAsmStub(); // backpatch a call site to point to a different stub +#ifdef FEATURE_PAL +extern "C" void BackPatchWorkerStaticStub(PCODE returnAddr, TADDR siteAddrForRegisterIndirect); +#endif // FEATURE_PAL #endif // _TARGET_X86_ @@ -548,6 +551,10 @@ private: #endif ); +#if defined(_TARGET_X86_) && defined(FEATURE_PAL) + friend void BackPatchWorkerStaticStub(PCODE returnAddr, TADDR siteAddrForRegisterIndirect); +#endif + //These are the entrypoints that the stubs actually end up calling via the // xxxAsmStub methods above static void STDCALL BackPatchWorkerStatic(PCODE returnAddr, TADDR siteAddrForRegisterIndirect); |