FEX: Implements support for JIT CodeBuffer guard page restart

When the JIT CodeBuffer overflows, we will now catch accesses to the
guard page and longjump while restarting the JIT with a larger buffer
request.

Fixes #4877
This commit is contained in:
Ryan Houdek committed 2025-11-10 11:55:21 -08:00
1 parent 43d9384b1c
commit e862c904a9
9 files changed
+93 -4

No files matched your search

+6
View File
@@ -28,6 +28,7 @@ $end_info$
#include <FEXCore/Utils/SignalScopeGuards.h>
#include "Common/CallRetStack.h"
#include "Common/JITGuardPage.h"
#include "Common/Config.h"
#include "Common/Exception.h"
#include "Common/InvalidationTracker.h"
@@ -736,6 +737,11 @@ bool ResetToConsistentStateImpl(const ThreadCPUArea CPUArea, EXCEPTION_RECORD* E
return true;
}
if (FEX::Windows::JITGuardPage::HandleJITGuardPage(Thread, reinterpret_cast<void*>(FaultAddress), NativeContext->X,
reinterpret_cast<__uint128_t*>(NativeContext->V), &NativeContext->Pc)) {
return true;
}
std::scoped_lock Lock(ThreadCreationMutex);
if (InvalidationTracker && InvalidationTracker->HandleRWXAccessViolation(Thread, NativeContext->Pc, FaultAddress)) {
FEXCORE_PROFILE_INSTANT_INCREMENT(Thread, AccumulatedSMCCount, 1);