mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-10 04:03:44 +02:00
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
18 lines
686 B
C++
18 lines
686 B
C++
// SPDX-License-Identifier: MIT
|
|
#pragma once
|
|
#include <FEXCore/Debug/InternalThreadState.h>
|
|
#include <FEXCore/Utils/LongJump.h>
|
|
|
|
namespace FEX::Windows::JITGuardPage {
|
|
static inline bool HandleJITGuardPage(FEXCore::Core::InternalThreadState* Thread, void* Address, uint64_t* GPRs, __uint128_t* FPRs, uint64_t* PC) {
|
|
if (Address >= reinterpret_cast<void*>(Thread->JITGuardPage) &&
|
|
Address < reinterpret_cast<void*>(Thread->JITGuardPage + FEXCore::Utils::FEX_PAGE_SIZE)) {
|
|
FEXCore::UncheckedLongJump::ManuallyLoadJumpBuf(Thread->RestartJump, Thread->JITGuardOverflowArgument, GPRs, FPRs, PC);
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
} // namespace FEX::Windows::JITGuardPage
|