diff options
author | Yongseop Kim <yons.kim@samsung.com> | 2017-02-28 18:25:10 +0900 |
---|---|---|
committer | Jan Vorlicek <janvorli@microsoft.com> | 2017-02-28 10:25:10 +0100 |
commit | e9ad7cf9690fdca6f4f3f1b6bafdebe9406db9b7 (patch) | |
tree | 31c2367cb90d15272f48d9f6beb7fa7e0ee3dc18 | |
parent | 04e30172080b8292e00771275c0b5d64198f42dc (diff) | |
download | coreclr-e9ad7cf9690fdca6f4f3f1b6bafdebe9406db9b7.tar.gz coreclr-e9ad7cf9690fdca6f4f3f1b6bafdebe9406db9b7.tar.bz2 coreclr-e9ad7cf9690fdca6f4f3f1b6bafdebe9406db9b7.zip |
[x86/linux] Implement BackPatchWorkerAsmStub (#9690)
* [x86/linux] Implement BackPatchWorkerAsmStub
This implementation is ported from BackPatchWorkerAsmStub in
vm/i386/virtualcallstubcpu.hpp
-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); |