From f48071dcbef0cacb09772266f7043bb0dfd551e6 Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Wed, 31 Jul 2024 17:08:06 +0000 Subject: [PATCH] ARM64EC: Switch to the emulator stack in BeginSimulation Windows calls this function on the guest stack for some reason. --- Source/Windows/ARM64EC/Module.S | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Source/Windows/ARM64EC/Module.S b/Source/Windows/ARM64EC/Module.S index 1ed2bd599..9d8e169ee 100644 --- a/Source/Windows/ARM64EC/Module.S +++ b/Source/Windows/ARM64EC/Module.S @@ -41,6 +41,9 @@ enter_jit: // Expects a CONTEXT pointer in x0 .global BeginSimulation BeginSimulation: + ldr x17, [x18, #0x1788] // TEB->ChpeV2CpuAreaInfo + ldr x16, [x17, #0x8] // ChpeV2CpuAreaInfo->EmulatorStackBase + mov sp, x16 bl "#SyncThreadContext" ldr x17, [x18, #0x1788] // TEB->ChpeV2CpuAreaInfo ldr x16, [x17, #0x48] // ChpeV2CpuAreaInfo->EmulatorData[3] - DispatcherLoopTopEnterECFillSRA