diff --git a/Source/Core/Core/PowerPC/Jit64/Jit.cpp b/Source/Core/Core/PowerPC/Jit64/Jit.cpp index 842b1c3de7..e20c3c8685 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit.cpp @@ -235,7 +235,7 @@ void Jit64::FallBackToInterpreter(UGeckoInstruction inst) { gpr.Flush(); fpr.Flush(); - if (js.isLastInstruction) + if (js.op->opinfo->flags & FL_ENDBLOCK) { MOV(32, PPCSTATE(pc), Imm32(js.compilerPC)); MOV(32, PPCSTATE(npc), Imm32(js.compilerPC + 4)); @@ -244,6 +244,25 @@ void Jit64::FallBackToInterpreter(UGeckoInstruction inst) ABI_PushRegistersAndAdjustStack({}, 0); ABI_CallFunctionC((void*)instr, inst.hex); ABI_PopRegistersAndAdjustStack({}, 0); + if (js.op->opinfo->flags & FL_ENDBLOCK) + { + if (js.isLastInstruction) + { + MOV(32, R(RSCRATCH), PPCSTATE(npc)); + MOV(32, PPCSTATE(pc), R(RSCRATCH)); + WriteExceptionExit(); + } + else + { + MOV(32, R(RSCRATCH), PPCSTATE(npc)); + SUB(32, R(RSCRATCH), Imm32(js.compilerPC + 4)); + FixupBranch c = J_CC(CC_Z); + MOV(32, R(RSCRATCH), PPCSTATE(npc)); + MOV(32, PPCSTATE(pc), R(RSCRATCH)); + WriteExceptionExit(); + SetJumpTarget(c); + } + } } void Jit64::HLEFunction(UGeckoInstruction _inst) diff --git a/Source/Core/Core/PowerPC/Jit64/Jit.h b/Source/Core/Core/PowerPC/Jit64/Jit.h index 12232edc76..333a5b2d8f 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit.h +++ b/Source/Core/Core/PowerPC/Jit64/Jit.h @@ -247,6 +247,4 @@ public: void lmw(UGeckoInstruction inst); void stmw(UGeckoInstruction inst); - - void icbi(UGeckoInstruction inst); }; diff --git a/Source/Core/Core/PowerPC/Jit64/Jit64_Tables.cpp b/Source/Core/Core/PowerPC/Jit64/Jit64_Tables.cpp index 051a85f335..7f6f97a619 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit64_Tables.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit64_Tables.cpp @@ -300,7 +300,7 @@ static GekkoOPTemplate table31[] = {4, &Jit64::twX}, // tw {598, &Jit64::DoNothing}, // sync - {982, &Jit64::icbi}, // icbi + {982, &Jit64::FallBackToInterpreter}, // icbi // Unused instructions on GC {310, &Jit64::FallBackToInterpreter}, // eciwx diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp index 03c426e24c..5b80bbee77 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp @@ -561,9 +561,3 @@ void Jit64::stmw(UGeckoInstruction inst) } gpr.UnlockAllX(); } - -void Jit64::icbi(UGeckoInstruction inst) -{ - FallBackToInterpreter(inst); - WriteExit(js.compilerPC + 4); -} diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_SystemRegisters.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_SystemRegisters.cpp index 0f43cc2674..d781a17a3a 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit_SystemRegisters.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit_SystemRegisters.cpp @@ -348,8 +348,7 @@ void Jit64::mfspr(UGeckoInstruction inst) void Jit64::mtmsr(UGeckoInstruction inst) { INSTRUCTION_START - // Don't interpret this, if we do we get thrown out - //JITDISABLE(bJITSystemRegistersOff); + JITDISABLE(bJITSystemRegistersOff); if (!gpr.R(inst.RS).IsImm()) { gpr.Lock(inst.RS);