Plumb through the PC value for syscalls, so we can get better diagnostics for unresolved ones.

This commit is contained in:
Henrik Rydgård committed 2026-08-15 19:14:13 +02:00
1 parent ae14ebb6ac
commit 67ddf899ba
23 files changed
+208 -89

No files matched your search

+20 -4
View File
@@ -211,11 +211,18 @@ void X64JitBackend::CompIR_System(IRInst inst) {
// Skip the CallSyscall where possible.
{
MIPSOpcode op(inst.constant);
void *quickFunc = GetQuickSyscallFunc(op);
if (quickFunc) {
ABI_CallFunctionP((const u8 *)quickFunc, (void *)GetSyscallFuncPointer(op));
const HLEFunction *func = GetSyscallFunctionData(op, 0);
if (func) {
void *quickFunc = GetQuickSyscallFunc(func, op);
if (quickFunc) {
ABI_CallFunctionP((const u8 *)quickFunc, (void *)func);
} else {
ABI_CallFunctionC((const u8 *)&CallSyscall, inst.constant);
}
} else {
ABI_CallFunctionC((const u8 *)&CallSyscall, inst.constant);
_dbg_assert_(false);
// Shouldn't get here, this should be resolved during ->IR compilation.
ABI_CallFunctionC((const u8 *)&CallSyscallUnresolvedAtPC, 0);
}
}
#endif
@@ -225,6 +232,15 @@ void X64JitBackend::CompIR_System(IRInst inst) {
// This is always followed by an ExitToPC, where we check coreState.
break;
case IROp::SyscallUnresolved:
FlushAll();
SaveStaticRegisters();
WriteDebugProfilerStatus(IRProfilerStatus::SYSCALL);
ABI_CallFunctionC((const u8 *)&CallSyscallUnresolvedAtPC, inst.constant);
WriteDebugProfilerStatus(IRProfilerStatus::IN_JIT);
LoadStaticRegisters();
break;
case IROp::CallReplacement:
FlushAll();
SaveStaticRegisters();