From 8644fdd595cb14453b47b9028483a9e1a168bf88 Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Mon, 7 Apr 2025 12:51:18 +0100 Subject: [PATCH] ARM64EC: Slight cleanup --- Source/Windows/ARM64EC/Module.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/Windows/ARM64EC/Module.cpp b/Source/Windows/ARM64EC/Module.cpp index f4c579719..03cd32683 100644 --- a/Source/Windows/ARM64EC/Module.cpp +++ b/Source/Windows/ARM64EC/Module.cpp @@ -663,11 +663,11 @@ bool ResetToConsistentStateImpl(EXCEPTION_RECORD* Exception, CONTEXT* GuestConte FEXCORE_PROFILE_ACCUMULATION(Thread, AccumulatedSignalTime); LogMan::Msg::DFmt("Exception: Code: {:X} Address: {:X}", Exception->ExceptionCode, reinterpret_cast(Exception->ExceptionAddress)); - if (Exception->ExceptionCode == EXCEPTION_ACCESS_VIOLATION && Thread && InvalidationTracker) { + if (Exception->ExceptionCode == EXCEPTION_ACCESS_VIOLATION) { const auto FaultAddress = static_cast(Exception->ExceptionInformation[1]); std::scoped_lock Lock(ThreadCreationMutex); - if (InvalidationTracker->HandleRWXAccessViolation(FaultAddress)) { + if (InvalidationTracker && InvalidationTracker->HandleRWXAccessViolation(FaultAddress)) { FEXCORE_PROFILE_INSTANT_INCREMENT(Thread, AccumulatedSMCCount, 1); if (CTX->IsAddressInCodeBuffer(Thread, NativeContext->Pc) && !CTX->IsCurrentBlockSingleInst(CPUArea.ThreadState()) && CTX->IsAddressInCurrentBlock(Thread, FaultAddress, 8)) { @@ -687,7 +687,7 @@ bool ResetToConsistentStateImpl(EXCEPTION_RECORD* Exception, CONTEXT* GuestConte } } - if (!CTX->IsAddressInCodeBuffer(CPUArea.ThreadState(), NativeContext->Pc) && !IsDispatcherAddress(NativeContext->Pc)) { + if (!CTX->IsAddressInCodeBuffer(Thread, NativeContext->Pc) && !IsDispatcherAddress(NativeContext->Pc)) { LogMan::Msg::DFmt("Passing through exception"); return false; } @@ -700,8 +700,8 @@ bool ResetToConsistentStateImpl(EXCEPTION_RECORD* Exception, CONTEXT* GuestConte // The JIT (in CompileBlock) emits code to check the suspend doorbell at the start of every block, and run the following instruction if it is set: static constexpr uint32_t SuspendTrapMagic {0xD4395FC0}; // brk #0xCAFE if (Exception->ExceptionCode == EXCEPTION_ILLEGAL_INSTRUCTION && *reinterpret_cast(NativeContext->Pc) == SuspendTrapMagic) { - Exception::ReconstructThreadState(CPUArea.ThreadState(), *NativeContext); - *NativeContext = Exception::StoreStateToPackedECContext(CPUArea.ThreadState(), NativeContext->Fpcr, NativeContext->Fpsr); + Exception::ReconstructThreadState(Thread, *NativeContext); + *NativeContext = Exception::StoreStateToPackedECContext(Thread, NativeContext->Fpcr, NativeContext->Fpsr); LogMan::Msg::DFmt("Suspending: RIP: {:X} SP: {:X}", NativeContext->Pc, NativeContext->Sp); CPUArea.Area->InSimulation = 0; *CPUArea.Area->SuspendDoorbell = 0;