diff --git a/Source/Windows/ARM64EC/Module.cpp b/Source/Windows/ARM64EC/Module.cpp index a0714c704..c61422b7c 100644 --- a/Source/Windows/ARM64EC/Module.cpp +++ b/Source/Windows/ARM64EC/Module.cpp @@ -435,7 +435,9 @@ static void RethrowGuestException(const EXCEPTION_RECORD& Rec, ARM64_NT_CONTEXT& auto* Args = reinterpret_cast(FEXCore::AlignDown(GuestSp, 64)) - 1; LogMan::Msg::DFmt("Reconstructing context"); - ReconstructThreadState(Thread, Context); + if (!IsDispatcherAddress(Context.Pc)) { + ReconstructThreadState(Thread, Context); + } Args->Context = StoreStateToPackedECContext(Thread, Context.Fpcr, Context.Fpsr); LogMan::Msg::DFmt("pc: {:X} rip: {:X}", Context.Pc, Args->Context.Pc); diff --git a/Source/Windows/WOW64/Module.cpp b/Source/Windows/WOW64/Module.cpp index 2cb5df967..2bc7ca749 100644 --- a/Source/Windows/WOW64/Module.cpp +++ b/Source/Windows/WOW64/Module.cpp @@ -131,9 +131,14 @@ uint64_t GetWowTEB(void* TEB) { *reinterpret_cast(reinterpret_cast(TEB) + WowTEBOffsetMemberOffset) + reinterpret_cast(TEB)); } +bool IsDispatcherAddress(uint64_t Address) { + const auto& Config = SignalDelegator->GetConfig(); + return Address >= Config.DispatcherBegin && Address < Config.DispatcherEnd; +} + bool IsAddressInJit(uint64_t Address) { const auto& Config = SignalDelegator->GetConfig(); - if (Address >= Config.DispatcherBegin && Address < Config.DispatcherEnd) { + if (IsDispatcherAddress(Address)) { return true; } @@ -272,7 +277,9 @@ void ReconstructThreadState(CONTEXT* Context) { } WOW64_CONTEXT ReconstructWowContext(CONTEXT* Context) { - ReconstructThreadState(Context); + if (!IsDispatcherAddress(Context->Pc)) { + ReconstructThreadState(Context); + } WOW64_CONTEXT WowContext { .ContextFlags = WOW64_CONTEXT_ALL,