Jit: Fix syscall outside delay slot.

Doesn't happen in real games, but useful in debug code.
This commit is contained in:
Unknown W. Brackets 2017-06-04 09:15:13 -07:00
parent 80be3166af
commit 33b073c545
4 changed files with 19 additions and 0 deletions

View File

@ -612,6 +612,11 @@ void ArmJit::Comp_Syscall(MIPSOpcode op)
RestoreRoundingMode();
js.downcountAmount = -offset;
if (!js.inDelaySlot) {
gpr.SetRegImm(SCRATCHREG1, GetCompilerPC() + 4);
MovToPC(SCRATCHREG1);
}
FlushAll();
SaveDowncount();

View File

@ -594,6 +594,11 @@ void Arm64Jit::Comp_Syscall(MIPSOpcode op)
RestoreRoundingMode();
js.downcountAmount = -offset;
if (!js.inDelaySlot) {
gpr.SetRegImm(SCRATCH1, GetCompilerPC() + 4);
MovToPC(SCRATCH1);
}
FlushAll();
SaveStaticRegisters();

View File

@ -380,6 +380,11 @@ void IRFrontend::Comp_Syscall(MIPSOpcode op) {
ir.Write(IROp::Downcount, 0, dcAmount & 0xFF, dcAmount >> 8);
js.downcountAmount = 0;
// If not in a delay slot, we need to update PC.
if (!js.inDelaySlot) {
ir.Write(IROp::SetPCConst, 0, ir.AddConstant(GetCompilerPC() + 4));
}
FlushAll();
RestoreRoundingMode();

View File

@ -787,6 +787,10 @@ void Jit::Comp_Syscall(MIPSOpcode op)
RestoreRoundingMode();
js.downcountAmount = -offset;
if (!js.inDelaySlot) {
MOV(32, M(&mips_->pc), Imm32(GetCompilerPC() + 4));
}
#ifdef USE_PROFILER
// When profiling, we can't skip CallSyscall, since it times syscalls.
ABI_CallFunctionC(&CallSyscall, op.encoding);