diff --git a/Source/Windows/WOW64/Module.cpp b/Source/Windows/WOW64/Module.cpp index 6135669f6..5837b669e 100644 --- a/Source/Windows/WOW64/Module.cpp +++ b/Source/Windows/WOW64/Module.cpp @@ -103,6 +103,8 @@ std::mutex ThreadCreationMutex; // Map of TIDs to their FEX thread state, `ThreadCreationMutex` must be locked when accessing std::unordered_map Threads; +decltype(__wine_unix_call_dispatcher) WineUnixCall; + std::pair GetThreadTLS(HANDLE Thread) { THREAD_BASIC_INFORMATION Info; const NTSTATUS Err = NtQueryInformationThread(Thread, ThreadBasicInformation, &Info, sizeof(Info), nullptr); @@ -365,7 +367,7 @@ public: ReturnRSP += sizeof(StackLayout); Context::UnlockJITContext(); - ReturnRAX = static_cast(__wine_unix_call(StackArgs->Handle, StackArgs->ID, ULongToPtr(StackArgs->Args))); + ReturnRAX = static_cast(WineUnixCall(StackArgs->Handle, StackArgs->ID, ULongToPtr(StackArgs->Args))); Context::LockJITContext(); } else if (Frame->State.rip == (uint64_t)BridgeInstrs::Syscall) { const uint64_t EntryRAX = Frame->State.gregs[FEXCore::X86State::REG_RAX]; @@ -445,6 +447,11 @@ void BTCpuProcessInit() { *reinterpret_cast(Addr) = 0x2ecd2ecd; BridgeInstrs::Syscall = Addr; BridgeInstrs::UnixCall = reinterpret_cast(reinterpret_cast(Addr) + 2); + + const auto Sym = GetProcAddress(GetModuleHandle("ntdll.dll"), "__wine_unix_call_dispatcher"); + if (Sym) { + WineUnixCall = *reinterpret_cast(Sym); + } } NTSTATUS BTCpuThreadInit() {