From 919182eda262a9c827dcb99fab4827116999353c Mon Sep 17 00:00:00 2001 From: "Admiral H. Curtiss" Date: Thu, 16 Mar 2023 22:43:27 +0100 Subject: [PATCH] Interpreter: Pass Interpreter to CPU instruction functions. --- .../CachedInterpreter/CachedInterpreter.cpp | 12 + .../Core/PowerPC/Interpreter/Interpreter.cpp | 8 +- .../Core/PowerPC/Interpreter/Interpreter.h | 464 +++++++++--------- .../Interpreter/Interpreter_Branch.cpp | 14 +- .../Interpreter/Interpreter_FloatingPoint.cpp | 56 +-- .../Interpreter/Interpreter_Integer.cpp | 106 ++-- .../Interpreter/Interpreter_LoadStore.cpp | 144 +++--- .../Interpreter_LoadStorePaired.cpp | 16 +- .../Interpreter/Interpreter_Paired.cpp | 58 +-- .../Interpreter_SystemRegisters.cpp | 58 +-- .../Interpreter/Interpreter_Tables.cpp | 24 +- Source/Core/Core/PowerPC/Jit64/Jit.cpp | 2 +- Source/Core/Core/PowerPC/JitArm64/Jit.cpp | 3 +- 13 files changed, 489 insertions(+), 476 deletions(-) diff --git a/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.cpp b/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.cpp index d85f8ece18..7b89fbf5a6 100644 --- a/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.cpp +++ b/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.cpp @@ -19,6 +19,7 @@ struct CachedInterpreter::Instruction { using CommonCallback = void (*)(UGeckoInstruction); using ConditionalCallback = bool (*)(u32); + using InterpreterCallback = void (*)(Interpreter&, UGeckoInstruction); Instruction() {} Instruction(const CommonCallback c, UGeckoInstruction i) @@ -31,17 +32,24 @@ struct CachedInterpreter::Instruction { } + Instruction(const InterpreterCallback c, UGeckoInstruction i) + : interpreter_callback(c), data(i.hex), type(Type::Interpreter) + { + } + enum class Type { Abort, Common, Conditional, + Interpreter, }; union { const CommonCallback common_callback = nullptr; const ConditionalCallback conditional_callback; + const InterpreterCallback interpreter_callback; }; u32 data = 0; @@ -100,6 +108,10 @@ void CachedInterpreter::ExecuteOneBlock() return; break; + case Instruction::Type::Interpreter: + code->interpreter_callback(*Interpreter::getInstance(), UGeckoInstruction(code->data)); + break; + default: ERROR_LOG_FMT(POWERPC, "Unknown CachedInterpreter Instruction: {}", static_cast(code->type)); diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter.cpp index 319f29c186..977c6cefad 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter.cpp @@ -110,7 +110,7 @@ static void Trace(const UGeckoInstruction& inst) bool Interpreter::HandleFunctionHooking(u32 address) { return HLE::ReplaceFunctionIfPossible(address, [](u32 hook_index, HLE::HookType type) { - HLEFunction(hook_index); + HLEFunction(*Interpreter::getInstance(), hook_index); return type != HLE::HookType::Start; }); } @@ -156,7 +156,7 @@ int Interpreter::SingleStepInner() } else if (PowerPC::ppcState.msr.FP) { - RunInterpreterOp(m_prev_inst); + RunInterpreterOp(*Interpreter::getInstance(), m_prev_inst); if ((PowerPC::ppcState.Exceptions & EXCEPTION_DSI) != 0) { CheckExceptions(); @@ -172,7 +172,7 @@ int Interpreter::SingleStepInner() } else { - RunInterpreterOp(m_prev_inst); + RunInterpreterOp(*Interpreter::getInstance(), m_prev_inst); if ((PowerPC::ppcState.Exceptions & EXCEPTION_DSI) != 0) { CheckExceptions(); @@ -313,7 +313,7 @@ void Interpreter::Run() } } -void Interpreter::unknown_instruction(UGeckoInstruction inst) +void Interpreter::unknown_instruction(Interpreter& interpreter, UGeckoInstruction inst) { ASSERT(Core::IsCPUThread()); auto& system = Core::System::GetInstance(); diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter.h b/Source/Core/Core/PowerPC/Interpreter/Interpreter.h index 0dd01fa3c7..ae2e87bff4 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter.h +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter.h @@ -21,259 +21,259 @@ public: void ClearCache() override; const char* GetName() const override; - static void unknown_instruction(UGeckoInstruction inst); + static void unknown_instruction(Interpreter& interpreter, UGeckoInstruction inst); // Branch Instructions - static void bx(UGeckoInstruction inst); - static void bcx(UGeckoInstruction inst); - static void bcctrx(UGeckoInstruction inst); - static void bclrx(UGeckoInstruction inst); - static void HLEFunction(UGeckoInstruction inst); + static void bx(Interpreter& interpreter, UGeckoInstruction inst); + static void bcx(Interpreter& interpreter, UGeckoInstruction inst); + static void bcctrx(Interpreter& interpreter, UGeckoInstruction inst); + static void bclrx(Interpreter& interpreter, UGeckoInstruction inst); + static void HLEFunction(Interpreter& interpreter, UGeckoInstruction inst); // Syscall Instruction - static void sc(UGeckoInstruction inst); + static void sc(Interpreter& interpreter, UGeckoInstruction inst); // Floating Point Instructions - static void faddsx(UGeckoInstruction inst); - static void fdivsx(UGeckoInstruction inst); - static void fmaddsx(UGeckoInstruction inst); - static void fmsubsx(UGeckoInstruction inst); - static void fmulsx(UGeckoInstruction inst); - static void fnmaddsx(UGeckoInstruction inst); - static void fnmsubsx(UGeckoInstruction inst); - static void fresx(UGeckoInstruction inst); - static void fsubsx(UGeckoInstruction inst); - static void fabsx(UGeckoInstruction inst); - static void fcmpo(UGeckoInstruction inst); - static void fcmpu(UGeckoInstruction inst); - static void fctiwx(UGeckoInstruction inst); - static void fctiwzx(UGeckoInstruction inst); - static void fmrx(UGeckoInstruction inst); - static void fnabsx(UGeckoInstruction inst); - static void fnegx(UGeckoInstruction inst); - static void frspx(UGeckoInstruction inst); - static void faddx(UGeckoInstruction inst); - static void fdivx(UGeckoInstruction inst); - static void fmaddx(UGeckoInstruction inst); - static void fmsubx(UGeckoInstruction inst); - static void fmulx(UGeckoInstruction inst); - static void fnmaddx(UGeckoInstruction inst); - static void fnmsubx(UGeckoInstruction inst); - static void frsqrtex(UGeckoInstruction inst); - static void fselx(UGeckoInstruction inst); - static void fsubx(UGeckoInstruction inst); + static void faddsx(Interpreter& interpreter, UGeckoInstruction inst); + static void fdivsx(Interpreter& interpreter, UGeckoInstruction inst); + static void fmaddsx(Interpreter& interpreter, UGeckoInstruction inst); + static void fmsubsx(Interpreter& interpreter, UGeckoInstruction inst); + static void fmulsx(Interpreter& interpreter, UGeckoInstruction inst); + static void fnmaddsx(Interpreter& interpreter, UGeckoInstruction inst); + static void fnmsubsx(Interpreter& interpreter, UGeckoInstruction inst); + static void fresx(Interpreter& interpreter, UGeckoInstruction inst); + static void fsubsx(Interpreter& interpreter, UGeckoInstruction inst); + static void fabsx(Interpreter& interpreter, UGeckoInstruction inst); + static void fcmpo(Interpreter& interpreter, UGeckoInstruction inst); + static void fcmpu(Interpreter& interpreter, UGeckoInstruction inst); + static void fctiwx(Interpreter& interpreter, UGeckoInstruction inst); + static void fctiwzx(Interpreter& interpreter, UGeckoInstruction inst); + static void fmrx(Interpreter& interpreter, UGeckoInstruction inst); + static void fnabsx(Interpreter& interpreter, UGeckoInstruction inst); + static void fnegx(Interpreter& interpreter, UGeckoInstruction inst); + static void frspx(Interpreter& interpreter, UGeckoInstruction inst); + static void faddx(Interpreter& interpreter, UGeckoInstruction inst); + static void fdivx(Interpreter& interpreter, UGeckoInstruction inst); + static void fmaddx(Interpreter& interpreter, UGeckoInstruction inst); + static void fmsubx(Interpreter& interpreter, UGeckoInstruction inst); + static void fmulx(Interpreter& interpreter, UGeckoInstruction inst); + static void fnmaddx(Interpreter& interpreter, UGeckoInstruction inst); + static void fnmsubx(Interpreter& interpreter, UGeckoInstruction inst); + static void frsqrtex(Interpreter& interpreter, UGeckoInstruction inst); + static void fselx(Interpreter& interpreter, UGeckoInstruction inst); + static void fsubx(Interpreter& interpreter, UGeckoInstruction inst); // Integer Instructions - static void addi(UGeckoInstruction inst); - static void addic(UGeckoInstruction inst); - static void addic_rc(UGeckoInstruction inst); - static void addis(UGeckoInstruction inst); - static void andi_rc(UGeckoInstruction inst); - static void andis_rc(UGeckoInstruction inst); - static void cmpi(UGeckoInstruction inst); - static void cmpli(UGeckoInstruction inst); - static void mulli(UGeckoInstruction inst); - static void ori(UGeckoInstruction inst); - static void oris(UGeckoInstruction inst); - static void subfic(UGeckoInstruction inst); - static void twi(UGeckoInstruction inst); - static void xori(UGeckoInstruction inst); - static void xoris(UGeckoInstruction inst); - static void rlwimix(UGeckoInstruction inst); - static void rlwinmx(UGeckoInstruction inst); - static void rlwnmx(UGeckoInstruction inst); - static void andx(UGeckoInstruction inst); - static void andcx(UGeckoInstruction inst); - static void cmp(UGeckoInstruction inst); - static void cmpl(UGeckoInstruction inst); - static void cntlzwx(UGeckoInstruction inst); - static void eqvx(UGeckoInstruction inst); - static void extsbx(UGeckoInstruction inst); - static void extshx(UGeckoInstruction inst); - static void nandx(UGeckoInstruction inst); - static void norx(UGeckoInstruction inst); - static void orx(UGeckoInstruction inst); - static void orcx(UGeckoInstruction inst); - static void slwx(UGeckoInstruction inst); - static void srawx(UGeckoInstruction inst); - static void srawix(UGeckoInstruction inst); - static void srwx(UGeckoInstruction inst); - static void tw(UGeckoInstruction inst); - static void xorx(UGeckoInstruction inst); - static void addx(UGeckoInstruction inst); - static void addcx(UGeckoInstruction inst); - static void addex(UGeckoInstruction inst); - static void addmex(UGeckoInstruction inst); - static void addzex(UGeckoInstruction inst); - static void divwx(UGeckoInstruction inst); - static void divwux(UGeckoInstruction inst); - static void mulhwx(UGeckoInstruction inst); - static void mulhwux(UGeckoInstruction inst); - static void mullwx(UGeckoInstruction inst); - static void negx(UGeckoInstruction inst); - static void subfx(UGeckoInstruction inst); - static void subfcx(UGeckoInstruction inst); - static void subfex(UGeckoInstruction inst); - static void subfmex(UGeckoInstruction inst); - static void subfzex(UGeckoInstruction inst); + static void addi(Interpreter& interpreter, UGeckoInstruction inst); + static void addic(Interpreter& interpreter, UGeckoInstruction inst); + static void addic_rc(Interpreter& interpreter, UGeckoInstruction inst); + static void addis(Interpreter& interpreter, UGeckoInstruction inst); + static void andi_rc(Interpreter& interpreter, UGeckoInstruction inst); + static void andis_rc(Interpreter& interpreter, UGeckoInstruction inst); + static void cmpi(Interpreter& interpreter, UGeckoInstruction inst); + static void cmpli(Interpreter& interpreter, UGeckoInstruction inst); + static void mulli(Interpreter& interpreter, UGeckoInstruction inst); + static void ori(Interpreter& interpreter, UGeckoInstruction inst); + static void oris(Interpreter& interpreter, UGeckoInstruction inst); + static void subfic(Interpreter& interpreter, UGeckoInstruction inst); + static void twi(Interpreter& interpreter, UGeckoInstruction inst); + static void xori(Interpreter& interpreter, UGeckoInstruction inst); + static void xoris(Interpreter& interpreter, UGeckoInstruction inst); + static void rlwimix(Interpreter& interpreter, UGeckoInstruction inst); + static void rlwinmx(Interpreter& interpreter, UGeckoInstruction inst); + static void rlwnmx(Interpreter& interpreter, UGeckoInstruction inst); + static void andx(Interpreter& interpreter, UGeckoInstruction inst); + static void andcx(Interpreter& interpreter, UGeckoInstruction inst); + static void cmp(Interpreter& interpreter, UGeckoInstruction inst); + static void cmpl(Interpreter& interpreter, UGeckoInstruction inst); + static void cntlzwx(Interpreter& interpreter, UGeckoInstruction inst); + static void eqvx(Interpreter& interpreter, UGeckoInstruction inst); + static void extsbx(Interpreter& interpreter, UGeckoInstruction inst); + static void extshx(Interpreter& interpreter, UGeckoInstruction inst); + static void nandx(Interpreter& interpreter, UGeckoInstruction inst); + static void norx(Interpreter& interpreter, UGeckoInstruction inst); + static void orx(Interpreter& interpreter, UGeckoInstruction inst); + static void orcx(Interpreter& interpreter, UGeckoInstruction inst); + static void slwx(Interpreter& interpreter, UGeckoInstruction inst); + static void srawx(Interpreter& interpreter, UGeckoInstruction inst); + static void srawix(Interpreter& interpreter, UGeckoInstruction inst); + static void srwx(Interpreter& interpreter, UGeckoInstruction inst); + static void tw(Interpreter& interpreter, UGeckoInstruction inst); + static void xorx(Interpreter& interpreter, UGeckoInstruction inst); + static void addx(Interpreter& interpreter, UGeckoInstruction inst); + static void addcx(Interpreter& interpreter, UGeckoInstruction inst); + static void addex(Interpreter& interpreter, UGeckoInstruction inst); + static void addmex(Interpreter& interpreter, UGeckoInstruction inst); + static void addzex(Interpreter& interpreter, UGeckoInstruction inst); + static void divwx(Interpreter& interpreter, UGeckoInstruction inst); + static void divwux(Interpreter& interpreter, UGeckoInstruction inst); + static void mulhwx(Interpreter& interpreter, UGeckoInstruction inst); + static void mulhwux(Interpreter& interpreter, UGeckoInstruction inst); + static void mullwx(Interpreter& interpreter, UGeckoInstruction inst); + static void negx(Interpreter& interpreter, UGeckoInstruction inst); + static void subfx(Interpreter& interpreter, UGeckoInstruction inst); + static void subfcx(Interpreter& interpreter, UGeckoInstruction inst); + static void subfex(Interpreter& interpreter, UGeckoInstruction inst); + static void subfmex(Interpreter& interpreter, UGeckoInstruction inst); + static void subfzex(Interpreter& interpreter, UGeckoInstruction inst); // Load/Store Instructions - static void lbz(UGeckoInstruction inst); - static void lbzu(UGeckoInstruction inst); - static void lfd(UGeckoInstruction inst); - static void lfdu(UGeckoInstruction inst); - static void lfs(UGeckoInstruction inst); - static void lfsu(UGeckoInstruction inst); - static void lha(UGeckoInstruction inst); - static void lhau(UGeckoInstruction inst); - static void lhz(UGeckoInstruction inst); - static void lhzu(UGeckoInstruction inst); - static void lmw(UGeckoInstruction inst); - static void lwz(UGeckoInstruction inst); - static void lwzu(UGeckoInstruction inst); - static void stb(UGeckoInstruction inst); - static void stbu(UGeckoInstruction inst); - static void stfd(UGeckoInstruction inst); - static void stfdu(UGeckoInstruction inst); - static void stfs(UGeckoInstruction inst); - static void stfsu(UGeckoInstruction inst); - static void sth(UGeckoInstruction inst); - static void sthu(UGeckoInstruction inst); - static void stmw(UGeckoInstruction inst); - static void stw(UGeckoInstruction inst); - static void stwu(UGeckoInstruction inst); - static void dcba(UGeckoInstruction inst); - static void dcbf(UGeckoInstruction inst); - static void dcbi(UGeckoInstruction inst); - static void dcbst(UGeckoInstruction inst); - static void dcbt(UGeckoInstruction inst); - static void dcbtst(UGeckoInstruction inst); - static void dcbz(UGeckoInstruction inst); - static void eciwx(UGeckoInstruction inst); - static void ecowx(UGeckoInstruction inst); - static void eieio(UGeckoInstruction inst); - static void icbi(UGeckoInstruction inst); - static void lbzux(UGeckoInstruction inst); - static void lbzx(UGeckoInstruction inst); - static void lfdux(UGeckoInstruction inst); - static void lfdx(UGeckoInstruction inst); - static void lfsux(UGeckoInstruction inst); - static void lfsx(UGeckoInstruction inst); - static void lhaux(UGeckoInstruction inst); - static void lhax(UGeckoInstruction inst); - static void lhbrx(UGeckoInstruction inst); - static void lhzux(UGeckoInstruction inst); - static void lhzx(UGeckoInstruction inst); - static void lswi(UGeckoInstruction inst); - static void lswx(UGeckoInstruction inst); - static void lwarx(UGeckoInstruction inst); - static void lwbrx(UGeckoInstruction inst); - static void lwzux(UGeckoInstruction inst); - static void lwzx(UGeckoInstruction inst); - static void stbux(UGeckoInstruction inst); - static void stbx(UGeckoInstruction inst); - static void stfdux(UGeckoInstruction inst); - static void stfdx(UGeckoInstruction inst); - static void stfiwx(UGeckoInstruction inst); - static void stfsux(UGeckoInstruction inst); - static void stfsx(UGeckoInstruction inst); - static void sthbrx(UGeckoInstruction inst); - static void sthux(UGeckoInstruction inst); - static void sthx(UGeckoInstruction inst); - static void stswi(UGeckoInstruction inst); - static void stswx(UGeckoInstruction inst); - static void stwbrx(UGeckoInstruction inst); - static void stwcxd(UGeckoInstruction inst); - static void stwux(UGeckoInstruction inst); - static void stwx(UGeckoInstruction inst); - static void tlbie(UGeckoInstruction inst); - static void tlbsync(UGeckoInstruction inst); + static void lbz(Interpreter& interpreter, UGeckoInstruction inst); + static void lbzu(Interpreter& interpreter, UGeckoInstruction inst); + static void lfd(Interpreter& interpreter, UGeckoInstruction inst); + static void lfdu(Interpreter& interpreter, UGeckoInstruction inst); + static void lfs(Interpreter& interpreter, UGeckoInstruction inst); + static void lfsu(Interpreter& interpreter, UGeckoInstruction inst); + static void lha(Interpreter& interpreter, UGeckoInstruction inst); + static void lhau(Interpreter& interpreter, UGeckoInstruction inst); + static void lhz(Interpreter& interpreter, UGeckoInstruction inst); + static void lhzu(Interpreter& interpreter, UGeckoInstruction inst); + static void lmw(Interpreter& interpreter, UGeckoInstruction inst); + static void lwz(Interpreter& interpreter, UGeckoInstruction inst); + static void lwzu(Interpreter& interpreter, UGeckoInstruction inst); + static void stb(Interpreter& interpreter, UGeckoInstruction inst); + static void stbu(Interpreter& interpreter, UGeckoInstruction inst); + static void stfd(Interpreter& interpreter, UGeckoInstruction inst); + static void stfdu(Interpreter& interpreter, UGeckoInstruction inst); + static void stfs(Interpreter& interpreter, UGeckoInstruction inst); + static void stfsu(Interpreter& interpreter, UGeckoInstruction inst); + static void sth(Interpreter& interpreter, UGeckoInstruction inst); + static void sthu(Interpreter& interpreter, UGeckoInstruction inst); + static void stmw(Interpreter& interpreter, UGeckoInstruction inst); + static void stw(Interpreter& interpreter, UGeckoInstruction inst); + static void stwu(Interpreter& interpreter, UGeckoInstruction inst); + static void dcba(Interpreter& interpreter, UGeckoInstruction inst); + static void dcbf(Interpreter& interpreter, UGeckoInstruction inst); + static void dcbi(Interpreter& interpreter, UGeckoInstruction inst); + static void dcbst(Interpreter& interpreter, UGeckoInstruction inst); + static void dcbt(Interpreter& interpreter, UGeckoInstruction inst); + static void dcbtst(Interpreter& interpreter, UGeckoInstruction inst); + static void dcbz(Interpreter& interpreter, UGeckoInstruction inst); + static void eciwx(Interpreter& interpreter, UGeckoInstruction inst); + static void ecowx(Interpreter& interpreter, UGeckoInstruction inst); + static void eieio(Interpreter& interpreter, UGeckoInstruction inst); + static void icbi(Interpreter& interpreter, UGeckoInstruction inst); + static void lbzux(Interpreter& interpreter, UGeckoInstruction inst); + static void lbzx(Interpreter& interpreter, UGeckoInstruction inst); + static void lfdux(Interpreter& interpreter, UGeckoInstruction inst); + static void lfdx(Interpreter& interpreter, UGeckoInstruction inst); + static void lfsux(Interpreter& interpreter, UGeckoInstruction inst); + static void lfsx(Interpreter& interpreter, UGeckoInstruction inst); + static void lhaux(Interpreter& interpreter, UGeckoInstruction inst); + static void lhax(Interpreter& interpreter, UGeckoInstruction inst); + static void lhbrx(Interpreter& interpreter, UGeckoInstruction inst); + static void lhzux(Interpreter& interpreter, UGeckoInstruction inst); + static void lhzx(Interpreter& interpreter, UGeckoInstruction inst); + static void lswi(Interpreter& interpreter, UGeckoInstruction inst); + static void lswx(Interpreter& interpreter, UGeckoInstruction inst); + static void lwarx(Interpreter& interpreter, UGeckoInstruction inst); + static void lwbrx(Interpreter& interpreter, UGeckoInstruction inst); + static void lwzux(Interpreter& interpreter, UGeckoInstruction inst); + static void lwzx(Interpreter& interpreter, UGeckoInstruction inst); + static void stbux(Interpreter& interpreter, UGeckoInstruction inst); + static void stbx(Interpreter& interpreter, UGeckoInstruction inst); + static void stfdux(Interpreter& interpreter, UGeckoInstruction inst); + static void stfdx(Interpreter& interpreter, UGeckoInstruction inst); + static void stfiwx(Interpreter& interpreter, UGeckoInstruction inst); + static void stfsux(Interpreter& interpreter, UGeckoInstruction inst); + static void stfsx(Interpreter& interpreter, UGeckoInstruction inst); + static void sthbrx(Interpreter& interpreter, UGeckoInstruction inst); + static void sthux(Interpreter& interpreter, UGeckoInstruction inst); + static void sthx(Interpreter& interpreter, UGeckoInstruction inst); + static void stswi(Interpreter& interpreter, UGeckoInstruction inst); + static void stswx(Interpreter& interpreter, UGeckoInstruction inst); + static void stwbrx(Interpreter& interpreter, UGeckoInstruction inst); + static void stwcxd(Interpreter& interpreter, UGeckoInstruction inst); + static void stwux(Interpreter& interpreter, UGeckoInstruction inst); + static void stwx(Interpreter& interpreter, UGeckoInstruction inst); + static void tlbie(Interpreter& interpreter, UGeckoInstruction inst); + static void tlbsync(Interpreter& interpreter, UGeckoInstruction inst); // Paired Instructions - static void psq_l(UGeckoInstruction inst); - static void psq_lu(UGeckoInstruction inst); - static void psq_st(UGeckoInstruction inst); - static void psq_stu(UGeckoInstruction inst); - static void psq_lx(UGeckoInstruction inst); - static void psq_stx(UGeckoInstruction inst); - static void psq_lux(UGeckoInstruction inst); - static void psq_stux(UGeckoInstruction inst); - static void ps_div(UGeckoInstruction inst); - static void ps_sub(UGeckoInstruction inst); - static void ps_add(UGeckoInstruction inst); - static void ps_sel(UGeckoInstruction inst); - static void ps_res(UGeckoInstruction inst); - static void ps_mul(UGeckoInstruction inst); - static void ps_rsqrte(UGeckoInstruction inst); - static void ps_msub(UGeckoInstruction inst); - static void ps_madd(UGeckoInstruction inst); - static void ps_nmsub(UGeckoInstruction inst); - static void ps_nmadd(UGeckoInstruction inst); - static void ps_neg(UGeckoInstruction inst); - static void ps_mr(UGeckoInstruction inst); - static void ps_nabs(UGeckoInstruction inst); - static void ps_abs(UGeckoInstruction inst); - static void ps_sum0(UGeckoInstruction inst); - static void ps_sum1(UGeckoInstruction inst); - static void ps_muls0(UGeckoInstruction inst); - static void ps_muls1(UGeckoInstruction inst); - static void ps_madds0(UGeckoInstruction inst); - static void ps_madds1(UGeckoInstruction inst); - static void ps_cmpu0(UGeckoInstruction inst); - static void ps_cmpo0(UGeckoInstruction inst); - static void ps_cmpu1(UGeckoInstruction inst); - static void ps_cmpo1(UGeckoInstruction inst); - static void ps_merge00(UGeckoInstruction inst); - static void ps_merge01(UGeckoInstruction inst); - static void ps_merge10(UGeckoInstruction inst); - static void ps_merge11(UGeckoInstruction inst); - static void dcbz_l(UGeckoInstruction inst); + static void psq_l(Interpreter& interpreter, UGeckoInstruction inst); + static void psq_lu(Interpreter& interpreter, UGeckoInstruction inst); + static void psq_st(Interpreter& interpreter, UGeckoInstruction inst); + static void psq_stu(Interpreter& interpreter, UGeckoInstruction inst); + static void psq_lx(Interpreter& interpreter, UGeckoInstruction inst); + static void psq_stx(Interpreter& interpreter, UGeckoInstruction inst); + static void psq_lux(Interpreter& interpreter, UGeckoInstruction inst); + static void psq_stux(Interpreter& interpreter, UGeckoInstruction inst); + static void ps_div(Interpreter& interpreter, UGeckoInstruction inst); + static void ps_sub(Interpreter& interpreter, UGeckoInstruction inst); + static void ps_add(Interpreter& interpreter, UGeckoInstruction inst); + static void ps_sel(Interpreter& interpreter, UGeckoInstruction inst); + static void ps_res(Interpreter& interpreter, UGeckoInstruction inst); + static void ps_mul(Interpreter& interpreter, UGeckoInstruction inst); + static void ps_rsqrte(Interpreter& interpreter, UGeckoInstruction inst); + static void ps_msub(Interpreter& interpreter, UGeckoInstruction inst); + static void ps_madd(Interpreter& interpreter, UGeckoInstruction inst); + static void ps_nmsub(Interpreter& interpreter, UGeckoInstruction inst); + static void ps_nmadd(Interpreter& interpreter, UGeckoInstruction inst); + static void ps_neg(Interpreter& interpreter, UGeckoInstruction inst); + static void ps_mr(Interpreter& interpreter, UGeckoInstruction inst); + static void ps_nabs(Interpreter& interpreter, UGeckoInstruction inst); + static void ps_abs(Interpreter& interpreter, UGeckoInstruction inst); + static void ps_sum0(Interpreter& interpreter, UGeckoInstruction inst); + static void ps_sum1(Interpreter& interpreter, UGeckoInstruction inst); + static void ps_muls0(Interpreter& interpreter, UGeckoInstruction inst); + static void ps_muls1(Interpreter& interpreter, UGeckoInstruction inst); + static void ps_madds0(Interpreter& interpreter, UGeckoInstruction inst); + static void ps_madds1(Interpreter& interpreter, UGeckoInstruction inst); + static void ps_cmpu0(Interpreter& interpreter, UGeckoInstruction inst); + static void ps_cmpo0(Interpreter& interpreter, UGeckoInstruction inst); + static void ps_cmpu1(Interpreter& interpreter, UGeckoInstruction inst); + static void ps_cmpo1(Interpreter& interpreter, UGeckoInstruction inst); + static void ps_merge00(Interpreter& interpreter, UGeckoInstruction inst); + static void ps_merge01(Interpreter& interpreter, UGeckoInstruction inst); + static void ps_merge10(Interpreter& interpreter, UGeckoInstruction inst); + static void ps_merge11(Interpreter& interpreter, UGeckoInstruction inst); + static void dcbz_l(Interpreter& interpreter, UGeckoInstruction inst); // System Registers Instructions - static void mcrfs(UGeckoInstruction inst); - static void mffsx(UGeckoInstruction inst); - static void mtfsb0x(UGeckoInstruction inst); - static void mtfsb1x(UGeckoInstruction inst); - static void mtfsfix(UGeckoInstruction inst); - static void mtfsfx(UGeckoInstruction inst); - static void mcrxr(UGeckoInstruction inst); - static void mfcr(UGeckoInstruction inst); - static void mfmsr(UGeckoInstruction inst); - static void mfsr(UGeckoInstruction inst); - static void mfsrin(UGeckoInstruction inst); - static void mtmsr(UGeckoInstruction inst); - static void mtsr(UGeckoInstruction inst); - static void mtsrin(UGeckoInstruction inst); - static void mfspr(UGeckoInstruction inst); - static void mftb(UGeckoInstruction inst); - static void mtcrf(UGeckoInstruction inst); - static void mtspr(UGeckoInstruction inst); - static void crand(UGeckoInstruction inst); - static void crandc(UGeckoInstruction inst); - static void creqv(UGeckoInstruction inst); - static void crnand(UGeckoInstruction inst); - static void crnor(UGeckoInstruction inst); - static void cror(UGeckoInstruction inst); - static void crorc(UGeckoInstruction inst); - static void crxor(UGeckoInstruction inst); - static void mcrf(UGeckoInstruction inst); - static void rfi(UGeckoInstruction inst); - static void sync(UGeckoInstruction inst); - static void isync(UGeckoInstruction inst); + static void mcrfs(Interpreter& interpreter, UGeckoInstruction inst); + static void mffsx(Interpreter& interpreter, UGeckoInstruction inst); + static void mtfsb0x(Interpreter& interpreter, UGeckoInstruction inst); + static void mtfsb1x(Interpreter& interpreter, UGeckoInstruction inst); + static void mtfsfix(Interpreter& interpreter, UGeckoInstruction inst); + static void mtfsfx(Interpreter& interpreter, UGeckoInstruction inst); + static void mcrxr(Interpreter& interpreter, UGeckoInstruction inst); + static void mfcr(Interpreter& interpreter, UGeckoInstruction inst); + static void mfmsr(Interpreter& interpreter, UGeckoInstruction inst); + static void mfsr(Interpreter& interpreter, UGeckoInstruction inst); + static void mfsrin(Interpreter& interpreter, UGeckoInstruction inst); + static void mtmsr(Interpreter& interpreter, UGeckoInstruction inst); + static void mtsr(Interpreter& interpreter, UGeckoInstruction inst); + static void mtsrin(Interpreter& interpreter, UGeckoInstruction inst); + static void mfspr(Interpreter& interpreter, UGeckoInstruction inst); + static void mftb(Interpreter& interpreter, UGeckoInstruction inst); + static void mtcrf(Interpreter& interpreter, UGeckoInstruction inst); + static void mtspr(Interpreter& interpreter, UGeckoInstruction inst); + static void crand(Interpreter& interpreter, UGeckoInstruction inst); + static void crandc(Interpreter& interpreter, UGeckoInstruction inst); + static void creqv(Interpreter& interpreter, UGeckoInstruction inst); + static void crnand(Interpreter& interpreter, UGeckoInstruction inst); + static void crnor(Interpreter& interpreter, UGeckoInstruction inst); + static void cror(Interpreter& interpreter, UGeckoInstruction inst); + static void crorc(Interpreter& interpreter, UGeckoInstruction inst); + static void crxor(Interpreter& interpreter, UGeckoInstruction inst); + static void mcrf(Interpreter& interpreter, UGeckoInstruction inst); + static void rfi(Interpreter& interpreter, UGeckoInstruction inst); + static void sync(Interpreter& interpreter, UGeckoInstruction inst); + static void isync(Interpreter& interpreter, UGeckoInstruction inst); - using Instruction = void (*)(UGeckoInstruction inst); + using Instruction = void (*)(Interpreter& interpreter, UGeckoInstruction inst); static Instruction GetInterpreterOp(UGeckoInstruction inst); - static void RunInterpreterOp(UGeckoInstruction inst); + static void RunInterpreterOp(Interpreter& interpreter, UGeckoInstruction inst); // singleton static Interpreter* getInstance(); - static void RunTable4(UGeckoInstruction inst); - static void RunTable19(UGeckoInstruction inst); - static void RunTable31(UGeckoInstruction inst); - static void RunTable59(UGeckoInstruction inst); - static void RunTable63(UGeckoInstruction inst); + static void RunTable4(Interpreter& interpreter, UGeckoInstruction inst); + static void RunTable19(Interpreter& interpreter, UGeckoInstruction inst); + static void RunTable31(Interpreter& interpreter, UGeckoInstruction inst); + static void RunTable59(Interpreter& interpreter, UGeckoInstruction inst); + static void RunTable63(Interpreter& interpreter, UGeckoInstruction inst); static u32 Helper_Carry(u32 value1, u32 value2); diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Branch.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Branch.cpp index 39c1165a5c..e2fba4a931 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Branch.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Branch.cpp @@ -12,7 +12,7 @@ #include "Core/PowerPC/PowerPC.h" #include "Core/System.h" -void Interpreter::bx(UGeckoInstruction inst) +void Interpreter::bx(Interpreter& interpreter, UGeckoInstruction inst) { if (inst.LK) LR(PowerPC::ppcState) = PowerPC::ppcState.pc + 4; @@ -28,7 +28,7 @@ void Interpreter::bx(UGeckoInstruction inst) } // bcx - ugly, straight from PPC manual equations :) -void Interpreter::bcx(UGeckoInstruction inst) +void Interpreter::bcx(Interpreter& interpreter, UGeckoInstruction inst) { if ((inst.BO & BO_DONT_DECREMENT_FLAG) == 0) CTR(PowerPC::ppcState)--; @@ -57,7 +57,7 @@ void Interpreter::bcx(UGeckoInstruction inst) m_end_block = true; } -void Interpreter::bcctrx(UGeckoInstruction inst) +void Interpreter::bcctrx(Interpreter& interpreter, UGeckoInstruction inst) { DEBUG_ASSERT_MSG(POWERPC, (inst.BO_2 & BO_DONT_DECREMENT_FLAG) != 0, "bcctrx with decrement and test CTR option is invalid!"); @@ -75,7 +75,7 @@ void Interpreter::bcctrx(UGeckoInstruction inst) m_end_block = true; } -void Interpreter::bclrx(UGeckoInstruction inst) +void Interpreter::bclrx(Interpreter& interpreter, UGeckoInstruction inst) { if ((inst.BO_2 & BO_DONT_DECREMENT_FLAG) == 0) CTR(PowerPC::ppcState)--; @@ -94,7 +94,7 @@ void Interpreter::bclrx(UGeckoInstruction inst) m_end_block = true; } -void Interpreter::HLEFunction(UGeckoInstruction inst) +void Interpreter::HLEFunction(Interpreter& interpreter, UGeckoInstruction inst) { m_end_block = true; @@ -104,7 +104,7 @@ void Interpreter::HLEFunction(UGeckoInstruction inst) HLE::Execute(guard, PowerPC::ppcState.pc, inst.hex); } -void Interpreter::rfi(UGeckoInstruction inst) +void Interpreter::rfi(Interpreter& interpreter, UGeckoInstruction inst) { if (PowerPC::ppcState.msr.PR) { @@ -132,7 +132,7 @@ void Interpreter::rfi(UGeckoInstruction inst) // sc isn't really used for anything important in GameCube games (just for a write barrier) so we // really don't have to emulate it. // We do it anyway, though :P -void Interpreter::sc(UGeckoInstruction inst) +void Interpreter::sc(Interpreter& interpreter, UGeckoInstruction inst) { PowerPC::ppcState.Exceptions |= EXCEPTION_SYSCALL; PowerPC::CheckExceptions(); diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp index 9f5c78e76b..b3301af738 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp @@ -209,7 +209,7 @@ void Interpreter::Helper_FloatCompareUnordered(UGeckoInstruction inst, double fa PowerPC::ppcState.cr.SetField(inst.CRFD, compare_value); } -void Interpreter::fcmpo(UGeckoInstruction inst) +void Interpreter::fcmpo(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -217,7 +217,7 @@ void Interpreter::fcmpo(UGeckoInstruction inst) Helper_FloatCompareOrdered(inst, a.PS0AsDouble(), b.PS0AsDouble()); } -void Interpreter::fcmpu(UGeckoInstruction inst) +void Interpreter::fcmpu(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -225,17 +225,17 @@ void Interpreter::fcmpu(UGeckoInstruction inst) Helper_FloatCompareUnordered(inst, a.PS0AsDouble(), b.PS0AsDouble()); } -void Interpreter::fctiwx(UGeckoInstruction inst) +void Interpreter::fctiwx(Interpreter& interpreter, UGeckoInstruction inst) { ConvertToInteger(inst, static_cast(PowerPC::ppcState.fpscr.RN.Value())); } -void Interpreter::fctiwzx(UGeckoInstruction inst) +void Interpreter::fctiwzx(Interpreter& interpreter, UGeckoInstruction inst) { ConvertToInteger(inst, RoundingMode::TowardsZero); } -void Interpreter::fmrx(UGeckoInstruction inst) +void Interpreter::fmrx(Interpreter& interpreter, UGeckoInstruction inst) { PowerPC::ppcState.ps[inst.FD].SetPS0(PowerPC::ppcState.ps[inst.FB].PS0AsU64()); @@ -244,7 +244,7 @@ void Interpreter::fmrx(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::fabsx(UGeckoInstruction inst) +void Interpreter::fabsx(Interpreter& interpreter, UGeckoInstruction inst) { PowerPC::ppcState.ps[inst.FD].SetPS0(fabs(PowerPC::ppcState.ps[inst.FB].PS0AsDouble())); @@ -253,7 +253,7 @@ void Interpreter::fabsx(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::fnabsx(UGeckoInstruction inst) +void Interpreter::fnabsx(Interpreter& interpreter, UGeckoInstruction inst) { PowerPC::ppcState.ps[inst.FD].SetPS0(PowerPC::ppcState.ps[inst.FB].PS0AsU64() | (UINT64_C(1) << 63)); @@ -263,7 +263,7 @@ void Interpreter::fnabsx(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::fnegx(UGeckoInstruction inst) +void Interpreter::fnegx(Interpreter& interpreter, UGeckoInstruction inst) { PowerPC::ppcState.ps[inst.FD].SetPS0(PowerPC::ppcState.ps[inst.FB].PS0AsU64() ^ (UINT64_C(1) << 63)); @@ -273,7 +273,7 @@ void Interpreter::fnegx(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::fselx(UGeckoInstruction inst) +void Interpreter::fselx(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -290,7 +290,7 @@ void Interpreter::fselx(UGeckoInstruction inst) // !!! warning !!! // PS1 must be set to the value of PS0 or DragonballZ will be f**ked up // PS1 is said to be undefined -void Interpreter::frspx(UGeckoInstruction inst) // round to single +void Interpreter::frspx(Interpreter& interpreter, UGeckoInstruction inst) // round to single { const double b = PowerPC::ppcState.ps[inst.FB].PS0AsDouble(); const float rounded = ForceSingle(PowerPC::ppcState.fpscr, b); @@ -322,7 +322,7 @@ void Interpreter::frspx(UGeckoInstruction inst) // round to single PowerPC::ppcState.UpdateCR1(); } -void Interpreter::fmulx(UGeckoInstruction inst) +void Interpreter::fmulx(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& c = PowerPC::ppcState.ps[inst.FC]; @@ -342,7 +342,7 @@ void Interpreter::fmulx(UGeckoInstruction inst) if (inst.Rc) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::fmulsx(UGeckoInstruction inst) +void Interpreter::fmulsx(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& c = PowerPC::ppcState.ps[inst.FC]; @@ -364,7 +364,7 @@ void Interpreter::fmulsx(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::fmaddx(UGeckoInstruction inst) +void Interpreter::fmaddx(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -383,7 +383,7 @@ void Interpreter::fmaddx(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::fmaddsx(UGeckoInstruction inst) +void Interpreter::fmaddsx(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -407,7 +407,7 @@ void Interpreter::fmaddsx(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::faddx(UGeckoInstruction inst) +void Interpreter::faddx(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -424,7 +424,7 @@ void Interpreter::faddx(UGeckoInstruction inst) if (inst.Rc) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::faddsx(UGeckoInstruction inst) +void Interpreter::faddsx(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -442,7 +442,7 @@ void Interpreter::faddsx(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::fdivx(UGeckoInstruction inst) +void Interpreter::fdivx(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -462,7 +462,7 @@ void Interpreter::fdivx(UGeckoInstruction inst) if (inst.Rc) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::fdivsx(UGeckoInstruction inst) +void Interpreter::fdivsx(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -483,7 +483,7 @@ void Interpreter::fdivsx(UGeckoInstruction inst) } // Single precision only. -void Interpreter::fresx(UGeckoInstruction inst) +void Interpreter::fresx(Interpreter& interpreter, UGeckoInstruction inst) { const double b = PowerPC::ppcState.ps[inst.FB].PS0AsDouble(); @@ -521,7 +521,7 @@ void Interpreter::fresx(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::frsqrtex(UGeckoInstruction inst) +void Interpreter::frsqrtex(Interpreter& interpreter, UGeckoInstruction inst) { const double b = PowerPC::ppcState.ps[inst.FB].PS0AsDouble(); @@ -567,7 +567,7 @@ void Interpreter::frsqrtex(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::fmsubx(UGeckoInstruction inst) +void Interpreter::fmsubx(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -587,7 +587,7 @@ void Interpreter::fmsubx(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::fmsubsx(UGeckoInstruction inst) +void Interpreter::fmsubsx(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -608,7 +608,7 @@ void Interpreter::fmsubsx(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::fnmaddx(UGeckoInstruction inst) +void Interpreter::fnmaddx(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -630,7 +630,7 @@ void Interpreter::fnmaddx(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::fnmaddsx(UGeckoInstruction inst) +void Interpreter::fnmaddsx(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -653,7 +653,7 @@ void Interpreter::fnmaddsx(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::fnmsubx(UGeckoInstruction inst) +void Interpreter::fnmsubx(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -675,7 +675,7 @@ void Interpreter::fnmsubx(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::fnmsubsx(UGeckoInstruction inst) +void Interpreter::fnmsubsx(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -698,7 +698,7 @@ void Interpreter::fnmsubsx(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::fsubx(UGeckoInstruction inst) +void Interpreter::fsubx(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -716,7 +716,7 @@ void Interpreter::fsubx(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::fsubsx(UGeckoInstruction inst) +void Interpreter::fsubsx(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& b = PowerPC::ppcState.ps[inst.FB]; diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp index 3349d1448a..7f3a4c1827 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp @@ -26,7 +26,7 @@ u32 Interpreter::Helper_Carry(u32 value1, u32 value2) return value2 > (~value1); } -void Interpreter::addi(UGeckoInstruction inst) +void Interpreter::addi(Interpreter& interpreter, UGeckoInstruction inst) { if (inst.RA) PowerPC::ppcState.gpr[inst.RD] = PowerPC::ppcState.gpr[inst.RA] + u32(inst.SIMM_16); @@ -34,7 +34,7 @@ void Interpreter::addi(UGeckoInstruction inst) PowerPC::ppcState.gpr[inst.RD] = u32(inst.SIMM_16); } -void Interpreter::addic(UGeckoInstruction inst) +void Interpreter::addic(Interpreter& interpreter, UGeckoInstruction inst) { const u32 a = PowerPC::ppcState.gpr[inst.RA]; const u32 imm = u32(s32{inst.SIMM_16}); @@ -43,13 +43,13 @@ void Interpreter::addic(UGeckoInstruction inst) PowerPC::ppcState.SetCarry(Helper_Carry(a, imm)); } -void Interpreter::addic_rc(UGeckoInstruction inst) +void Interpreter::addic_rc(Interpreter& interpreter, UGeckoInstruction inst) { - addic(inst); + addic(interpreter, inst); Helper_UpdateCR0(PowerPC::ppcState.gpr[inst.RD]); } -void Interpreter::addis(UGeckoInstruction inst) +void Interpreter::addis(Interpreter& interpreter, UGeckoInstruction inst) { if (inst.RA) PowerPC::ppcState.gpr[inst.RD] = PowerPC::ppcState.gpr[inst.RA] + u32(inst.SIMM_16 << 16); @@ -57,13 +57,13 @@ void Interpreter::addis(UGeckoInstruction inst) PowerPC::ppcState.gpr[inst.RD] = u32(inst.SIMM_16 << 16); } -void Interpreter::andi_rc(UGeckoInstruction inst) +void Interpreter::andi_rc(Interpreter& interpreter, UGeckoInstruction inst) { PowerPC::ppcState.gpr[inst.RA] = PowerPC::ppcState.gpr[inst.RS] & inst.UIMM; Helper_UpdateCR0(PowerPC::ppcState.gpr[inst.RA]); } -void Interpreter::andis_rc(UGeckoInstruction inst) +void Interpreter::andis_rc(Interpreter& interpreter, UGeckoInstruction inst) { PowerPC::ppcState.gpr[inst.RA] = PowerPC::ppcState.gpr[inst.RS] & (u32{inst.UIMM} << 16); Helper_UpdateCR0(PowerPC::ppcState.gpr[inst.RA]); @@ -87,36 +87,36 @@ void Interpreter::Helper_IntCompare(UGeckoInstruction inst, T a, T b) PowerPC::ppcState.cr.SetField(inst.CRFD, cr_field); } -void Interpreter::cmpi(UGeckoInstruction inst) +void Interpreter::cmpi(Interpreter& interpreter, UGeckoInstruction inst) { const s32 a = static_cast(PowerPC::ppcState.gpr[inst.RA]); const s32 b = inst.SIMM_16; Helper_IntCompare(inst, a, b); } -void Interpreter::cmpli(UGeckoInstruction inst) +void Interpreter::cmpli(Interpreter& interpreter, UGeckoInstruction inst) { const u32 a = PowerPC::ppcState.gpr[inst.RA]; const u32 b = inst.UIMM; Helper_IntCompare(inst, a, b); } -void Interpreter::mulli(UGeckoInstruction inst) +void Interpreter::mulli(Interpreter& interpreter, UGeckoInstruction inst) { PowerPC::ppcState.gpr[inst.RD] = u32(s32(PowerPC::ppcState.gpr[inst.RA]) * inst.SIMM_16); } -void Interpreter::ori(UGeckoInstruction inst) +void Interpreter::ori(Interpreter& interpreter, UGeckoInstruction inst) { PowerPC::ppcState.gpr[inst.RA] = PowerPC::ppcState.gpr[inst.RS] | inst.UIMM; } -void Interpreter::oris(UGeckoInstruction inst) +void Interpreter::oris(Interpreter& interpreter, UGeckoInstruction inst) { PowerPC::ppcState.gpr[inst.RA] = PowerPC::ppcState.gpr[inst.RS] | (u32{inst.UIMM} << 16); } -void Interpreter::subfic(UGeckoInstruction inst) +void Interpreter::subfic(Interpreter& interpreter, UGeckoInstruction inst) { const s32 immediate = inst.SIMM_16; PowerPC::ppcState.gpr[inst.RD] = u32(immediate - s32(PowerPC::ppcState.gpr[inst.RA])); @@ -124,7 +124,7 @@ void Interpreter::subfic(UGeckoInstruction inst) (Helper_Carry(0 - PowerPC::ppcState.gpr[inst.RA], u32(immediate)))); } -void Interpreter::twi(UGeckoInstruction inst) +void Interpreter::twi(Interpreter& interpreter, UGeckoInstruction inst) { const s32 a = s32(PowerPC::ppcState.gpr[inst.RA]); const s32 b = inst.SIMM_16; @@ -141,17 +141,17 @@ void Interpreter::twi(UGeckoInstruction inst) } } -void Interpreter::xori(UGeckoInstruction inst) +void Interpreter::xori(Interpreter& interpreter, UGeckoInstruction inst) { PowerPC::ppcState.gpr[inst.RA] = PowerPC::ppcState.gpr[inst.RS] ^ inst.UIMM; } -void Interpreter::xoris(UGeckoInstruction inst) +void Interpreter::xoris(Interpreter& interpreter, UGeckoInstruction inst) { PowerPC::ppcState.gpr[inst.RA] = PowerPC::ppcState.gpr[inst.RS] ^ (u32{inst.UIMM} << 16); } -void Interpreter::rlwimix(UGeckoInstruction inst) +void Interpreter::rlwimix(Interpreter& interpreter, UGeckoInstruction inst) { const u32 mask = MakeRotationMask(inst.MB, inst.ME); PowerPC::ppcState.gpr[inst.RA] = (PowerPC::ppcState.gpr[inst.RA] & ~mask) | @@ -161,7 +161,7 @@ void Interpreter::rlwimix(UGeckoInstruction inst) Helper_UpdateCR0(PowerPC::ppcState.gpr[inst.RA]); } -void Interpreter::rlwinmx(UGeckoInstruction inst) +void Interpreter::rlwinmx(Interpreter& interpreter, UGeckoInstruction inst) { const u32 mask = MakeRotationMask(inst.MB, inst.ME); PowerPC::ppcState.gpr[inst.RA] = std::rotl(PowerPC::ppcState.gpr[inst.RS], inst.SH) & mask; @@ -170,7 +170,7 @@ void Interpreter::rlwinmx(UGeckoInstruction inst) Helper_UpdateCR0(PowerPC::ppcState.gpr[inst.RA]); } -void Interpreter::rlwnmx(UGeckoInstruction inst) +void Interpreter::rlwnmx(Interpreter& interpreter, UGeckoInstruction inst) { const u32 mask = MakeRotationMask(inst.MB, inst.ME); PowerPC::ppcState.gpr[inst.RA] = @@ -180,7 +180,7 @@ void Interpreter::rlwnmx(UGeckoInstruction inst) Helper_UpdateCR0(PowerPC::ppcState.gpr[inst.RA]); } -void Interpreter::andx(UGeckoInstruction inst) +void Interpreter::andx(Interpreter& interpreter, UGeckoInstruction inst) { PowerPC::ppcState.gpr[inst.RA] = PowerPC::ppcState.gpr[inst.RS] & PowerPC::ppcState.gpr[inst.RB]; @@ -188,7 +188,7 @@ void Interpreter::andx(UGeckoInstruction inst) Helper_UpdateCR0(PowerPC::ppcState.gpr[inst.RA]); } -void Interpreter::andcx(UGeckoInstruction inst) +void Interpreter::andcx(Interpreter& interpreter, UGeckoInstruction inst) { PowerPC::ppcState.gpr[inst.RA] = PowerPC::ppcState.gpr[inst.RS] & ~PowerPC::ppcState.gpr[inst.RB]; @@ -196,21 +196,21 @@ void Interpreter::andcx(UGeckoInstruction inst) Helper_UpdateCR0(PowerPC::ppcState.gpr[inst.RA]); } -void Interpreter::cmp(UGeckoInstruction inst) +void Interpreter::cmp(Interpreter& interpreter, UGeckoInstruction inst) { const s32 a = static_cast(PowerPC::ppcState.gpr[inst.RA]); const s32 b = static_cast(PowerPC::ppcState.gpr[inst.RB]); Helper_IntCompare(inst, a, b); } -void Interpreter::cmpl(UGeckoInstruction inst) +void Interpreter::cmpl(Interpreter& interpreter, UGeckoInstruction inst) { const u32 a = PowerPC::ppcState.gpr[inst.RA]; const u32 b = PowerPC::ppcState.gpr[inst.RB]; Helper_IntCompare(inst, a, b); } -void Interpreter::cntlzwx(UGeckoInstruction inst) +void Interpreter::cntlzwx(Interpreter& interpreter, UGeckoInstruction inst) { PowerPC::ppcState.gpr[inst.RA] = u32(std::countl_zero(PowerPC::ppcState.gpr[inst.RS])); @@ -218,7 +218,7 @@ void Interpreter::cntlzwx(UGeckoInstruction inst) Helper_UpdateCR0(PowerPC::ppcState.gpr[inst.RA]); } -void Interpreter::eqvx(UGeckoInstruction inst) +void Interpreter::eqvx(Interpreter& interpreter, UGeckoInstruction inst) { PowerPC::ppcState.gpr[inst.RA] = ~(PowerPC::ppcState.gpr[inst.RS] ^ PowerPC::ppcState.gpr[inst.RB]); @@ -227,7 +227,7 @@ void Interpreter::eqvx(UGeckoInstruction inst) Helper_UpdateCR0(PowerPC::ppcState.gpr[inst.RA]); } -void Interpreter::extsbx(UGeckoInstruction inst) +void Interpreter::extsbx(Interpreter& interpreter, UGeckoInstruction inst) { PowerPC::ppcState.gpr[inst.RA] = u32(s32(s8(PowerPC::ppcState.gpr[inst.RS]))); @@ -235,7 +235,7 @@ void Interpreter::extsbx(UGeckoInstruction inst) Helper_UpdateCR0(PowerPC::ppcState.gpr[inst.RA]); } -void Interpreter::extshx(UGeckoInstruction inst) +void Interpreter::extshx(Interpreter& interpreter, UGeckoInstruction inst) { PowerPC::ppcState.gpr[inst.RA] = u32(s32(s16(PowerPC::ppcState.gpr[inst.RS]))); @@ -243,7 +243,7 @@ void Interpreter::extshx(UGeckoInstruction inst) Helper_UpdateCR0(PowerPC::ppcState.gpr[inst.RA]); } -void Interpreter::nandx(UGeckoInstruction inst) +void Interpreter::nandx(Interpreter& interpreter, UGeckoInstruction inst) { PowerPC::ppcState.gpr[inst.RA] = ~(PowerPC::ppcState.gpr[inst.RS] & PowerPC::ppcState.gpr[inst.RB]); @@ -252,7 +252,7 @@ void Interpreter::nandx(UGeckoInstruction inst) Helper_UpdateCR0(PowerPC::ppcState.gpr[inst.RA]); } -void Interpreter::norx(UGeckoInstruction inst) +void Interpreter::norx(Interpreter& interpreter, UGeckoInstruction inst) { PowerPC::ppcState.gpr[inst.RA] = ~(PowerPC::ppcState.gpr[inst.RS] | PowerPC::ppcState.gpr[inst.RB]); @@ -261,7 +261,7 @@ void Interpreter::norx(UGeckoInstruction inst) Helper_UpdateCR0(PowerPC::ppcState.gpr[inst.RA]); } -void Interpreter::orx(UGeckoInstruction inst) +void Interpreter::orx(Interpreter& interpreter, UGeckoInstruction inst) { PowerPC::ppcState.gpr[inst.RA] = PowerPC::ppcState.gpr[inst.RS] | PowerPC::ppcState.gpr[inst.RB]; @@ -269,7 +269,7 @@ void Interpreter::orx(UGeckoInstruction inst) Helper_UpdateCR0(PowerPC::ppcState.gpr[inst.RA]); } -void Interpreter::orcx(UGeckoInstruction inst) +void Interpreter::orcx(Interpreter& interpreter, UGeckoInstruction inst) { PowerPC::ppcState.gpr[inst.RA] = PowerPC::ppcState.gpr[inst.RS] | (~PowerPC::ppcState.gpr[inst.RB]); @@ -278,7 +278,7 @@ void Interpreter::orcx(UGeckoInstruction inst) Helper_UpdateCR0(PowerPC::ppcState.gpr[inst.RA]); } -void Interpreter::slwx(UGeckoInstruction inst) +void Interpreter::slwx(Interpreter& interpreter, UGeckoInstruction inst) { const u32 amount = PowerPC::ppcState.gpr[inst.RB]; PowerPC::ppcState.gpr[inst.RA] = @@ -288,7 +288,7 @@ void Interpreter::slwx(UGeckoInstruction inst) Helper_UpdateCR0(PowerPC::ppcState.gpr[inst.RA]); } -void Interpreter::srawx(UGeckoInstruction inst) +void Interpreter::srawx(Interpreter& interpreter, UGeckoInstruction inst) { const u32 rb = PowerPC::ppcState.gpr[inst.RB]; @@ -318,7 +318,7 @@ void Interpreter::srawx(UGeckoInstruction inst) Helper_UpdateCR0(PowerPC::ppcState.gpr[inst.RA]); } -void Interpreter::srawix(UGeckoInstruction inst) +void Interpreter::srawix(Interpreter& interpreter, UGeckoInstruction inst) { const u32 amount = inst.SH; const s32 rrs = s32(PowerPC::ppcState.gpr[inst.RS]); @@ -330,7 +330,7 @@ void Interpreter::srawix(UGeckoInstruction inst) Helper_UpdateCR0(PowerPC::ppcState.gpr[inst.RA]); } -void Interpreter::srwx(UGeckoInstruction inst) +void Interpreter::srwx(Interpreter& interpreter, UGeckoInstruction inst) { const u32 amount = PowerPC::ppcState.gpr[inst.RB]; PowerPC::ppcState.gpr[inst.RA] = @@ -340,7 +340,7 @@ void Interpreter::srwx(UGeckoInstruction inst) Helper_UpdateCR0(PowerPC::ppcState.gpr[inst.RA]); } -void Interpreter::tw(UGeckoInstruction inst) +void Interpreter::tw(Interpreter& interpreter, UGeckoInstruction inst) { const s32 a = s32(PowerPC::ppcState.gpr[inst.RA]); const s32 b = s32(PowerPC::ppcState.gpr[inst.RB]); @@ -357,7 +357,7 @@ void Interpreter::tw(UGeckoInstruction inst) } } -void Interpreter::xorx(UGeckoInstruction inst) +void Interpreter::xorx(Interpreter& interpreter, UGeckoInstruction inst) { PowerPC::ppcState.gpr[inst.RA] = PowerPC::ppcState.gpr[inst.RS] ^ PowerPC::ppcState.gpr[inst.RB]; @@ -372,7 +372,7 @@ static bool HasAddOverflowed(u32 x, u32 y, u32 result) return (((x ^ result) & (y ^ result)) >> 31) != 0; } -void Interpreter::addx(UGeckoInstruction inst) +void Interpreter::addx(Interpreter& interpreter, UGeckoInstruction inst) { const u32 a = PowerPC::ppcState.gpr[inst.RA]; const u32 b = PowerPC::ppcState.gpr[inst.RB]; @@ -387,7 +387,7 @@ void Interpreter::addx(UGeckoInstruction inst) Helper_UpdateCR0(result); } -void Interpreter::addcx(UGeckoInstruction inst) +void Interpreter::addcx(Interpreter& interpreter, UGeckoInstruction inst) { const u32 a = PowerPC::ppcState.gpr[inst.RA]; const u32 b = PowerPC::ppcState.gpr[inst.RB]; @@ -403,7 +403,7 @@ void Interpreter::addcx(UGeckoInstruction inst) Helper_UpdateCR0(result); } -void Interpreter::addex(UGeckoInstruction inst) +void Interpreter::addex(Interpreter& interpreter, UGeckoInstruction inst) { const u32 carry = PowerPC::ppcState.GetCarry(); const u32 a = PowerPC::ppcState.gpr[inst.RA]; @@ -420,7 +420,7 @@ void Interpreter::addex(UGeckoInstruction inst) Helper_UpdateCR0(result); } -void Interpreter::addmex(UGeckoInstruction inst) +void Interpreter::addmex(Interpreter& interpreter, UGeckoInstruction inst) { const u32 carry = PowerPC::ppcState.GetCarry(); const u32 a = PowerPC::ppcState.gpr[inst.RA]; @@ -437,7 +437,7 @@ void Interpreter::addmex(UGeckoInstruction inst) Helper_UpdateCR0(result); } -void Interpreter::addzex(UGeckoInstruction inst) +void Interpreter::addzex(Interpreter& interpreter, UGeckoInstruction inst) { const u32 carry = PowerPC::ppcState.GetCarry(); const u32 a = PowerPC::ppcState.gpr[inst.RA]; @@ -453,7 +453,7 @@ void Interpreter::addzex(UGeckoInstruction inst) Helper_UpdateCR0(result); } -void Interpreter::divwx(UGeckoInstruction inst) +void Interpreter::divwx(Interpreter& interpreter, UGeckoInstruction inst) { const auto a = s32(PowerPC::ppcState.gpr[inst.RA]); const auto b = s32(PowerPC::ppcState.gpr[inst.RB]); @@ -478,7 +478,7 @@ void Interpreter::divwx(UGeckoInstruction inst) Helper_UpdateCR0(PowerPC::ppcState.gpr[inst.RD]); } -void Interpreter::divwux(UGeckoInstruction inst) +void Interpreter::divwux(Interpreter& interpreter, UGeckoInstruction inst) { const u32 a = PowerPC::ppcState.gpr[inst.RA]; const u32 b = PowerPC::ppcState.gpr[inst.RB]; @@ -500,7 +500,7 @@ void Interpreter::divwux(UGeckoInstruction inst) Helper_UpdateCR0(PowerPC::ppcState.gpr[inst.RD]); } -void Interpreter::mulhwx(UGeckoInstruction inst) +void Interpreter::mulhwx(Interpreter& interpreter, UGeckoInstruction inst) { const s64 a = static_cast(PowerPC::ppcState.gpr[inst.RA]); const s64 b = static_cast(PowerPC::ppcState.gpr[inst.RB]); @@ -512,7 +512,7 @@ void Interpreter::mulhwx(UGeckoInstruction inst) Helper_UpdateCR0(d); } -void Interpreter::mulhwux(UGeckoInstruction inst) +void Interpreter::mulhwux(Interpreter& interpreter, UGeckoInstruction inst) { const u64 a = PowerPC::ppcState.gpr[inst.RA]; const u64 b = PowerPC::ppcState.gpr[inst.RB]; @@ -524,7 +524,7 @@ void Interpreter::mulhwux(UGeckoInstruction inst) Helper_UpdateCR0(d); } -void Interpreter::mullwx(UGeckoInstruction inst) +void Interpreter::mullwx(Interpreter& interpreter, UGeckoInstruction inst) { const s64 a = static_cast(PowerPC::ppcState.gpr[inst.RA]); const s64 b = static_cast(PowerPC::ppcState.gpr[inst.RB]); @@ -539,7 +539,7 @@ void Interpreter::mullwx(UGeckoInstruction inst) Helper_UpdateCR0(PowerPC::ppcState.gpr[inst.RD]); } -void Interpreter::negx(UGeckoInstruction inst) +void Interpreter::negx(Interpreter& interpreter, UGeckoInstruction inst) { const u32 a = PowerPC::ppcState.gpr[inst.RA]; @@ -552,7 +552,7 @@ void Interpreter::negx(UGeckoInstruction inst) Helper_UpdateCR0(PowerPC::ppcState.gpr[inst.RD]); } -void Interpreter::subfx(UGeckoInstruction inst) +void Interpreter::subfx(Interpreter& interpreter, UGeckoInstruction inst) { const u32 a = ~PowerPC::ppcState.gpr[inst.RA]; const u32 b = PowerPC::ppcState.gpr[inst.RB]; @@ -567,7 +567,7 @@ void Interpreter::subfx(UGeckoInstruction inst) Helper_UpdateCR0(result); } -void Interpreter::subfcx(UGeckoInstruction inst) +void Interpreter::subfcx(Interpreter& interpreter, UGeckoInstruction inst) { const u32 a = ~PowerPC::ppcState.gpr[inst.RA]; const u32 b = PowerPC::ppcState.gpr[inst.RB]; @@ -583,7 +583,7 @@ void Interpreter::subfcx(UGeckoInstruction inst) Helper_UpdateCR0(result); } -void Interpreter::subfex(UGeckoInstruction inst) +void Interpreter::subfex(Interpreter& interpreter, UGeckoInstruction inst) { const u32 a = ~PowerPC::ppcState.gpr[inst.RA]; const u32 b = PowerPC::ppcState.gpr[inst.RB]; @@ -601,7 +601,7 @@ void Interpreter::subfex(UGeckoInstruction inst) } // sub from minus one -void Interpreter::subfmex(UGeckoInstruction inst) +void Interpreter::subfmex(Interpreter& interpreter, UGeckoInstruction inst) { const u32 a = ~PowerPC::ppcState.gpr[inst.RA]; const u32 b = 0xFFFFFFFF; @@ -619,7 +619,7 @@ void Interpreter::subfmex(UGeckoInstruction inst) } // sub from zero -void Interpreter::subfzex(UGeckoInstruction inst) +void Interpreter::subfzex(Interpreter& interpreter, UGeckoInstruction inst) { const u32 a = ~PowerPC::ppcState.gpr[inst.RA]; const u32 carry = PowerPC::ppcState.GetCarry(); diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp index 85c93389e6..b81f8908ad 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp @@ -37,7 +37,7 @@ static u32 Helper_Get_EA_UX(const PowerPC::PowerPCState& ppcs, const UGeckoInstr return (ppcs.gpr[inst.RA] + ppcs.gpr[inst.RB]); } -void Interpreter::lbz(UGeckoInstruction inst) +void Interpreter::lbz(Interpreter& interpreter, UGeckoInstruction inst) { const u32 temp = PowerPC::Read_U8(Helper_Get_EA(PowerPC::ppcState, inst)); @@ -45,7 +45,7 @@ void Interpreter::lbz(UGeckoInstruction inst) PowerPC::ppcState.gpr[inst.RD] = temp; } -void Interpreter::lbzu(UGeckoInstruction inst) +void Interpreter::lbzu(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA_U(PowerPC::ppcState, inst); const u32 temp = PowerPC::Read_U8(address); @@ -57,7 +57,7 @@ void Interpreter::lbzu(UGeckoInstruction inst) } } -void Interpreter::lfd(UGeckoInstruction inst) +void Interpreter::lfd(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA(PowerPC::ppcState, inst); @@ -73,7 +73,7 @@ void Interpreter::lfd(UGeckoInstruction inst) PowerPC::ppcState.ps[inst.FD].SetPS0(temp); } -void Interpreter::lfdu(UGeckoInstruction inst) +void Interpreter::lfdu(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA_U(PowerPC::ppcState, inst); @@ -92,7 +92,7 @@ void Interpreter::lfdu(UGeckoInstruction inst) } } -void Interpreter::lfdux(UGeckoInstruction inst) +void Interpreter::lfdux(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA_UX(PowerPC::ppcState, inst); @@ -111,7 +111,7 @@ void Interpreter::lfdux(UGeckoInstruction inst) } } -void Interpreter::lfdx(UGeckoInstruction inst) +void Interpreter::lfdx(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA_X(PowerPC::ppcState, inst); @@ -127,7 +127,7 @@ void Interpreter::lfdx(UGeckoInstruction inst) PowerPC::ppcState.ps[inst.FD].SetPS0(temp); } -void Interpreter::lfs(UGeckoInstruction inst) +void Interpreter::lfs(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA(PowerPC::ppcState, inst); @@ -146,7 +146,7 @@ void Interpreter::lfs(UGeckoInstruction inst) } } -void Interpreter::lfsu(UGeckoInstruction inst) +void Interpreter::lfsu(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA_U(PowerPC::ppcState, inst); @@ -166,7 +166,7 @@ void Interpreter::lfsu(UGeckoInstruction inst) } } -void Interpreter::lfsux(UGeckoInstruction inst) +void Interpreter::lfsux(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA_UX(PowerPC::ppcState, inst); @@ -186,7 +186,7 @@ void Interpreter::lfsux(UGeckoInstruction inst) } } -void Interpreter::lfsx(UGeckoInstruction inst) +void Interpreter::lfsx(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA_X(PowerPC::ppcState, inst); @@ -205,7 +205,7 @@ void Interpreter::lfsx(UGeckoInstruction inst) } } -void Interpreter::lha(UGeckoInstruction inst) +void Interpreter::lha(Interpreter& interpreter, UGeckoInstruction inst) { const u32 temp = u32(s32(s16(PowerPC::Read_U16(Helper_Get_EA(PowerPC::ppcState, inst))))); @@ -215,7 +215,7 @@ void Interpreter::lha(UGeckoInstruction inst) } } -void Interpreter::lhau(UGeckoInstruction inst) +void Interpreter::lhau(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA_U(PowerPC::ppcState, inst); const u32 temp = u32(s32(s16(PowerPC::Read_U16(address)))); @@ -227,7 +227,7 @@ void Interpreter::lhau(UGeckoInstruction inst) } } -void Interpreter::lhz(UGeckoInstruction inst) +void Interpreter::lhz(Interpreter& interpreter, UGeckoInstruction inst) { const u32 temp = PowerPC::Read_U16(Helper_Get_EA(PowerPC::ppcState, inst)); @@ -237,7 +237,7 @@ void Interpreter::lhz(UGeckoInstruction inst) } } -void Interpreter::lhzu(UGeckoInstruction inst) +void Interpreter::lhzu(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA_U(PowerPC::ppcState, inst); const u32 temp = PowerPC::Read_U16(address); @@ -250,7 +250,7 @@ void Interpreter::lhzu(UGeckoInstruction inst) } // FIXME: lmw should do a total rollback if a DSI occurs -void Interpreter::lmw(UGeckoInstruction inst) +void Interpreter::lmw(Interpreter& interpreter, UGeckoInstruction inst) { u32 address = Helper_Get_EA(PowerPC::ppcState, inst); @@ -278,7 +278,7 @@ void Interpreter::lmw(UGeckoInstruction inst) } // FIXME: stmw should do a total rollback if a DSI occurs -void Interpreter::stmw(UGeckoInstruction inst) +void Interpreter::stmw(Interpreter& interpreter, UGeckoInstruction inst) { u32 address = Helper_Get_EA(PowerPC::ppcState, inst); @@ -300,7 +300,7 @@ void Interpreter::stmw(UGeckoInstruction inst) } } -void Interpreter::lwz(UGeckoInstruction inst) +void Interpreter::lwz(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA(PowerPC::ppcState, inst); const u32 temp = PowerPC::Read_U32(address); @@ -311,7 +311,7 @@ void Interpreter::lwz(UGeckoInstruction inst) } } -void Interpreter::lwzu(UGeckoInstruction inst) +void Interpreter::lwzu(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA_U(PowerPC::ppcState, inst); const u32 temp = PowerPC::Read_U32(address); @@ -323,12 +323,12 @@ void Interpreter::lwzu(UGeckoInstruction inst) } } -void Interpreter::stb(UGeckoInstruction inst) +void Interpreter::stb(Interpreter& interpreter, UGeckoInstruction inst) { PowerPC::Write_U8(PowerPC::ppcState.gpr[inst.RS], Helper_Get_EA(PowerPC::ppcState, inst)); } -void Interpreter::stbu(UGeckoInstruction inst) +void Interpreter::stbu(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA_U(PowerPC::ppcState, inst); @@ -339,7 +339,7 @@ void Interpreter::stbu(UGeckoInstruction inst) } } -void Interpreter::stfd(UGeckoInstruction inst) +void Interpreter::stfd(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA(PowerPC::ppcState, inst); @@ -352,7 +352,7 @@ void Interpreter::stfd(UGeckoInstruction inst) PowerPC::Write_U64(PowerPC::ppcState.ps[inst.FS].PS0AsU64(), address); } -void Interpreter::stfdu(UGeckoInstruction inst) +void Interpreter::stfdu(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA_U(PowerPC::ppcState, inst); @@ -369,7 +369,7 @@ void Interpreter::stfdu(UGeckoInstruction inst) } } -void Interpreter::stfs(UGeckoInstruction inst) +void Interpreter::stfs(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA(PowerPC::ppcState, inst); @@ -382,7 +382,7 @@ void Interpreter::stfs(UGeckoInstruction inst) PowerPC::Write_U32(ConvertToSingle(PowerPC::ppcState.ps[inst.FS].PS0AsU64()), address); } -void Interpreter::stfsu(UGeckoInstruction inst) +void Interpreter::stfsu(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA_U(PowerPC::ppcState, inst); @@ -399,12 +399,12 @@ void Interpreter::stfsu(UGeckoInstruction inst) } } -void Interpreter::sth(UGeckoInstruction inst) +void Interpreter::sth(Interpreter& interpreter, UGeckoInstruction inst) { PowerPC::Write_U16(PowerPC::ppcState.gpr[inst.RS], Helper_Get_EA(PowerPC::ppcState, inst)); } -void Interpreter::sthu(UGeckoInstruction inst) +void Interpreter::sthu(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA_U(PowerPC::ppcState, inst); @@ -415,12 +415,12 @@ void Interpreter::sthu(UGeckoInstruction inst) } } -void Interpreter::stw(UGeckoInstruction inst) +void Interpreter::stw(Interpreter& interpreter, UGeckoInstruction inst) { PowerPC::Write_U32(PowerPC::ppcState.gpr[inst.RS], Helper_Get_EA(PowerPC::ppcState, inst)); } -void Interpreter::stwu(UGeckoInstruction inst) +void Interpreter::stwu(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA_U(PowerPC::ppcState, inst); @@ -431,12 +431,12 @@ void Interpreter::stwu(UGeckoInstruction inst) } } -void Interpreter::dcba(UGeckoInstruction inst) +void Interpreter::dcba(Interpreter& interpreter, UGeckoInstruction inst) { ASSERT_MSG(POWERPC, 0, "dcba - Not implemented - not a Gekko instruction"); } -void Interpreter::dcbf(UGeckoInstruction inst) +void Interpreter::dcbf(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA_X(PowerPC::ppcState, inst); if (!PowerPC::ppcState.m_enable_dcache) @@ -451,7 +451,7 @@ void Interpreter::dcbf(UGeckoInstruction inst) PowerPC::FlushDCacheLine(address); } -void Interpreter::dcbi(UGeckoInstruction inst) +void Interpreter::dcbi(Interpreter& interpreter, UGeckoInstruction inst) { if (PowerPC::ppcState.msr.PR) { @@ -472,7 +472,7 @@ void Interpreter::dcbi(UGeckoInstruction inst) PowerPC::InvalidateDCacheLine(address); } -void Interpreter::dcbst(UGeckoInstruction inst) +void Interpreter::dcbst(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA_X(PowerPC::ppcState, inst); if (!PowerPC::ppcState.m_enable_dcache) @@ -491,15 +491,15 @@ void Interpreter::dcbst(UGeckoInstruction inst) // data cache. But the CPU is never guaranteed to do this fetch, and in practice it's not more // performant to emulate it. -void Interpreter::dcbt(UGeckoInstruction inst) +void Interpreter::dcbt(Interpreter& interpreter, UGeckoInstruction inst) { } -void Interpreter::dcbtst(UGeckoInstruction inst) +void Interpreter::dcbtst(Interpreter& interpreter, UGeckoInstruction inst) { } -void Interpreter::dcbz(UGeckoInstruction inst) +void Interpreter::dcbz(Interpreter& interpreter, UGeckoInstruction inst) { const u32 dcbz_addr = Helper_Get_EA_X(PowerPC::ppcState, inst); @@ -523,7 +523,7 @@ void Interpreter::dcbz(UGeckoInstruction inst) PowerPC::ClearDCacheLine(dcbz_addr & (~31)); } -void Interpreter::dcbz_l(UGeckoInstruction inst) +void Interpreter::dcbz_l(Interpreter& interpreter, UGeckoInstruction inst) { if (!HID2(PowerPC::ppcState).LCE) { @@ -544,7 +544,7 @@ void Interpreter::dcbz_l(UGeckoInstruction inst) // eciwx/ecowx technically should access the specified device // We just do it instantly from ppc...and hey, it works! :D -void Interpreter::eciwx(UGeckoInstruction inst) +void Interpreter::eciwx(Interpreter& interpreter, UGeckoInstruction inst) { const u32 EA = Helper_Get_EA_X(PowerPC::ppcState, inst); @@ -563,7 +563,7 @@ void Interpreter::eciwx(UGeckoInstruction inst) PowerPC::ppcState.gpr[inst.RD] = PowerPC::Read_U32(EA); } -void Interpreter::ecowx(UGeckoInstruction inst) +void Interpreter::ecowx(Interpreter& interpreter, UGeckoInstruction inst) { const u32 EA = Helper_Get_EA_X(PowerPC::ppcState, inst); @@ -582,7 +582,7 @@ void Interpreter::ecowx(UGeckoInstruction inst) PowerPC::Write_U32(PowerPC::ppcState.gpr[inst.RS], EA); } -void Interpreter::eieio(UGeckoInstruction inst) +void Interpreter::eieio(Interpreter& interpreter, UGeckoInstruction inst) { // Basically ensures that loads/stores before this instruction // have completed (in order) before executing the next op. @@ -590,14 +590,14 @@ void Interpreter::eieio(UGeckoInstruction inst) // But (at least in interpreter) we do everything realtime anyways. } -void Interpreter::icbi(UGeckoInstruction inst) +void Interpreter::icbi(Interpreter& interpreter, UGeckoInstruction inst) { // TODO: Raise DSI if translation fails (except for direct-store segments). const u32 address = Helper_Get_EA_X(PowerPC::ppcState, inst); PowerPC::ppcState.iCache.Invalidate(address); } -void Interpreter::lbzux(UGeckoInstruction inst) +void Interpreter::lbzux(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA_UX(PowerPC::ppcState, inst); const u32 temp = PowerPC::Read_U8(address); @@ -609,7 +609,7 @@ void Interpreter::lbzux(UGeckoInstruction inst) } } -void Interpreter::lbzx(UGeckoInstruction inst) +void Interpreter::lbzx(Interpreter& interpreter, UGeckoInstruction inst) { const u32 temp = PowerPC::Read_U8(Helper_Get_EA_X(PowerPC::ppcState, inst)); @@ -619,7 +619,7 @@ void Interpreter::lbzx(UGeckoInstruction inst) } } -void Interpreter::lhaux(UGeckoInstruction inst) +void Interpreter::lhaux(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA_UX(PowerPC::ppcState, inst); const s32 temp = s32{s16(PowerPC::Read_U16(address))}; @@ -631,7 +631,7 @@ void Interpreter::lhaux(UGeckoInstruction inst) } } -void Interpreter::lhax(UGeckoInstruction inst) +void Interpreter::lhax(Interpreter& interpreter, UGeckoInstruction inst) { const s32 temp = s32{s16(PowerPC::Read_U16(Helper_Get_EA_X(PowerPC::ppcState, inst)))}; @@ -641,7 +641,7 @@ void Interpreter::lhax(UGeckoInstruction inst) } } -void Interpreter::lhbrx(UGeckoInstruction inst) +void Interpreter::lhbrx(Interpreter& interpreter, UGeckoInstruction inst) { const u32 temp = Common::swap16(PowerPC::Read_U16(Helper_Get_EA_X(PowerPC::ppcState, inst))); @@ -651,7 +651,7 @@ void Interpreter::lhbrx(UGeckoInstruction inst) } } -void Interpreter::lhzux(UGeckoInstruction inst) +void Interpreter::lhzux(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA_UX(PowerPC::ppcState, inst); const u32 temp = PowerPC::Read_U16(address); @@ -663,7 +663,7 @@ void Interpreter::lhzux(UGeckoInstruction inst) } } -void Interpreter::lhzx(UGeckoInstruction inst) +void Interpreter::lhzx(Interpreter& interpreter, UGeckoInstruction inst) { const u32 temp = PowerPC::Read_U16(Helper_Get_EA_X(PowerPC::ppcState, inst)); @@ -674,7 +674,7 @@ void Interpreter::lhzx(UGeckoInstruction inst) } // FIXME: Should rollback if a DSI occurs -void Interpreter::lswx(UGeckoInstruction inst) +void Interpreter::lswx(Interpreter& interpreter, UGeckoInstruction inst) { u32 EA = Helper_Get_EA_X(PowerPC::ppcState, inst); @@ -706,7 +706,7 @@ void Interpreter::lswx(UGeckoInstruction inst) } } -void Interpreter::lwbrx(UGeckoInstruction inst) +void Interpreter::lwbrx(Interpreter& interpreter, UGeckoInstruction inst) { const u32 temp = Common::swap32(PowerPC::Read_U32(Helper_Get_EA_X(PowerPC::ppcState, inst))); @@ -716,7 +716,7 @@ void Interpreter::lwbrx(UGeckoInstruction inst) } } -void Interpreter::lwzux(UGeckoInstruction inst) +void Interpreter::lwzux(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA_UX(PowerPC::ppcState, inst); const u32 temp = PowerPC::Read_U32(address); @@ -728,7 +728,7 @@ void Interpreter::lwzux(UGeckoInstruction inst) } } -void Interpreter::lwzx(UGeckoInstruction inst) +void Interpreter::lwzx(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA_X(PowerPC::ppcState, inst); const u32 temp = PowerPC::Read_U32(address); @@ -739,7 +739,7 @@ void Interpreter::lwzx(UGeckoInstruction inst) } } -void Interpreter::stbux(UGeckoInstruction inst) +void Interpreter::stbux(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA_UX(PowerPC::ppcState, inst); @@ -750,12 +750,12 @@ void Interpreter::stbux(UGeckoInstruction inst) } } -void Interpreter::stbx(UGeckoInstruction inst) +void Interpreter::stbx(Interpreter& interpreter, UGeckoInstruction inst) { PowerPC::Write_U8(PowerPC::ppcState.gpr[inst.RS], Helper_Get_EA_X(PowerPC::ppcState, inst)); } -void Interpreter::stfdux(UGeckoInstruction inst) +void Interpreter::stfdux(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA_UX(PowerPC::ppcState, inst); @@ -772,7 +772,7 @@ void Interpreter::stfdux(UGeckoInstruction inst) } } -void Interpreter::stfdx(UGeckoInstruction inst) +void Interpreter::stfdx(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA_X(PowerPC::ppcState, inst); @@ -786,7 +786,7 @@ void Interpreter::stfdx(UGeckoInstruction inst) } // Stores Floating points into Integers indeXed -void Interpreter::stfiwx(UGeckoInstruction inst) +void Interpreter::stfiwx(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA_X(PowerPC::ppcState, inst); @@ -799,7 +799,7 @@ void Interpreter::stfiwx(UGeckoInstruction inst) PowerPC::Write_U32(PowerPC::ppcState.ps[inst.FS].PS0AsU32(), address); } -void Interpreter::stfsux(UGeckoInstruction inst) +void Interpreter::stfsux(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA_UX(PowerPC::ppcState, inst); @@ -816,7 +816,7 @@ void Interpreter::stfsux(UGeckoInstruction inst) } } -void Interpreter::stfsx(UGeckoInstruction inst) +void Interpreter::stfsx(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA_X(PowerPC::ppcState, inst); @@ -829,12 +829,12 @@ void Interpreter::stfsx(UGeckoInstruction inst) PowerPC::Write_U32(ConvertToSingle(PowerPC::ppcState.ps[inst.FS].PS0AsU64()), address); } -void Interpreter::sthbrx(UGeckoInstruction inst) +void Interpreter::sthbrx(Interpreter& interpreter, UGeckoInstruction inst) { PowerPC::Write_U16_Swap(PowerPC::ppcState.gpr[inst.RS], Helper_Get_EA_X(PowerPC::ppcState, inst)); } -void Interpreter::sthux(UGeckoInstruction inst) +void Interpreter::sthux(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA_UX(PowerPC::ppcState, inst); @@ -845,14 +845,14 @@ void Interpreter::sthux(UGeckoInstruction inst) } } -void Interpreter::sthx(UGeckoInstruction inst) +void Interpreter::sthx(Interpreter& interpreter, UGeckoInstruction inst) { PowerPC::Write_U16(PowerPC::ppcState.gpr[inst.RS], Helper_Get_EA_X(PowerPC::ppcState, inst)); } // lswi - bizarro string instruction // FIXME: Should rollback if a DSI occurs -void Interpreter::lswi(UGeckoInstruction inst) +void Interpreter::lswi(Interpreter& interpreter, UGeckoInstruction inst) { u32 EA = 0; if (inst.RA != 0) @@ -899,7 +899,7 @@ void Interpreter::lswi(UGeckoInstruction inst) // todo : optimize ? // stswi - bizarro string instruction // FIXME: Should rollback if a DSI occurs -void Interpreter::stswi(UGeckoInstruction inst) +void Interpreter::stswi(Interpreter& interpreter, UGeckoInstruction inst) { u32 EA = 0; if (inst.RA != 0) @@ -939,7 +939,7 @@ void Interpreter::stswi(UGeckoInstruction inst) } // TODO: is this right? is it DSI interruptible? -void Interpreter::stswx(UGeckoInstruction inst) +void Interpreter::stswx(Interpreter& interpreter, UGeckoInstruction inst) { u32 EA = Helper_Get_EA_X(PowerPC::ppcState, inst); @@ -968,7 +968,7 @@ void Interpreter::stswx(UGeckoInstruction inst) } } -void Interpreter::stwbrx(UGeckoInstruction inst) +void Interpreter::stwbrx(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA_X(PowerPC::ppcState, inst); @@ -978,7 +978,7 @@ void Interpreter::stwbrx(UGeckoInstruction inst) // The following two instructions are for SMP communications. On a single // CPU, they cannot fail unless an interrupt happens in between. -void Interpreter::lwarx(UGeckoInstruction inst) +void Interpreter::lwarx(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA_X(PowerPC::ppcState, inst); @@ -999,7 +999,7 @@ void Interpreter::lwarx(UGeckoInstruction inst) } // Stores Word Conditional indeXed -void Interpreter::stwcxd(UGeckoInstruction inst) +void Interpreter::stwcxd(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA_X(PowerPC::ppcState, inst); @@ -1026,7 +1026,7 @@ void Interpreter::stwcxd(UGeckoInstruction inst) PowerPC::ppcState.cr.SetField(0, PowerPC::ppcState.GetXER_SO()); } -void Interpreter::stwux(UGeckoInstruction inst) +void Interpreter::stwux(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA_UX(PowerPC::ppcState, inst); @@ -1037,19 +1037,19 @@ void Interpreter::stwux(UGeckoInstruction inst) } } -void Interpreter::stwx(UGeckoInstruction inst) +void Interpreter::stwx(Interpreter& interpreter, UGeckoInstruction inst) { const u32 address = Helper_Get_EA_X(PowerPC::ppcState, inst); PowerPC::Write_U32(PowerPC::ppcState.gpr[inst.RS], address); } -void Interpreter::sync(UGeckoInstruction inst) +void Interpreter::sync(Interpreter& interpreter, UGeckoInstruction inst) { // ignored } -void Interpreter::tlbie(UGeckoInstruction inst) +void Interpreter::tlbie(Interpreter& interpreter, UGeckoInstruction inst) { if (PowerPC::ppcState.msr.PR) { @@ -1063,7 +1063,7 @@ void Interpreter::tlbie(UGeckoInstruction inst) PowerPC::InvalidateTLBEntry(address); } -void Interpreter::tlbsync(UGeckoInstruction inst) +void Interpreter::tlbsync(Interpreter& interpreter, UGeckoInstruction inst) { if (PowerPC::ppcState.msr.PR) { diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp index b701617680..074746f27c 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp @@ -308,7 +308,7 @@ static void Helper_Dequantize(PowerPC::PowerPCState* ppcs, u32 addr, u32 instI, ppcs->ps[instRD].SetBoth(ps0, ps1); } -void Interpreter::psq_l(UGeckoInstruction inst) +void Interpreter::psq_l(Interpreter& interpreter, UGeckoInstruction inst) { if (HID2(PowerPC::ppcState).LSQE == 0) { @@ -320,7 +320,7 @@ void Interpreter::psq_l(UGeckoInstruction inst) Helper_Dequantize(&PowerPC::ppcState, EA, inst.I, inst.RD, inst.W); } -void Interpreter::psq_lu(UGeckoInstruction inst) +void Interpreter::psq_lu(Interpreter& interpreter, UGeckoInstruction inst) { if (HID2(PowerPC::ppcState).LSQE == 0) { @@ -339,7 +339,7 @@ void Interpreter::psq_lu(UGeckoInstruction inst) PowerPC::ppcState.gpr[inst.RA] = EA; } -void Interpreter::psq_st(UGeckoInstruction inst) +void Interpreter::psq_st(Interpreter& interpreter, UGeckoInstruction inst) { if (HID2(PowerPC::ppcState).LSQE == 0) { @@ -351,7 +351,7 @@ void Interpreter::psq_st(UGeckoInstruction inst) Helper_Quantize(&PowerPC::ppcState, EA, inst.I, inst.RS, inst.W); } -void Interpreter::psq_stu(UGeckoInstruction inst) +void Interpreter::psq_stu(Interpreter& interpreter, UGeckoInstruction inst) { if (HID2(PowerPC::ppcState).LSQE == 0) { @@ -370,21 +370,21 @@ void Interpreter::psq_stu(UGeckoInstruction inst) PowerPC::ppcState.gpr[inst.RA] = EA; } -void Interpreter::psq_lx(UGeckoInstruction inst) +void Interpreter::psq_lx(Interpreter& interpreter, UGeckoInstruction inst) { const u32 EA = inst.RA ? (PowerPC::ppcState.gpr[inst.RA] + PowerPC::ppcState.gpr[inst.RB]) : PowerPC::ppcState.gpr[inst.RB]; Helper_Dequantize(&PowerPC::ppcState, EA, inst.Ix, inst.RD, inst.Wx); } -void Interpreter::psq_stx(UGeckoInstruction inst) +void Interpreter::psq_stx(Interpreter& interpreter, UGeckoInstruction inst) { const u32 EA = inst.RA ? (PowerPC::ppcState.gpr[inst.RA] + PowerPC::ppcState.gpr[inst.RB]) : PowerPC::ppcState.gpr[inst.RB]; Helper_Quantize(&PowerPC::ppcState, EA, inst.Ix, inst.RS, inst.Wx); } -void Interpreter::psq_lux(UGeckoInstruction inst) +void Interpreter::psq_lux(Interpreter& interpreter, UGeckoInstruction inst) { const u32 EA = PowerPC::ppcState.gpr[inst.RA] + PowerPC::ppcState.gpr[inst.RB]; Helper_Dequantize(&PowerPC::ppcState, EA, inst.Ix, inst.RD, inst.Wx); @@ -397,7 +397,7 @@ void Interpreter::psq_lux(UGeckoInstruction inst) PowerPC::ppcState.gpr[inst.RA] = EA; } -void Interpreter::psq_stux(UGeckoInstruction inst) +void Interpreter::psq_stux(Interpreter& interpreter, UGeckoInstruction inst) { const u32 EA = PowerPC::ppcState.gpr[inst.RA] + PowerPC::ppcState.gpr[inst.RB]; Helper_Quantize(&PowerPC::ppcState, EA, inst.Ix, inst.RS, inst.Wx); diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Paired.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Paired.cpp index b11c9f97ea..aa9048cc29 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Paired.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Paired.cpp @@ -11,7 +11,7 @@ #include "Core/PowerPC/PowerPC.h" // These "binary instructions" do not alter FPSCR. -void Interpreter::ps_sel(UGeckoInstruction inst) +void Interpreter::ps_sel(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -25,7 +25,7 @@ void Interpreter::ps_sel(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::ps_neg(UGeckoInstruction inst) +void Interpreter::ps_neg(Interpreter& interpreter, UGeckoInstruction inst) { const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -36,7 +36,7 @@ void Interpreter::ps_neg(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::ps_mr(UGeckoInstruction inst) +void Interpreter::ps_mr(Interpreter& interpreter, UGeckoInstruction inst) { PowerPC::ppcState.ps[inst.FD] = PowerPC::ppcState.ps[inst.FB]; @@ -44,7 +44,7 @@ void Interpreter::ps_mr(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::ps_nabs(UGeckoInstruction inst) +void Interpreter::ps_nabs(Interpreter& interpreter, UGeckoInstruction inst) { const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -55,7 +55,7 @@ void Interpreter::ps_nabs(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::ps_abs(UGeckoInstruction inst) +void Interpreter::ps_abs(Interpreter& interpreter, UGeckoInstruction inst) { const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -67,7 +67,7 @@ void Interpreter::ps_abs(UGeckoInstruction inst) } // These are just moves, double is OK. -void Interpreter::ps_merge00(UGeckoInstruction inst) +void Interpreter::ps_merge00(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -78,7 +78,7 @@ void Interpreter::ps_merge00(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::ps_merge01(UGeckoInstruction inst) +void Interpreter::ps_merge01(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -89,7 +89,7 @@ void Interpreter::ps_merge01(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::ps_merge10(UGeckoInstruction inst) +void Interpreter::ps_merge10(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -100,7 +100,7 @@ void Interpreter::ps_merge10(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::ps_merge11(UGeckoInstruction inst) +void Interpreter::ps_merge11(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -112,7 +112,7 @@ void Interpreter::ps_merge11(UGeckoInstruction inst) } // From here on, the real deal. -void Interpreter::ps_div(UGeckoInstruction inst) +void Interpreter::ps_div(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -131,7 +131,7 @@ void Interpreter::ps_div(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::ps_res(UGeckoInstruction inst) +void Interpreter::ps_res(Interpreter& interpreter, UGeckoInstruction inst) { // this code is based on the real hardware tests const double a = PowerPC::ppcState.ps[inst.FB].PS0AsDouble(); @@ -159,7 +159,7 @@ void Interpreter::ps_res(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::ps_rsqrte(UGeckoInstruction inst) +void Interpreter::ps_rsqrte(Interpreter& interpreter, UGeckoInstruction inst) { const double ps0 = PowerPC::ppcState.ps[inst.FB].PS0AsDouble(); const double ps1 = PowerPC::ppcState.ps[inst.FB].PS1AsDouble(); @@ -194,7 +194,7 @@ void Interpreter::ps_rsqrte(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::ps_sub(UGeckoInstruction inst) +void Interpreter::ps_sub(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -213,7 +213,7 @@ void Interpreter::ps_sub(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::ps_add(UGeckoInstruction inst) +void Interpreter::ps_add(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -232,7 +232,7 @@ void Interpreter::ps_add(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::ps_mul(UGeckoInstruction inst) +void Interpreter::ps_mul(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& c = PowerPC::ppcState.ps[inst.FC]; @@ -252,7 +252,7 @@ void Interpreter::ps_mul(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::ps_msub(UGeckoInstruction inst) +void Interpreter::ps_msub(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -275,7 +275,7 @@ void Interpreter::ps_msub(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::ps_madd(UGeckoInstruction inst) +void Interpreter::ps_madd(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -298,7 +298,7 @@ void Interpreter::ps_madd(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::ps_nmsub(UGeckoInstruction inst) +void Interpreter::ps_nmsub(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -324,7 +324,7 @@ void Interpreter::ps_nmsub(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::ps_nmadd(UGeckoInstruction inst) +void Interpreter::ps_nmadd(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -350,7 +350,7 @@ void Interpreter::ps_nmadd(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::ps_sum0(UGeckoInstruction inst) +void Interpreter::ps_sum0(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -368,7 +368,7 @@ void Interpreter::ps_sum0(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::ps_sum1(UGeckoInstruction inst) +void Interpreter::ps_sum1(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -386,7 +386,7 @@ void Interpreter::ps_sum1(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::ps_muls0(UGeckoInstruction inst) +void Interpreter::ps_muls0(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& c = PowerPC::ppcState.ps[inst.FC]; @@ -404,7 +404,7 @@ void Interpreter::ps_muls0(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::ps_muls1(UGeckoInstruction inst) +void Interpreter::ps_muls1(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& c = PowerPC::ppcState.ps[inst.FC]; @@ -422,7 +422,7 @@ void Interpreter::ps_muls1(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::ps_madds0(UGeckoInstruction inst) +void Interpreter::ps_madds0(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -443,7 +443,7 @@ void Interpreter::ps_madds0(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::ps_madds1(UGeckoInstruction inst) +void Interpreter::ps_madds1(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -464,7 +464,7 @@ void Interpreter::ps_madds1(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::ps_cmpu0(UGeckoInstruction inst) +void Interpreter::ps_cmpu0(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -472,7 +472,7 @@ void Interpreter::ps_cmpu0(UGeckoInstruction inst) Helper_FloatCompareUnordered(inst, a.PS0AsDouble(), b.PS0AsDouble()); } -void Interpreter::ps_cmpo0(UGeckoInstruction inst) +void Interpreter::ps_cmpo0(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -480,7 +480,7 @@ void Interpreter::ps_cmpo0(UGeckoInstruction inst) Helper_FloatCompareOrdered(inst, a.PS0AsDouble(), b.PS0AsDouble()); } -void Interpreter::ps_cmpu1(UGeckoInstruction inst) +void Interpreter::ps_cmpu1(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& b = PowerPC::ppcState.ps[inst.FB]; @@ -488,7 +488,7 @@ void Interpreter::ps_cmpu1(UGeckoInstruction inst) Helper_FloatCompareUnordered(inst, a.PS1AsDouble(), b.PS1AsDouble()); } -void Interpreter::ps_cmpo1(UGeckoInstruction inst) +void Interpreter::ps_cmpo1(Interpreter& interpreter, UGeckoInstruction inst) { const auto& a = PowerPC::ppcState.ps[inst.FA]; const auto& b = PowerPC::ppcState.ps[inst.FB]; diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp index f5bae2e719..3d00d01b29 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp @@ -32,7 +32,7 @@ static void FPSCRUpdated(UReg_FPSCR* fpscr) PowerPC::RoundingModeUpdated(); } -void Interpreter::mtfsb0x(UGeckoInstruction inst) +void Interpreter::mtfsb0x(Interpreter& interpreter, UGeckoInstruction inst) { u32 b = 0x80000000 >> inst.CRBD; @@ -44,7 +44,7 @@ void Interpreter::mtfsb0x(UGeckoInstruction inst) } // This instruction can affect FX -void Interpreter::mtfsb1x(UGeckoInstruction inst) +void Interpreter::mtfsb1x(Interpreter& interpreter, UGeckoInstruction inst) { const u32 bit = inst.CRBD; const u32 b = 0x80000000 >> bit; @@ -60,7 +60,7 @@ void Interpreter::mtfsb1x(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::mtfsfix(UGeckoInstruction inst) +void Interpreter::mtfsfix(Interpreter& interpreter, UGeckoInstruction inst) { const u32 field = inst.CRFD; const u32 pre_shifted_mask = 0xF0000000; @@ -75,7 +75,7 @@ void Interpreter::mtfsfix(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::mtfsfx(UGeckoInstruction inst) +void Interpreter::mtfsfx(Interpreter& interpreter, UGeckoInstruction inst) { const u32 fm = inst.FM; u32 m = 0; @@ -93,19 +93,19 @@ void Interpreter::mtfsfx(UGeckoInstruction inst) PowerPC::ppcState.UpdateCR1(); } -void Interpreter::mcrxr(UGeckoInstruction inst) +void Interpreter::mcrxr(Interpreter& interpreter, UGeckoInstruction inst) { PowerPC::ppcState.cr.SetField(inst.CRFD, PowerPC::ppcState.GetXER().Hex >> 28); PowerPC::ppcState.xer_ca = 0; PowerPC::ppcState.xer_so_ov = 0; } -void Interpreter::mfcr(UGeckoInstruction inst) +void Interpreter::mfcr(Interpreter& interpreter, UGeckoInstruction inst) { PowerPC::ppcState.gpr[inst.RD] = PowerPC::ppcState.cr.Get(); } -void Interpreter::mtcrf(UGeckoInstruction inst) +void Interpreter::mtcrf(Interpreter& interpreter, UGeckoInstruction inst) { const u32 crm = inst.CRM; if (crm == 0xFF) @@ -127,7 +127,7 @@ void Interpreter::mtcrf(UGeckoInstruction inst) } } -void Interpreter::mfmsr(UGeckoInstruction inst) +void Interpreter::mfmsr(Interpreter& interpreter, UGeckoInstruction inst) { if (PowerPC::ppcState.msr.PR) { @@ -138,7 +138,7 @@ void Interpreter::mfmsr(UGeckoInstruction inst) PowerPC::ppcState.gpr[inst.RD] = PowerPC::ppcState.msr.Hex; } -void Interpreter::mfsr(UGeckoInstruction inst) +void Interpreter::mfsr(Interpreter& interpreter, UGeckoInstruction inst) { if (PowerPC::ppcState.msr.PR) { @@ -149,7 +149,7 @@ void Interpreter::mfsr(UGeckoInstruction inst) PowerPC::ppcState.gpr[inst.RD] = PowerPC::ppcState.sr[inst.SR]; } -void Interpreter::mfsrin(UGeckoInstruction inst) +void Interpreter::mfsrin(Interpreter& interpreter, UGeckoInstruction inst) { if (PowerPC::ppcState.msr.PR) { @@ -161,7 +161,7 @@ void Interpreter::mfsrin(UGeckoInstruction inst) PowerPC::ppcState.gpr[inst.RD] = PowerPC::ppcState.sr[index]; } -void Interpreter::mtmsr(UGeckoInstruction inst) +void Interpreter::mtmsr(Interpreter& interpreter, UGeckoInstruction inst) { if (PowerPC::ppcState.msr.PR) { @@ -180,7 +180,7 @@ void Interpreter::mtmsr(UGeckoInstruction inst) // Segment registers. MMU control. -void Interpreter::mtsr(UGeckoInstruction inst) +void Interpreter::mtsr(Interpreter& interpreter, UGeckoInstruction inst) { if (PowerPC::ppcState.msr.PR) { @@ -193,7 +193,7 @@ void Interpreter::mtsr(UGeckoInstruction inst) PowerPC::ppcState.SetSR(index, value); } -void Interpreter::mtsrin(UGeckoInstruction inst) +void Interpreter::mtsrin(Interpreter& interpreter, UGeckoInstruction inst) { if (PowerPC::ppcState.msr.PR) { @@ -206,14 +206,14 @@ void Interpreter::mtsrin(UGeckoInstruction inst) PowerPC::ppcState.SetSR(index, value); } -void Interpreter::mftb(UGeckoInstruction inst) +void Interpreter::mftb(Interpreter& interpreter, UGeckoInstruction inst) { [[maybe_unused]] const u32 index = (inst.TBR >> 5) | ((inst.TBR & 0x1F) << 5); DEBUG_ASSERT_MSG(POWERPC, (index == SPR_TL) || (index == SPR_TU), "Invalid mftb"); - mfspr(inst); + mfspr(interpreter, inst); } -void Interpreter::mfspr(UGeckoInstruction inst) +void Interpreter::mfspr(Interpreter& interpreter, UGeckoInstruction inst) { const u32 index = ((inst.SPR & 0x1F) << 5) + ((inst.SPR >> 5) & 0x1F); @@ -284,7 +284,7 @@ void Interpreter::mfspr(UGeckoInstruction inst) PowerPC::ppcState.gpr[inst.RD] = PowerPC::ppcState.spr[index]; } -void Interpreter::mtspr(UGeckoInstruction inst) +void Interpreter::mtspr(Interpreter& interpreter, UGeckoInstruction inst) { const u32 index = (inst.SPRU << 5) | (inst.SPRL & 0x1F); @@ -513,7 +513,7 @@ void Interpreter::mtspr(UGeckoInstruction inst) } } -void Interpreter::crand(UGeckoInstruction inst) +void Interpreter::crand(Interpreter& interpreter, UGeckoInstruction inst) { const u32 a = PowerPC::ppcState.cr.GetBit(inst.CRBA); const u32 b = PowerPC::ppcState.cr.GetBit(inst.CRBB); @@ -521,7 +521,7 @@ void Interpreter::crand(UGeckoInstruction inst) PowerPC::ppcState.cr.SetBit(inst.CRBD, a & b); } -void Interpreter::crandc(UGeckoInstruction inst) +void Interpreter::crandc(Interpreter& interpreter, UGeckoInstruction inst) { const u32 a = PowerPC::ppcState.cr.GetBit(inst.CRBA); const u32 b = PowerPC::ppcState.cr.GetBit(inst.CRBB); @@ -529,7 +529,7 @@ void Interpreter::crandc(UGeckoInstruction inst) PowerPC::ppcState.cr.SetBit(inst.CRBD, a & (1 ^ b)); } -void Interpreter::creqv(UGeckoInstruction inst) +void Interpreter::creqv(Interpreter& interpreter, UGeckoInstruction inst) { const u32 a = PowerPC::ppcState.cr.GetBit(inst.CRBA); const u32 b = PowerPC::ppcState.cr.GetBit(inst.CRBB); @@ -537,7 +537,7 @@ void Interpreter::creqv(UGeckoInstruction inst) PowerPC::ppcState.cr.SetBit(inst.CRBD, 1 ^ (a ^ b)); } -void Interpreter::crnand(UGeckoInstruction inst) +void Interpreter::crnand(Interpreter& interpreter, UGeckoInstruction inst) { const u32 a = PowerPC::ppcState.cr.GetBit(inst.CRBA); const u32 b = PowerPC::ppcState.cr.GetBit(inst.CRBB); @@ -545,7 +545,7 @@ void Interpreter::crnand(UGeckoInstruction inst) PowerPC::ppcState.cr.SetBit(inst.CRBD, 1 ^ (a & b)); } -void Interpreter::crnor(UGeckoInstruction inst) +void Interpreter::crnor(Interpreter& interpreter, UGeckoInstruction inst) { const u32 a = PowerPC::ppcState.cr.GetBit(inst.CRBA); const u32 b = PowerPC::ppcState.cr.GetBit(inst.CRBB); @@ -553,7 +553,7 @@ void Interpreter::crnor(UGeckoInstruction inst) PowerPC::ppcState.cr.SetBit(inst.CRBD, 1 ^ (a | b)); } -void Interpreter::cror(UGeckoInstruction inst) +void Interpreter::cror(Interpreter& interpreter, UGeckoInstruction inst) { const u32 a = PowerPC::ppcState.cr.GetBit(inst.CRBA); const u32 b = PowerPC::ppcState.cr.GetBit(inst.CRBB); @@ -561,7 +561,7 @@ void Interpreter::cror(UGeckoInstruction inst) PowerPC::ppcState.cr.SetBit(inst.CRBD, a | b); } -void Interpreter::crorc(UGeckoInstruction inst) +void Interpreter::crorc(Interpreter& interpreter, UGeckoInstruction inst) { const u32 a = PowerPC::ppcState.cr.GetBit(inst.CRBA); const u32 b = PowerPC::ppcState.cr.GetBit(inst.CRBB); @@ -569,7 +569,7 @@ void Interpreter::crorc(UGeckoInstruction inst) PowerPC::ppcState.cr.SetBit(inst.CRBD, a | (1 ^ b)); } -void Interpreter::crxor(UGeckoInstruction inst) +void Interpreter::crxor(Interpreter& interpreter, UGeckoInstruction inst) { const u32 a = PowerPC::ppcState.cr.GetBit(inst.CRBA); const u32 b = PowerPC::ppcState.cr.GetBit(inst.CRBB); @@ -577,20 +577,20 @@ void Interpreter::crxor(UGeckoInstruction inst) PowerPC::ppcState.cr.SetBit(inst.CRBD, a ^ b); } -void Interpreter::mcrf(UGeckoInstruction inst) +void Interpreter::mcrf(Interpreter& interpreter, UGeckoInstruction inst) { const u32 cr_f = PowerPC::ppcState.cr.GetField(inst.CRFS); PowerPC::ppcState.cr.SetField(inst.CRFD, cr_f); } -void Interpreter::isync(UGeckoInstruction inst) +void Interpreter::isync(Interpreter& interpreter, UGeckoInstruction inst) { // shouldn't do anything } // the following commands read from FPSCR -void Interpreter::mcrfs(UGeckoInstruction inst) +void Interpreter::mcrfs(Interpreter& interpreter, UGeckoInstruction inst) { const u32 shift = 4 * (7 - inst.CRFS); const u32 fpflags = (PowerPC::ppcState.fpscr.Hex >> shift) & 0xF; @@ -602,7 +602,7 @@ void Interpreter::mcrfs(UGeckoInstruction inst) PowerPC::ppcState.cr.SetField(inst.CRFD, fpflags); } -void Interpreter::mffsx(UGeckoInstruction inst) +void Interpreter::mffsx(Interpreter& interpreter, UGeckoInstruction inst) { PowerPC::ppcState.ps[inst.FD].SetPS0(UINT64_C(0xFFF8000000000000) | PowerPC::ppcState.fpscr.Hex); diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Tables.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Tables.cpp index f85c5570e9..44ac712896 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Tables.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Tables.cpp @@ -468,29 +468,29 @@ Interpreter::Instruction Interpreter::GetInterpreterOp(UGeckoInstruction inst) return result; } -void Interpreter::RunInterpreterOp(UGeckoInstruction inst) +void Interpreter::RunInterpreterOp(Interpreter& interpreter, UGeckoInstruction inst) { // Will handle subtables using RunTable4 etc. - s_interpreter_op_table[inst.OPCD](inst); + s_interpreter_op_table[inst.OPCD](interpreter, inst); } -void Interpreter::RunTable4(UGeckoInstruction inst) +void Interpreter::RunTable4(Interpreter& interpreter, UGeckoInstruction inst) { - s_interpreter_op_table4[inst.SUBOP10](inst); + s_interpreter_op_table4[inst.SUBOP10](interpreter, inst); } -void Interpreter::RunTable19(UGeckoInstruction inst) +void Interpreter::RunTable19(Interpreter& interpreter, UGeckoInstruction inst) { - s_interpreter_op_table19[inst.SUBOP10](inst); + s_interpreter_op_table19[inst.SUBOP10](interpreter, inst); } -void Interpreter::RunTable31(UGeckoInstruction inst) +void Interpreter::RunTable31(Interpreter& interpreter, UGeckoInstruction inst) { - s_interpreter_op_table31[inst.SUBOP10](inst); + s_interpreter_op_table31[inst.SUBOP10](interpreter, inst); } -void Interpreter::RunTable59(UGeckoInstruction inst) +void Interpreter::RunTable59(Interpreter& interpreter, UGeckoInstruction inst) { - s_interpreter_op_table59[inst.SUBOP5](inst); + s_interpreter_op_table59[inst.SUBOP5](interpreter, inst); } -void Interpreter::RunTable63(UGeckoInstruction inst) +void Interpreter::RunTable63(Interpreter& interpreter, UGeckoInstruction inst) { - s_interpreter_op_table63[inst.SUBOP10](inst); + s_interpreter_op_table63[inst.SUBOP10](interpreter, inst); } diff --git a/Source/Core/Core/PowerPC/Jit64/Jit.cpp b/Source/Core/Core/PowerPC/Jit64/Jit.cpp index 6d287a9a5c..3a97cf3711 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit.cpp @@ -344,7 +344,7 @@ void Jit64::FallBackToInterpreter(UGeckoInstruction inst) Interpreter::Instruction instr = Interpreter::GetInterpreterOp(inst); ABI_PushRegistersAndAdjustStack({}, 0); - ABI_CallFunctionC(instr, inst.hex); + ABI_CallFunctionPC(instr, Interpreter::getInstance(), inst.hex); ABI_PopRegistersAndAdjustStack({}, 0); // If the instruction wrote to any registers which were marked as discarded, diff --git a/Source/Core/Core/PowerPC/JitArm64/Jit.cpp b/Source/Core/Core/PowerPC/JitArm64/Jit.cpp index 57fa29e2e3..65e454b21a 100644 --- a/Source/Core/Core/PowerPC/JitArm64/Jit.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/Jit.cpp @@ -199,7 +199,8 @@ void JitArm64::FallBackToInterpreter(UGeckoInstruction inst) Interpreter::Instruction instr = Interpreter::GetInterpreterOp(inst); MOVP2R(ARM64Reg::X8, instr); - MOVI2R(ARM64Reg::W0, inst.hex); + MOVP2R(ARM64Reg::W0, Interpreter::getInstance()); + MOVI2R(ARM64Reg::W1, inst.hex); BLR(ARM64Reg::X8); // If the instruction wrote to any registers which were marked as discarded,