Windows: Skip state reconstruction on exceptions in dispatcher

The dispatcher always spills register state before issuing faulting instructions
This commit is contained in:
Billy Laws committed 2024-12-09 12:30:00 +00:00
1 parent bdae4f6915
commit b6fe4cd6dd
2 files changed
+12 -3

No files matched your search

+9 -2
View File
@@ -131,9 +131,14 @@ uint64_t GetWowTEB(void* TEB) {
*reinterpret_cast<LONG*>(reinterpret_cast<uintptr_t>(TEB) + WowTEBOffsetMemberOffset) + reinterpret_cast<uint64_t>(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,