JitInterface: Refactor to class, move to System.

This commit is contained in:
Admiral H. Curtiss
2023-03-25 15:46:19 +01:00
parent db40348c86
commit 9217a9eba4
21 changed files with 246 additions and 182 deletions

View File

@@ -16,6 +16,7 @@
#include "Core/MachineContext.h"
#include "Core/PowerPC/JitInterface.h"
#include "Core/System.h"
#if defined(__FreeBSD__) || defined(__NetBSD__)
#include <signal.h>
@@ -60,7 +61,7 @@ static LONG NTAPI Handler(PEXCEPTION_POINTERS pPtrs)
uintptr_t fault_address = (uintptr_t)pPtrs->ExceptionRecord->ExceptionInformation[1];
SContext* ctx = pPtrs->ContextRecord;
if (JitInterface::HandleFault(fault_address, ctx))
if (Core::System::GetInstance().GetJitInterface().HandleFault(fault_address, ctx))
{
return EXCEPTION_CONTINUE_EXECUTION;
}
@@ -72,7 +73,7 @@ static LONG NTAPI Handler(PEXCEPTION_POINTERS pPtrs)
}
case EXCEPTION_STACK_OVERFLOW:
if (JitInterface::HandleStackFault())
if (Core::System::GetInstance().GetJitInterface().HandleStackFault())
return EXCEPTION_CONTINUE_EXECUTION;
else
return EXCEPTION_CONTINUE_SEARCH;
@@ -190,7 +191,8 @@ static void ExceptionThread(mach_port_t port)
thread_state64_t* state = (thread_state64_t*)msg_in.old_state;
bool ok = JitInterface::HandleFault((uintptr_t)msg_in.code[1], state);
bool ok =
Core::System::GetInstance().GetJitInterface().HandleFault((uintptr_t)msg_in.code[1], state);
// Set up the reply.
msg_out.Head.msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REMOTE(msg_in.Head.msgh_bits), 0);
@@ -281,13 +283,13 @@ static void sigsegv_handler(int sig, siginfo_t* info, void* raw_context)
mcontext_t* ctx = &context->uc_mcontext;
#endif
// assume it's not a write
if (!JitInterface::HandleFault(bad_address,
if (!Core::System::GetInstance().GetJitInterface().HandleFault(bad_address,
#ifdef __APPLE__
*ctx
*ctx
#else
ctx
ctx
#endif
))
))
{
// retry and crash
// According to the sigaction man page, if sa_flags "SA_SIGINFO" is set to the sigaction