* [x86/linux] Implement BackPatchWorkerAsmStub
This implementation is ported from BackPatchWorkerAsmStub in
vm/i386/virtualcallstubcpu.hpp
Commit migrated from https://github.com/dotnet/coreclr/commit/
e9ad7cf9690fdca6f4f3f1b6bafdebe9406db9b7
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
}
};
-EXTERN_C VOID BackPatchWorkerAsmStub()
-{
- PORTABILITY_ASSERT("BackPatchWorkerAsmStub");
-}
-
EXTERN_C VOID JIT_TailCall()
{
PORTABILITY_ASSERT("JIT_TailCall");
// 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
#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_
#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);