diff --git a/Source/Core/Core/Src/CoreParameter.cpp b/Source/Core/Core/Src/CoreParameter.cpp index 3ce3aa8123..2f005328be 100644 --- a/Source/Core/Core/Src/CoreParameter.cpp +++ b/Source/Core/Core/Src/CoreParameter.cpp @@ -37,6 +37,13 @@ void SCoreStartupParameter::LoadDefaults() bLockThreads = true; bWii = false; SelectedLanguage = 0; + + bJITOff = false; // debugger only settings + bJITLoadStoreOff = false; + bJITFloatingPointOff = false; + bJITIntegerOff = false; + bJITPairedOff = false; + bJITSystemRegistersOff = false; } bool SCoreStartupParameter::AutoSetup(EBootBios _BootBios) diff --git a/Source/Core/Core/Src/CoreParameter.h b/Source/Core/Core/Src/CoreParameter.h index 4babf27a07..ea6f22dbc5 100644 --- a/Source/Core/Core/Src/CoreParameter.h +++ b/Source/Core/Core/Src/CoreParameter.h @@ -36,6 +36,12 @@ struct SCoreStartupParameter // flags bool bEnableDebugging; bool bUseJIT; + bool bJITOff; + bool bJITLoadStoreOff; + bool bJITFloatingPointOff; + bool bJITIntegerOff; + bool bJITPairedOff; + bool bJITSystemRegistersOff; bool bUseDualCore; bool bSkipIdle; bool bNTSC; diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_FloatingPoint.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_FloatingPoint.cpp index ed2dd5d503..59c814f8bf 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_FloatingPoint.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_FloatingPoint.cpp @@ -17,6 +17,7 @@ #include "Common.h" +#include "../../Core.h" #include "../PowerPC.h" #include "../PPCTables.h" #include "x64Emitter.h" @@ -79,6 +80,8 @@ namespace Jit64 void fp_arith_s(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITFloatingPointOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; if (inst.Rc) { Default(inst); return; @@ -103,6 +106,8 @@ namespace Jit64 void fmaddXX(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITFloatingPointOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; if (inst.Rc) { Default(inst); return; @@ -152,6 +157,8 @@ namespace Jit64 void fmrx(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITFloatingPointOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; if (inst.Rc) { Default(inst); return; @@ -164,6 +171,8 @@ namespace Jit64 void fcmpx(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITFloatingPointOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; if (jo.fpAccurateFlags) { diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp index b53ca8fd71..dc688a74fd 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp @@ -15,6 +15,7 @@ // Official SVN repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ +#include "../../Core.h" // include "Common.h", "CoreParameter.h", SCoreStartupParameter #include "../PowerPC.h" #include "../PPCTables.h" #include "x64Emitter.h" @@ -92,6 +93,8 @@ namespace Jit64 void reg_imm(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; int d = inst.RD, a = inst.RA, s = inst.RS; switch (inst.OPCD) @@ -118,7 +121,9 @@ namespace Jit64 // unsigned void cmpli(UGeckoInstruction inst) - { + { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; int a = inst.RA; u32 uimm = inst.UIMM; @@ -147,6 +152,8 @@ namespace Jit64 // signed void cmpi(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; int a = inst.RA; s32 simm = (s32)(s16)inst.UIMM; @@ -175,6 +182,8 @@ namespace Jit64 // signed void cmp(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; int a = inst.RA; int b = inst.RB; @@ -205,6 +214,8 @@ namespace Jit64 // unsigned void cmpl(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; int a = inst.RA; int b = inst.RB; @@ -234,6 +245,8 @@ namespace Jit64 void orx(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; int a = inst.RA; int s = inst.RS; @@ -269,6 +282,8 @@ namespace Jit64 void andx(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; int a = inst.RA, s = inst.RS, b = inst.RB; if (a != s && a != b) { @@ -290,6 +305,8 @@ namespace Jit64 void extsbx(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; int a = inst.RA, s = inst.RS; @@ -305,6 +322,8 @@ namespace Jit64 void extshx(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; int a = inst.RA, s = inst.RS; gpr.LoadToX64(a, a == s, true); @@ -318,6 +337,8 @@ namespace Jit64 void subfic(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; int a = inst.RA, d = inst.RD; gpr.FlushLockX(ECX); @@ -352,6 +373,8 @@ namespace Jit64 void subfx(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; int a = inst.RA, b = inst.RB, d = inst.RD; gpr.Lock(a, b, d); @@ -373,6 +396,8 @@ namespace Jit64 void mulli(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; int a = inst.RA, d = inst.RD; gpr.FlushLockX(EDX); @@ -392,6 +417,8 @@ namespace Jit64 void mullwx(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; int a = inst.RA, b = inst.RB, d = inst.RD; gpr.FlushLockX(EDX); @@ -415,6 +442,8 @@ namespace Jit64 void mulhwux(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; int a = inst.RA, b = inst.RB, d = inst.RD; gpr.FlushLockX(EDX); @@ -476,6 +505,8 @@ namespace Jit64 void addx(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; int a = inst.RA, b = inst.RB, d = inst.RD; _assert_msg_(DYNA_REC, !inst.OE, "Add - OE enabled :("); @@ -527,6 +558,8 @@ namespace Jit64 // This can be optimized void addex(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; int a = inst.RA, b = inst.RB, d = inst.RD; gpr.FlushLockX(ECX); @@ -551,6 +584,8 @@ namespace Jit64 void rlwinmx(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; int a = inst.RA; int s = inst.RS; @@ -612,6 +647,8 @@ namespace Jit64 void rlwimix(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; int a = inst.RA; int s = inst.RS; @@ -644,6 +681,8 @@ namespace Jit64 void rlwnmx(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; int a = inst.RA, b = inst.RB, s = inst.RS; if (gpr.R(a).IsImm()) @@ -672,6 +711,8 @@ namespace Jit64 void negx(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; int a = inst.RA; int d = inst.RD; @@ -690,6 +731,8 @@ namespace Jit64 void srwx(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; int a = inst.RA; int b = inst.RB; @@ -717,6 +760,8 @@ namespace Jit64 void slwx(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; int a = inst.RA; int b = inst.RB; @@ -744,6 +789,8 @@ namespace Jit64 void srawix(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; int a = inst.RA; int s = inst.RS; @@ -787,6 +834,8 @@ namespace Jit64 // count leading zeroes void cntlzwx(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITIntegerOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; int a = inst.RA; int s = inst.RS; diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp index ba71681855..cd4138d20c 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp @@ -54,7 +54,10 @@ namespace Jit64 } void lbzx(UGeckoInstruction inst) { + //if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreOff) + // {Default(inst); return;} // turn off from debugger INSTRUCTION_START; + int a = inst.RA, b = inst.RB, d = inst.RD; gpr.Lock(a, b, d); gpr.FlushLockX(ABI_PARAM1); @@ -74,7 +77,10 @@ namespace Jit64 void lXz(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; + int d = inst.RD; int a = inst.RA; @@ -156,7 +162,10 @@ namespace Jit64 void lha(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; + int d = inst.RD; int a = inst.RA; s32 offset = (s32)(s16)inst.SIMM_16; @@ -175,7 +184,10 @@ namespace Jit64 // Zero cache line. void dcbz(UGeckoInstruction inst) { + //if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreOff) + // {Default(inst); return;} // turn off from debugger INSTRUCTION_START; + MOV(32, R(EAX), gpr.R(inst.RB)); if (inst.RA) ADD(32, R(EAX), gpr.R(inst.RA)); @@ -193,7 +205,10 @@ namespace Jit64 void stX(UGeckoInstruction inst) { + //if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreOff) + // {Default(inst); return;} // turn off from debugger INSTRUCTION_START; + int s = inst.RS; int a = inst.RA; diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStoreFloating.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStoreFloating.cpp index bd9342a403..045bca609c 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStoreFloating.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStoreFloating.cpp @@ -21,7 +21,7 @@ #include "Common.h" #include "../PowerPC.h" -#include "../../Core.h" +#include "../../Core.h" // include "Common.h", "CoreParameter.h" #include "../../HW/GPFifo.h" #include "../../HW/CommandProcessor.h" #include "../../HW/PixelEngine.h" @@ -66,6 +66,8 @@ u32 GC_ALIGNED16(temp32); void lfs(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; int d = inst.RD; int a = inst.RA; @@ -100,6 +102,8 @@ void lfs(UGeckoInstruction inst) void lfd(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; if (!cpu_info.bSSSE3) { DISABLE_32BIT; @@ -141,8 +145,11 @@ void lfd(UGeckoInstruction inst) fpr.UnlockAll(); } + void stfd(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; if (!cpu_info.bSSSE3) { @@ -186,6 +193,8 @@ void stfd(UGeckoInstruction inst) void stfs(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; bool update = inst.OPCD & 1; int s = inst.RS; @@ -249,6 +258,8 @@ void stfsx(UGeckoInstruction inst) void lfsx(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; fpr.Lock(inst.RS); fpr.LoadToX64(inst.RS, false, true); diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStorePaired.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStorePaired.cpp index 429f9e3655..11238b59bb 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStorePaired.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStorePaired.cpp @@ -106,6 +106,8 @@ const double GC_ALIGNED16(m_dequantizeTableD[]) = // We will have to break block after quantizers are written to. void psq_st(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; js.block_flags |= BLOCK_USE_GQR0 << inst.I; @@ -283,6 +285,8 @@ const u8 GC_ALIGNED16(pbswapShuffleNoop[16]) = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 void psq_l(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; js.block_flags |= BLOCK_USE_GQR0 << inst.I; diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Paired.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Paired.cpp index 5011ce37f3..4bb41de08a 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Paired.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Paired.cpp @@ -17,6 +17,7 @@ #include "Common.h" +#include "../../Core.h" #include "../PowerPC.h" #include "../PPCTables.h" #include "x64Emitter.h" @@ -53,6 +54,8 @@ namespace Jit64 void ps_mr(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITPairedOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; if (inst.Rc) { Default(inst); return; @@ -67,6 +70,8 @@ namespace Jit64 void ps_sel(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITPairedOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; Default(inst); return; @@ -98,6 +103,8 @@ namespace Jit64 void ps_sign(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITPairedOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; if (inst.Rc) { Default(inst); return; @@ -134,6 +141,8 @@ namespace Jit64 void ps_rsqrte(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITPairedOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; if (inst.Rc) { Default(inst); return; @@ -205,6 +214,8 @@ namespace Jit64 void ps_arith(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITPairedOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; if (inst.Rc) { Default(inst); return; @@ -229,6 +240,8 @@ namespace Jit64 //TODO: find easy cases and optimize them, do a breakout like ps_arith void ps_mergeXX(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITPairedOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; if (inst.Rc) { Default(inst); return; @@ -270,6 +283,8 @@ namespace Jit64 //TODO: add optimized cases void ps_maddXX(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITPairedOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; if (inst.Rc) { Default(inst); return; @@ -315,6 +330,8 @@ namespace Jit64 void ps_mulsX(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITPairedOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; Default(inst); return; diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_SystemRegisters.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_SystemRegisters.cpp index cdfb37a829..78850762a8 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_SystemRegisters.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_SystemRegisters.cpp @@ -17,6 +17,7 @@ #include "Common.h" +#include "../../Core.h" #include "../../CoreTiming.h" #include "../../HW/SystemTimers.h" #include "../PowerPC.h" @@ -36,6 +37,8 @@ namespace Jit64 { void mtspr(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITSystemRegistersOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; u32 iIndex = (inst.SPRU << 5) | (inst.SPRL & 0x1F); int d = inst.RD; @@ -84,6 +87,8 @@ namespace Jit64 void mfspr(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITSystemRegistersOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; u32 iIndex = (inst.SPRU << 5) | (inst.SPRL & 0x1F); int d = inst.RD; @@ -108,8 +113,14 @@ namespace Jit64 } } + + // ======================================================================================= + // ... ? Don't interpret this, if we do we get thrown out + // -------------- void mtmsr(UGeckoInstruction inst) { + //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)); @@ -117,9 +128,13 @@ namespace Jit64 fpr.Flush(FLUSH_ALL); WriteExit(js.compilerPC + 4, 0); } + // ============== + void mfmsr(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITSystemRegistersOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; //Privileged? gpr.LoadToX64(inst.RD, false); @@ -128,6 +143,8 @@ namespace Jit64 void mftb(UGeckoInstruction inst) { + if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITSystemRegistersOff) + {Default(inst); return;} // turn off from debugger INSTRUCTION_START; mfspr(inst); } diff --git a/Source/Core/DebuggerWX/Src/CodeWindow.cpp b/Source/Core/DebuggerWX/Src/CodeWindow.cpp index 22fab634d9..71604ddc63 100644 --- a/Source/Core/DebuggerWX/Src/CodeWindow.cpp +++ b/Source/Core/DebuggerWX/Src/CodeWindow.cpp @@ -53,7 +53,7 @@ #include "PowerPC/SignatureDB.h" #include "PowerPC/PPCTables.h" #include "PowerPC/Jit64/Jit.h" -#include "PowerPC/Jit64/JitCache.h" +#include "PowerPC/Jit64/JitCache.h" // for ClearCache() #include "Plugins/Plugin_DSP.h" // new stuff, to let us open the DLLDebugger #include "Plugins/Plugin_Video.h" // new stuff, to let us open the DLLDebugger @@ -88,7 +88,13 @@ BEGIN_EVENT_TABLE(CCodeWindow, wxFrame) EVT_MENU(IDM_SOUNDWINDOW, CCodeWindow::OnToggleSoundWindow) EVT_MENU(IDM_VIDEOWINDOW, CCodeWindow::OnToggleVideoWindow) - EVT_MENU(IDM_INTERPRETER, CCodeWindow::OnInterpreter) + EVT_MENU(IDM_INTERPRETER, CCodeWindow::OnInterpreter) // CPU Mode + EVT_MENU(IDM_JITOFF, CCodeWindow::OnJITOff) + EVT_MENU(IDM_JITLSOFF, CCodeWindow::OnJITLSOff) + EVT_MENU(IDM_JITFPOFF, CCodeWindow::OnJITFPOff) + EVT_MENU(IDM_JITIOFF, CCodeWindow::OnJITIOff) + EVT_MENU(IDM_JITPOFF, CCodeWindow::OnJITPOff) + EVT_MENU(IDM_JITSROFF, CCodeWindow::OnJITSROff) EVT_MENU(IDM_CLEARSYMBOLS, CCodeWindow::OnSymbolsMenu) EVT_MENU(IDM_LOADMAPFILE, CCodeWindow::OnSymbolsMenu) @@ -299,7 +305,7 @@ void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStart // possible todo: add some kind of if here to? can it fail? CPluginManager::GetInstance().OpenDebug( GetHandle(), - SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin.c_str() + _LocalCoreStartupParameter.m_strVideoPlugin.c_str() ); } // don't have any else, just ignore it } @@ -313,11 +319,30 @@ void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParam // --------------- wxMenuBar* pMenuBar = new wxMenuBar(wxMB_DOCKABLE); - { + { wxMenu* pCoreMenu = new wxMenu; + wxMenuItem* interpreter = pCoreMenu->Append(IDM_INTERPRETER, _T("&Interpreter"), wxEmptyString, wxITEM_CHECK); interpreter->Check(!_LocalCoreStartupParameter.bUseJIT); + jitoff = pCoreMenu->Append(IDM_JITOFF, _T("&JIT off"), wxEmptyString, wxITEM_CHECK); + jitoff->Check(_LocalCoreStartupParameter.bJITOff); + + jitlsoff = pCoreMenu->Append(IDM_JITLSOFF, _T("&JIT LoadStore off"), wxEmptyString, wxITEM_CHECK); + jitlsoff->Check(_LocalCoreStartupParameter.bJITLoadStoreOff); + + jitfpoff = pCoreMenu->Append(IDM_JITFPOFF, _T("&JIT FloatingPoint off"), wxEmptyString, wxITEM_CHECK); + jitfpoff->Check(_LocalCoreStartupParameter.bJITFloatingPointOff); + + jitioff = pCoreMenu->Append(IDM_JITIOFF, _T("&JIT Integer off"), wxEmptyString, wxITEM_CHECK); + jitioff->Check(_LocalCoreStartupParameter.bJITIntegerOff); + + jitpoff = pCoreMenu->Append(IDM_JITPOFF, _T("&JIT Paired off"), wxEmptyString, wxITEM_CHECK); + jitpoff->Check(_LocalCoreStartupParameter.bJITPairedOff); + + jitsroff = pCoreMenu->Append(IDM_JITSROFF, _T("&JIT SystemRegisters off"), wxEmptyString, wxITEM_CHECK); + jitsroff->Check(_LocalCoreStartupParameter.bJITSystemRegistersOff); + // wxMenuItem* dualcore = pDebugMenu->Append(IDM_DUALCORE, _T("&DualCore"), wxEmptyString, wxITEM_CHECK); // dualcore->Check(_LocalCoreStartupParameter.bUseDualCore); @@ -401,6 +426,10 @@ bool CCodeWindow::UseDualCore() return(GetMenuBar()->IsChecked(IDM_DUALCORE)); } + +// ======================================================================================= +// CPU Mode +// -------------- void CCodeWindow::OnInterpreter(wxCommandEvent& event) { if (Core::GetState() != Core::CORE_RUN) { @@ -410,6 +439,41 @@ void CCodeWindow::OnInterpreter(wxCommandEvent& event) wxMessageBox(_T("Please pause the emulator before changing mode.")); } } +void CCodeWindow::DoJITOff(wxCommandEvent& event, wxMenuItem* a, bool& b) +{ + if (Core::GetState() == Core::CORE_UNINITIALIZED) + { + // we disallow changing the status here because it will be reset to the defult when BootCore() + // creates the SCoreStartupParameter as a game is loaded + a->Check(!a->IsChecked()); + wxMessageBox(_T("Please start a game before changing mode.")); + } else { + if (Core::GetState() != Core::CORE_RUN) + { + b = !b; + Jit64::ClearCache(); + } else { + //event.Skip(); // this doesn't work + a->Check(!a->IsChecked()); + wxMessageBox(_T("Please pause the emulator before changing mode.")); + } + } +} + +void CCodeWindow::OnJITOff(wxCommandEvent& event) {DoJITOff(event, jitoff, + Core::g_CoreStartupParameter.bJITOff);} +void CCodeWindow::OnJITLSOff(wxCommandEvent& event) {DoJITOff(event, jitlsoff, + Core::g_CoreStartupParameter.bJITLoadStoreOff);} +void CCodeWindow::OnJITFPOff(wxCommandEvent& event) {DoJITOff(event, jitfpoff, + Core::g_CoreStartupParameter.bJITFloatingPointOff);} +void CCodeWindow::OnJITIOff(wxCommandEvent& event) {DoJITOff(event, jitioff, + Core::g_CoreStartupParameter.bJITIntegerOff);} +void CCodeWindow::OnJITPOff(wxCommandEvent& event) {DoJITOff(event, jitpoff, + Core::g_CoreStartupParameter.bJITPairedOff);} +void CCodeWindow::OnJITSROff(wxCommandEvent& event) {DoJITOff(event, jitsroff, + Core::g_CoreStartupParameter.bJITSystemRegistersOff);} +// ============== + void CCodeWindow::OnJitMenu(wxCommandEvent& event) { diff --git a/Source/Core/DebuggerWX/Src/CodeWindow.h b/Source/Core/DebuggerWX/Src/CodeWindow.h index 0877999a62..6fbd57b742 100644 --- a/Source/Core/DebuggerWX/Src/CodeWindow.h +++ b/Source/Core/DebuggerWX/Src/CodeWindow.h @@ -79,6 +79,12 @@ class CCodeWindow IDM_CALLSLIST, IDM_SYMBOLLIST, IDM_INTERPRETER, + IDM_JITOFF, // jit + IDM_JITLSOFF, + IDM_JITIOFF, + IDM_JITFPOFF, + IDM_JITPOFF, + IDM_JITSROFF, IDM_DUALCORE, IDM_LOGWINDOW, IDM_REGISTERWINDOW, @@ -120,6 +126,13 @@ class CCodeWindow CMemoryWindow* m_MemoryWindow; CJitWindow* m_JitWindow; + wxMenuItem* jitoff; + wxMenuItem* jitlsoff; + wxMenuItem* jitfpoff; + wxMenuItem* jitioff; + wxMenuItem* jitpoff; + wxMenuItem* jitsroff; + CCodeView* codeview; wxListBox* callstack; wxListBox* symbols; @@ -155,8 +168,15 @@ class CCodeWindow void OnSymbolsMenu(wxCommandEvent& event); void OnJitMenu(wxCommandEvent& event); void OnProfilerMenu(wxCommandEvent& event); - void OnInterpreter(wxCommandEvent& event); + void OnInterpreter(wxCommandEvent& event); // cpu mode menu + void OnJITOff(wxCommandEvent& event); + void OnJITLSOff(wxCommandEvent& event); + void OnJITFPOff(wxCommandEvent& event); + void OnJITIOff(wxCommandEvent& event); + void OnJITPOff(wxCommandEvent& event); + void OnJITSROff(wxCommandEvent& event); + void DoJITOff(wxCommandEvent& event, wxMenuItem* a, bool& b); void CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter);