diff --git a/Source/Core/Core/Src/CoreParameter.h b/Source/Core/Core/Src/CoreParameter.h index 70b97a4357..53c6e8066a 100644 --- a/Source/Core/Core/Src/CoreParameter.h +++ b/Source/Core/Core/Src/CoreParameter.h @@ -46,6 +46,7 @@ struct SCoreStartupParameter bool bJITIntegerOff; bool bJITPairedOff; bool bJITSystemRegistersOff; + bool bJITBranchOff; bool bUseDualCore; bool bSkipIdle; diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp index d108bcac5e..4134870bbe 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp @@ -221,6 +221,11 @@ namespace CPUCompare } Interpreter::_interpreterInstruction instr = GetInterpreterOp(inst); ABI_CallFunctionC((void*)instr, inst.hex); + if (js.isLastInstruction) + { + MOV(32, R(EAX), M(&NPC)); + WriteRfiExitDestInEAX(); + } } void Jit64::unknown_instruction(UGeckoInstruction inst) @@ -377,6 +382,8 @@ namespace CPUCompare const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buffer, JitBlock *b) { + Core::g_CoreStartupParameter.bJITOff = true; + if (em_address == 0) PanicAlert("ERROR : Trying to compile at 0. LR=%08x", LR); diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Branch.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Branch.cpp index db3aaa0cc7..3114a68fb1 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Branch.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Branch.cpp @@ -17,6 +17,7 @@ #include "Common.h" #include "Thunk.h" +#include "../../Core.h" #include "../PowerPC.h" #include "../../CoreTiming.h" #include "../PPCTables.h" @@ -40,15 +41,21 @@ using namespace Gen; - void Jit64::sc(UGeckoInstruction _inst) + void Jit64::sc(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITBranchOff) + {Default(inst); return;} // turn off from debugger + gpr.Flush(FLUSH_ALL); fpr.Flush(FLUSH_ALL); WriteExceptionExit(EXCEPTION_SYSCALL); } - void Jit64::rfi(UGeckoInstruction _inst) + void Jit64::rfi(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITBranchOff) + {Default(inst); return;} // turn off from debugger + gpr.Flush(FLUSH_ALL); fpr.Flush(FLUSH_ALL); //Bits SRR1[0, 5-9, 16-23, 25-27, 30-31] are placed into the corresponding bits of the MSR. @@ -70,6 +77,9 @@ using namespace Gen; void Jit64::bx(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITBranchOff) + {Default(inst); return;} // turn off from debugger + if (inst.LK) MOV(32, M(&LR), Imm32(js.compilerPC + 4)); gpr.Flush(FLUSH_ALL); @@ -107,6 +117,9 @@ using namespace Gen; // variants of this instruction. void Jit64::bcx(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITBranchOff) + {Default(inst); return;} // turn off from debugger + // USES_CR _assert_msg_(DYNA_REC, js.isLastInstruction, "bcx not last instruction of block"); @@ -198,6 +211,9 @@ using namespace Gen; void Jit64::bcctrx(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITBranchOff) + {Default(inst); return;} // turn off from debugger + gpr.Flush(FLUSH_ALL); fpr.Flush(FLUSH_ALL); @@ -237,6 +253,9 @@ using namespace Gen; void Jit64::bclrx(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITBranchOff) + {Default(inst); return;} // turn off from debugger + gpr.Flush(FLUSH_ALL); fpr.Flush(FLUSH_ALL); //Special case BLR @@ -255,6 +274,4 @@ using namespace Gen; } // Call interpreter Default(inst); - MOV(32, R(EAX), M(&NPC)); - WriteExitDestInEAX(0); } diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_SystemRegisters.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_SystemRegisters.cpp index 45a5a1bad4..4947ca9a67 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_SystemRegisters.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_SystemRegisters.cpp @@ -118,8 +118,8 @@ // -------------- void Jit64::mtmsr(UGeckoInstruction inst) { - //if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITSystemRegistersOff) - // {Default(inst); return;} // turn off from debugger + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITSystemRegistersOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; gpr.LoadToX64(inst.RS, true, false); MOV(32, M(&MSR), gpr.R(inst.RS));