mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-11 13:01:23 +02:00
Arm64EC: Invert suspend doorbell and move out of hot path
This was causing a surprisingly high amount of branch mispredicts in Death Stranding. Suspend doorbell is fairly rare so just invert the check and move the target down out of the hot path. Then the doorbell handling code will trampoline to the correct location still.
This commit is contained in:
2 files changed
+11
-7
No files matched your search
@@ -69,6 +69,7 @@ extern IMAGE_DOS_HEADER __ImageBase; // Provided by the linker
|
||||
extern void* ExitFunctionEC;
|
||||
extern void* CheckCall;
|
||||
extern void* ExitFunctionSuspendPoint;
|
||||
extern void* ExitFunctionSuspendResumePoint;
|
||||
|
||||
void* X64ReturnInstr; // See Module.S
|
||||
uintptr_t NtDllBase;
|
||||
@@ -676,7 +677,7 @@ bool ResetToConsistentStateImpl(const ThreadCPUArea CPUArea, EXCEPTION_RECORD* E
|
||||
// A suspend interrupt can occur in ExitFunctionEC before InSimulation is unset and set SuspendDoorbell. If this
|
||||
// occurs then it is still our duty to cooperatively suspend with an appropriate context. To support this, after
|
||||
// unsetting InSimulation a brk #0xCAFE instruction will be raised that we can handle here.
|
||||
NativeContext->Pc += 4; // Skip over the brk instruction when we resume
|
||||
NativeContext->Pc = reinterpret_cast<uintptr_t>(ExitFunctionSuspendResumePoint); // Jump to the suspend resume point.
|
||||
*CPUArea.Area->SuspendDoorbell = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user