diff --git a/Source/Windows/ARM64EC/Module.cpp b/Source/Windows/ARM64EC/Module.cpp index 35cac12f6..5f61c07ea 100644 --- a/Source/Windows/ARM64EC/Module.cpp +++ b/Source/Windows/ARM64EC/Module.cpp @@ -624,6 +624,8 @@ NTSTATUS ProcessInit() { CPUFeatures.emplace(*CTX); X64ReturnInstr = ::VirtualAlloc(nullptr, FEXCore::Utils::FEX_PAGE_SIZE, MEM_COMMIT, PAGE_EXECUTE_READWRITE); + InvalidationTracker->HandleMemoryProtectionNotification(reinterpret_cast(X64ReturnInstr), FEXCore::Utils::FEX_PAGE_SIZE, + PAGE_EXECUTE_READ); *reinterpret_cast(X64ReturnInstr) = 0xc3; const uintptr_t KiUserExceptionDispatcherFFS = reinterpret_cast(GetProcAddress(NtDll, "KiUserExceptionDispatcher")); diff --git a/Source/Windows/WOW64/Module.cpp b/Source/Windows/WOW64/Module.cpp index c2234bc5a..6dd89cf20 100644 --- a/Source/Windows/WOW64/Module.cpp +++ b/Source/Windows/WOW64/Module.cpp @@ -503,6 +503,7 @@ void BTCpuProcessInit() { SIZE_T Size = 4; void* Addr = nullptr; NtAllocateVirtualMemory(NtCurrentProcess(), &Addr, (1U << 31) - 1, &Size, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE); + InvalidationTracker->HandleMemoryProtectionNotification(reinterpret_cast(Addr), Size, PAGE_EXECUTE); *reinterpret_cast(Addr) = 0x2ecd2ecd; BridgeInstrs::Syscall = Addr; BridgeInstrs::UnixCall = reinterpret_cast(reinterpret_cast(Addr) + 2);