From 26a8a2717c7270fdca25c6bb552cb1ef350b5d9e Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Mon, 29 Jul 2024 13:11:57 +0000 Subject: [PATCH] WOW64: Mark the CPU area context as dirty initially After thread creation, the WOW64 CPU area context needs to be flushed into the FEX state before entering the JIT. Wine explicitly calls BTCpuSetContext to trigger this but Windows doesn't. --- Source/Windows/WOW64/Module.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/Windows/WOW64/Module.cpp b/Source/Windows/WOW64/Module.cpp index 71cde0812..61b0746ec 100644 --- a/Source/Windows/WOW64/Module.cpp +++ b/Source/Windows/WOW64/Module.cpp @@ -468,6 +468,7 @@ void BTCpuThreadInit() { FEX::Windows::InitCRTThread(); auto* Thread = CTX->CreateThread(0, 0); GetTLS().ThreadState() = Thread; + GetTLS().ControlWord().fetch_or(ControlBits::WOW_CPU_AREA_DIRTY, std::memory_order::relaxed); std::scoped_lock Lock(ThreadCreationMutex); Threads.emplace(GetCurrentThreadId(), Thread);