Skip to content

Commit

Permalink
x86jit: Handle breakpoints.
Browse files Browse the repository at this point in the history
Otherwise, we don't actually break until later, which isn't great.
Could be more optimal, "rewinding" regcache state.
  • Loading branch information
unknownbrackets committed Sep 3, 2023
1 parent 259734b commit 60bcc5b
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion Core/MIPS/x86/X64IRCompSystem.cpp
Expand Up @@ -23,6 +23,7 @@
#include "Core/HLE/HLE.h"
#include "Core/HLE/ReplaceTables.h"
#include "Core/MemMap.h"
#include "Core/MIPS/IR/IRInterpreter.h"
#include "Core/MIPS/x86/X64IRJit.h"
#include "Core/MIPS/x86/X64IRRegCache.h"

Expand Down Expand Up @@ -88,9 +89,25 @@ void X64JitBackend::CompIR_Breakpoint(IRInst inst) {

switch (inst.op) {
case IROp::Breakpoint:
FlushAll();
// Note: the constant could be a delay slot.
ABI_CallFunctionC((const void *)&IRRunBreakpoint, inst.constant);
TEST(32, R(EAX), R(EAX));
J_CC(CC_NZ, dispatcherCheckCoreState_, true);
break;

case IROp::MemoryCheck:
CompIR_Generic(inst);
{
X64Reg addrBase = regs_.MapGPR(inst.src1);
FlushAll();
LEA(32, addrBase, MDisp(addrBase, inst.constant));
MovFromPC(SCRATCH1);
LEA(32, SCRATCH1, MDisp(SCRATCH1, inst.dest));
ABI_CallFunctionRR((const void *)&IRRunMemCheck, SCRATCH1, addrBase);
TEST(32, R(EAX), R(EAX));
J_CC(CC_NZ, dispatcherCheckCoreState_, true);
break;
}

default:
INVALIDOP;
Expand Down

0 comments on commit 60bcc5b

Please sign in to comment.