Core: Make R4300iOp opcodes not static

This commit is contained in:
zilmar 2023-10-19 11:43:32 +10:30
parent 7f42f70283
commit ae0097550f
8 changed files with 919 additions and 930 deletions

File diff suppressed because it is too large Load Diff

View File

@ -19,223 +19,12 @@ public:
void ExecuteCPU(); void ExecuteCPU();
void ExecuteOps(int32_t Cycles); void ExecuteOps(int32_t Cycles);
static void InPermLoop(); void InPermLoop();
typedef void (*Func)(); R4300iOpcode Opcode(void) const
{
// Opcode functions return m_Opcode;
static void J(); }
static void JAL();
static void BNE();
static void BEQ();
static void BLEZ();
static void BGTZ();
static void ADDI();
static void ADDIU();
static void SLTI();
static void SLTIU();
static void ANDI();
static void ORI();
static void XORI();
static void LUI();
static void BEQL();
static void BNEL();
static void BLEZL();
static void BGTZL();
static void DADDI();
static void DADDIU();
static void LDL();
static void LDR();
static void LB();
static void LH();
static void LWL();
static void LW();
static void LBU();
static void LHU();
static void LWR();
static void LWU();
static void SB();
static void SH();
static void SWL();
static void SW();
static void SDL();
static void SDR();
static void SWR();
static void CACHE();
static void LL();
static void LWC1();
static void LLD();
static void LDC1();
static void LD();
static void SC();
static void SWC1();
static void SDC1();
static void SD();
// R4300i opcodes: Special
static void SPECIAL_SLL();
static void SPECIAL_SRL();
static void SPECIAL_SRA();
static void SPECIAL_SLLV();
static void SPECIAL_SRLV();
static void SPECIAL_SRAV();
static void SPECIAL_JR();
static void SPECIAL_JALR();
static void SPECIAL_SYSCALL();
static void SPECIAL_BREAK();
static void SPECIAL_SYNC();
static void SPECIAL_MFHI();
static void SPECIAL_MTHI();
static void SPECIAL_MFLO();
static void SPECIAL_MTLO();
static void SPECIAL_DSLLV();
static void SPECIAL_DSRLV();
static void SPECIAL_DSRAV();
static void SPECIAL_MULT();
static void SPECIAL_MULTU();
static void SPECIAL_DIV();
static void SPECIAL_DIVU();
static void SPECIAL_DMULT();
static void SPECIAL_DMULTU();
static void SPECIAL_DDIV();
static void SPECIAL_DDIVU();
static void SPECIAL_ADD();
static void SPECIAL_ADDU();
static void SPECIAL_SUB();
static void SPECIAL_SUBU();
static void SPECIAL_AND();
static void SPECIAL_OR();
static void SPECIAL_XOR();
static void SPECIAL_NOR();
static void SPECIAL_SLT();
static void SPECIAL_SLTU();
static void SPECIAL_DADD();
static void SPECIAL_DADDU();
static void SPECIAL_DSUB();
static void SPECIAL_DSUBU();
static void SPECIAL_TGE();
static void SPECIAL_TGEU();
static void SPECIAL_TLT();
static void SPECIAL_TLTU();
static void SPECIAL_TEQ();
static void SPECIAL_TNE();
static void SPECIAL_DSLL();
static void SPECIAL_DSRL();
static void SPECIAL_DSRA();
static void SPECIAL_DSLL32();
static void SPECIAL_DSRL32();
static void SPECIAL_DSRA32();
// R4300i opcodes: RegImm
static void REGIMM_BLTZ();
static void REGIMM_BGEZ();
static void REGIMM_BLTZL();
static void REGIMM_BGEZL();
static void REGIMM_BLTZAL();
static void REGIMM_BGEZAL();
static void REGIMM_BGEZALL();
static void REGIMM_TEQI();
static void REGIMM_TGEI();
static void REGIMM_TGEIU();
static void REGIMM_TLTI();
static void REGIMM_TLTIU();
static void REGIMM_TNEI();
// COP0 functions
static void COP0_MF();
static void COP0_DMF();
static void COP0_MT();
static void COP0_DMT();
// COP0 CO functions
static void COP0_CO_TLBR();
static void COP0_CO_TLBWI();
static void COP0_CO_TLBWR();
static void COP0_CO_TLBP();
static void COP0_CO_ERET();
// COP1 functions
static void CPO1_UNIMPLEMENTED_OP(void);
static void COP1_MF();
static void COP1_DMF();
static void COP1_CF();
static void COP1_MT();
static void COP1_DMT();
static void COP1_CT();
// COP1: BC1 functions
static void COP1_BCF();
static void COP1_BCT();
static void COP1_BCFL();
static void COP1_BCTL();
// COP1: S functions
static void COP1_S_ADD();
static void COP1_S_SUB();
static void COP1_S_MUL();
static void COP1_S_DIV();
static void COP1_S_SQRT();
static void COP1_S_ABS();
static void COP1_S_MOV();
static void COP1_S_NEG();
static void COP1_S_ROUND_L();
static void COP1_S_TRUNC_L();
static void COP1_S_CEIL_L();
static void COP1_S_FLOOR_L();
static void COP1_S_ROUND_W();
static void COP1_S_TRUNC_W();
static void COP1_S_CEIL_W();
static void COP1_S_FLOOR_W();
static void COP1_S_CVT_D();
static void COP1_S_CVT_W();
static void COP1_S_CVT_L();
static void COP1_S_CMP();
// COP1: D functions
static void COP1_D_ADD();
static void COP1_D_SUB();
static void COP1_D_MUL();
static void COP1_D_DIV();
static void COP1_D_SQRT();
static void COP1_D_ABS();
static void COP1_D_MOV();
static void COP1_D_NEG();
static void COP1_D_ROUND_L();
static void COP1_D_TRUNC_L();
static void COP1_D_CEIL_L();
static void COP1_D_FLOOR_L();
static void COP1_D_ROUND_W();
static void COP1_D_TRUNC_W();
static void COP1_D_CEIL_W();
static void COP1_D_FLOOR_W();
static void COP1_D_CVT_S();
static void COP1_D_CVT_W();
static void COP1_D_CVT_L();
static void COP1_D_CMP();
// COP1: W functions
static void COP1_W_CVT_S();
static void COP1_W_CVT_D();
// COP1: L functions
static void COP1_L_CVT_S();
static void COP1_L_CVT_D();
// COP2 functions
static void CPO2_INVALID_OP(void);
static void COP2_MF();
static void COP2_DMF();
static void COP2_CF();
static void COP2_MT();
static void COP2_DMT();
static void COP2_CT();
// Other functions
static void ReservedInstruction();
static void UnknownOpcode();
static bool m_TestTimer;
static R4300iOpcode m_Opcode;
private: private:
R4300iOp(const R4300iOp &); R4300iOp(const R4300iOp &);
@ -243,31 +32,246 @@ private:
void BuildInterpreter(void); void BuildInterpreter(void);
static void SPECIAL(); typedef void (R4300iOp::*Func)();
static void REGIMM();
static void COP0();
static void COP0_CO();
static void COP1();
static void COP2();
static void COP3();
static void COP1_BC();
static void COP1_S();
static void COP1_D();
static void COP1_W();
static void COP1_L();
static Func Jump_Opcode[64]; void SPECIAL();
static Func Jump_Special[64]; void REGIMM();
static Func Jump_Regimm[32]; void COP0();
static Func Jump_CoP0[32]; void COP0_CO();
static Func Jump_CoP0_Function[64]; void COP1();
static Func Jump_CoP1[32]; void COP2();
static Func Jump_CoP1_BC[32]; void COP3();
static Func Jump_CoP1_S[64]; void COP1_BC();
static Func Jump_CoP1_D[64]; void COP1_S();
static Func Jump_CoP1_W[64]; void COP1_D();
static Func Jump_CoP1_L[64]; void COP1_W();
static Func Jump_CoP2[32]; void COP1_L();
// Opcode functions
void J();
void JAL();
void BNE();
void BEQ();
void BLEZ();
void BGTZ();
void ADDI();
void ADDIU();
void SLTI();
void SLTIU();
void ANDI();
void ORI();
void XORI();
void LUI();
void BEQL();
void BNEL();
void BLEZL();
void BGTZL();
void DADDI();
void DADDIU();
void LDL();
void LDR();
void LB();
void LH();
void LWL();
void LW();
void LBU();
void LHU();
void LWR();
void LWU();
void SB();
void SH();
void SWL();
void SW();
void SDL();
void SDR();
void SWR();
void CACHE();
void LL();
void LWC1();
void LLD();
void LDC1();
void LD();
void SC();
void SWC1();
void SDC1();
void SD();
// R4300i opcodes: Special
void SPECIAL_SLL();
void SPECIAL_SRL();
void SPECIAL_SRA();
void SPECIAL_SLLV();
void SPECIAL_SRLV();
void SPECIAL_SRAV();
void SPECIAL_JR();
void SPECIAL_JALR();
void SPECIAL_SYSCALL();
void SPECIAL_BREAK();
void SPECIAL_SYNC();
void SPECIAL_MFHI();
void SPECIAL_MTHI();
void SPECIAL_MFLO();
void SPECIAL_MTLO();
void SPECIAL_DSLLV();
void SPECIAL_DSRLV();
void SPECIAL_DSRAV();
void SPECIAL_MULT();
void SPECIAL_MULTU();
void SPECIAL_DIV();
void SPECIAL_DIVU();
void SPECIAL_DMULT();
void SPECIAL_DMULTU();
void SPECIAL_DDIV();
void SPECIAL_DDIVU();
void SPECIAL_ADD();
void SPECIAL_ADDU();
void SPECIAL_SUB();
void SPECIAL_SUBU();
void SPECIAL_AND();
void SPECIAL_OR();
void SPECIAL_XOR();
void SPECIAL_NOR();
void SPECIAL_SLT();
void SPECIAL_SLTU();
void SPECIAL_DADD();
void SPECIAL_DADDU();
void SPECIAL_DSUB();
void SPECIAL_DSUBU();
void SPECIAL_TGE();
void SPECIAL_TGEU();
void SPECIAL_TLT();
void SPECIAL_TLTU();
void SPECIAL_TEQ();
void SPECIAL_TNE();
void SPECIAL_DSLL();
void SPECIAL_DSRL();
void SPECIAL_DSRA();
void SPECIAL_DSLL32();
void SPECIAL_DSRL32();
void SPECIAL_DSRA32();
// R4300i opcodes: RegImm
void REGIMM_BLTZ();
void REGIMM_BGEZ();
void REGIMM_BLTZL();
void REGIMM_BGEZL();
void REGIMM_BLTZAL();
void REGIMM_BGEZAL();
void REGIMM_BGEZALL();
void REGIMM_TEQI();
void REGIMM_TGEI();
void REGIMM_TGEIU();
void REGIMM_TLTI();
void REGIMM_TLTIU();
void REGIMM_TNEI();
// COP0 functions
void COP0_MF();
void COP0_DMF();
void COP0_MT();
void COP0_DMT();
// COP0 CO functions
void COP0_CO_TLBR();
void COP0_CO_TLBWI();
void COP0_CO_TLBWR();
void COP0_CO_TLBP();
void COP0_CO_ERET();
// COP1 functions
void CPO1_UNIMPLEMENTED_OP(void);
void COP1_MF();
void COP1_DMF();
void COP1_CF();
void COP1_MT();
void COP1_DMT();
void COP1_CT();
// COP1: BC1 functions
void COP1_BCF();
void COP1_BCT();
void COP1_BCFL();
void COP1_BCTL();
// COP1: S functions
void COP1_S_ADD();
void COP1_S_SUB();
void COP1_S_MUL();
void COP1_S_DIV();
void COP1_S_SQRT();
void COP1_S_ABS();
void COP1_S_MOV();
void COP1_S_NEG();
void COP1_S_ROUND_L();
void COP1_S_TRUNC_L();
void COP1_S_CEIL_L();
void COP1_S_FLOOR_L();
void COP1_S_ROUND_W();
void COP1_S_TRUNC_W();
void COP1_S_CEIL_W();
void COP1_S_FLOOR_W();
void COP1_S_CVT_D();
void COP1_S_CVT_W();
void COP1_S_CVT_L();
void COP1_S_CMP();
// COP1: D functions
void COP1_D_ADD();
void COP1_D_SUB();
void COP1_D_MUL();
void COP1_D_DIV();
void COP1_D_SQRT();
void COP1_D_ABS();
void COP1_D_MOV();
void COP1_D_NEG();
void COP1_D_ROUND_L();
void COP1_D_TRUNC_L();
void COP1_D_CEIL_L();
void COP1_D_FLOOR_L();
void COP1_D_ROUND_W();
void COP1_D_TRUNC_W();
void COP1_D_CEIL_W();
void COP1_D_FLOOR_W();
void COP1_D_CVT_S();
void COP1_D_CVT_W();
void COP1_D_CVT_L();
void COP1_D_CMP();
// COP1: W functions
void COP1_W_CVT_S();
void COP1_W_CVT_D();
// COP1: L functions
void COP1_L_CVT_S();
void COP1_L_CVT_D();
// COP2 functions
void CPO2_INVALID_OP(void);
void COP2_MF();
void COP2_DMF();
void COP2_CF();
void COP2_MT();
void COP2_DMT();
void COP2_CT();
// Other functions
void ReservedInstruction();
void UnknownOpcode();
R4300iOpcode m_Opcode;
Func Jump_Opcode[64];
Func Jump_Special[64];
Func Jump_Regimm[32];
Func Jump_CoP0[32];
Func Jump_CoP0_Function[64];
Func Jump_CoP1[32];
Func Jump_CoP1_BC[32];
Func Jump_CoP1_S[64];
Func Jump_CoP1_D[64];
Func Jump_CoP1_W[64];
Func Jump_CoP1_L[64];
Func Jump_CoP2[32];
static bool TestCop1UsableException(void); static bool TestCop1UsableException(void);
static bool CheckFPUInput32(const float & Value); static bool CheckFPUInput32(const float & Value);

View File

@ -964,11 +964,6 @@ bool CN64System::SetActiveSystem(bool bActive)
{ {
m_Reg.SetAsCurrentSystem(); m_Reg.SetAsCurrentSystem();
if (g_System)
{
g_System->m_TestTimer = R4300iOp::m_TestTimer;
}
g_System = this; g_System = this;
if (g_BaseSystem == this) if (g_BaseSystem == this)
{ {
@ -986,7 +981,6 @@ bool CN64System::SetActiveSystem(bool bActive)
g_TLBLoadAddress = &m_TLBLoadAddress; g_TLBLoadAddress = &m_TLBLoadAddress;
g_TLBStoreAddress = &m_TLBStoreAddress; g_TLBStoreAddress = &m_TLBStoreAddress;
g_RecompPos = m_Recomp ? m_Recomp->RecompPos() : nullptr; g_RecompPos = m_Recomp ? m_Recomp->RecompPos() : nullptr;
R4300iOp::m_TestTimer = m_TestTimer;
g_Random = &m_Random; g_Random = &m_Random;
} }
else else
@ -2321,7 +2315,7 @@ void CN64System::DelayedRelativeJump(uint32_t RelativeLocation)
if (m_Reg.m_PROGRAM_COUNTER == m_JumpToLocation) if (m_Reg.m_PROGRAM_COUNTER == m_JumpToLocation)
{ {
R4300iOpcode DelaySlot; R4300iOpcode DelaySlot;
if (m_MMU_VM.MemoryValue32(m_Reg.m_PROGRAM_COUNTER + 4, DelaySlot.Value) && !R4300iInstruction(m_Reg.m_PROGRAM_COUNTER, R4300iOp::m_Opcode.Value).DelaySlotEffectsCompare(DelaySlot.Value)) if (m_MMU_VM.MemoryValue32(m_Reg.m_PROGRAM_COUNTER + 4, DelaySlot.Value) && !R4300iInstruction(m_Reg.m_PROGRAM_COUNTER, m_OpCodes.Opcode().Value).DelaySlotEffectsCompare(DelaySlot.Value))
{ {
m_PipelineStage = PIPELINE_STAGE_PERMLOOP_DO_DELAY; m_PipelineStage = PIPELINE_STAGE_PERMLOOP_DO_DELAY;
} }

View File

@ -85,6 +85,10 @@ public:
{ {
return m_Limiter.GetBaseSpeed(); return m_Limiter.GetBaseSpeed();
} }
R4300iOpcode Opcode(void) const
{
return m_OpCodes.Opcode();
}
void Reset(bool bInitReg, bool ClearMenory); void Reset(bool bInitReg, bool ClearMenory);
void GameReset(); void GameReset();
void PluginReset(); void PluginReset();

View File

@ -78,7 +78,7 @@ void CX86RecompilerOps::x86CompilerBreakPoint()
void CX86RecompilerOps::x86BreakPointDelaySlot() void CX86RecompilerOps::x86BreakPointDelaySlot()
{ {
g_SyncSystem->m_OpCodes.ExecuteOps(g_System->CountPerOp()); g_System->m_OpCodes.ExecuteOps(g_System->CountPerOp());
if (g_SyncSystem) if (g_SyncSystem)
{ {
g_System->UpdateSyncCPU(g_SyncSystem, g_System->CountPerOp()); g_System->UpdateSyncCPU(g_SyncSystem, g_System->CountPerOp());
@ -380,51 +380,51 @@ void CX86RecompilerOps::Compile_TrapCompare(RecompilerTrapCompare CompareType)
switch (CompareType) switch (CompareType)
{ {
case RecompilerTrapCompare_TEQ: case RecompilerTrapCompare_TEQ:
FunctAddress = (uint32_t)R4300iOp::SPECIAL_TEQ; FunctAddress = AddressOf(&R4300iOp::SPECIAL_TEQ);
FunctName = "R4300iOp::SPECIAL_TEQ"; FunctName = "R4300iOp::SPECIAL_TEQ";
break; break;
case RecompilerTrapCompare_TNE: case RecompilerTrapCompare_TNE:
FunctAddress = (uint32_t)R4300iOp::SPECIAL_TNE; FunctAddress = AddressOf(&R4300iOp::SPECIAL_TNE);
FunctName = "R4300iOp::SPECIAL_TNE"; FunctName = "R4300iOp::SPECIAL_TNE";
break; break;
case RecompilerTrapCompare_TGE: case RecompilerTrapCompare_TGE:
FunctAddress = (uint32_t)R4300iOp::SPECIAL_TGE; FunctAddress = AddressOf(&R4300iOp::SPECIAL_TGE);
FunctName = "R4300iOp::SPECIAL_TGE"; FunctName = "R4300iOp::SPECIAL_TGE";
break; break;
case RecompilerTrapCompare_TGEU: case RecompilerTrapCompare_TGEU:
FunctAddress = (uint32_t)R4300iOp::SPECIAL_TGEU; FunctAddress = AddressOf(&R4300iOp::SPECIAL_TGEU);
FunctName = "R4300iOp::SPECIAL_TGEU"; FunctName = "R4300iOp::SPECIAL_TGEU";
break; break;
case RecompilerTrapCompare_TLT: case RecompilerTrapCompare_TLT:
FunctAddress = (uint32_t)R4300iOp::SPECIAL_TLT; FunctAddress = AddressOf(&R4300iOp::SPECIAL_TLT);
FunctName = "R4300iOp::SPECIAL_TLT"; FunctName = "R4300iOp::SPECIAL_TLT";
break; break;
case RecompilerTrapCompare_TLTU: case RecompilerTrapCompare_TLTU:
FunctAddress = (uint32_t)R4300iOp::SPECIAL_TLTU; FunctAddress = AddressOf(&R4300iOp::SPECIAL_TLTU);
FunctName = "R4300iOp::SPECIAL_TLTU"; FunctName = "R4300iOp::SPECIAL_TLTU";
break; break;
case RecompilerTrapCompare_TEQI: case RecompilerTrapCompare_TEQI:
FunctAddress = (uint32_t)R4300iOp::REGIMM_TEQI; FunctAddress = AddressOf(&R4300iOp::REGIMM_TEQI);
FunctName = "R4300iOp::REGIMM_TEQI"; FunctName = "R4300iOp::REGIMM_TEQI";
break; break;
case RecompilerTrapCompare_TNEI: case RecompilerTrapCompare_TNEI:
FunctAddress = (uint32_t)R4300iOp::REGIMM_TNEI; FunctAddress = AddressOf(&R4300iOp::REGIMM_TNEI);
FunctName = "R4300iOp::REGIMM_TNEI"; FunctName = "R4300iOp::REGIMM_TNEI";
break; break;
case RecompilerTrapCompare_TGEI: case RecompilerTrapCompare_TGEI:
FunctAddress = (uint32_t)R4300iOp::REGIMM_TGEI; FunctAddress = AddressOf(&R4300iOp::REGIMM_TGEI);
FunctName = "R4300iOp::REGIMM_TGEI"; FunctName = "R4300iOp::REGIMM_TGEI";
break; break;
case RecompilerTrapCompare_TGEIU: case RecompilerTrapCompare_TGEIU:
FunctAddress = (uint32_t)R4300iOp::REGIMM_TGEIU; FunctAddress = AddressOf(&R4300iOp::REGIMM_TGEIU);
FunctName = "R4300iOp::REGIMM_TGEIU"; FunctName = "R4300iOp::REGIMM_TGEIU";
break; break;
case RecompilerTrapCompare_TLTI: case RecompilerTrapCompare_TLTI:
FunctAddress = (uint32_t)R4300iOp::REGIMM_TLTI; FunctAddress = AddressOf(&R4300iOp::REGIMM_TLTI);
FunctName = "R4300iOp::REGIMM_TLTI"; FunctName = "R4300iOp::REGIMM_TLTI";
break; break;
case RecompilerTrapCompare_TLTIU: case RecompilerTrapCompare_TLTIU:
FunctAddress = (uint32_t)R4300iOp::REGIMM_TLTIU; FunctAddress = AddressOf(&R4300iOp::REGIMM_TLTIU);
FunctName = "R4300iOp::REGIMM_TLTIU"; FunctName = "R4300iOp::REGIMM_TLTIU";
break; break;
default: default:
@ -442,7 +442,8 @@ void CX86RecompilerOps::Compile_TrapCompare(RecompilerTrapCompare CompareType)
m_RegWorkingSet.UnMap_GPR(m_Opcode.rt, true); m_RegWorkingSet.UnMap_GPR(m_Opcode.rt, true);
} }
m_RegWorkingSet.BeforeCallDirect(); m_RegWorkingSet.BeforeCallDirect();
m_Assembler.MoveConstToVariable(&R4300iOp::m_Opcode.Value, "R4300iOp::m_Opcode.Value", m_Opcode.Value); m_Assembler.MoveConstToVariable(&g_System->m_OpCodes.m_Opcode.Value, "R4300iOp::m_Opcode.Value", m_Opcode.Value);
m_Assembler.CallThis((uint32_t)&g_System->m_OpCodes, FunctAddress, FunctName, 4);
m_Assembler.CallFunc(FunctAddress, FunctName); m_Assembler.CallFunc(FunctAddress, FunctName);
m_RegWorkingSet.AfterCallDirect(); m_RegWorkingSet.AfterCallDirect();
} }
@ -2908,8 +2909,8 @@ void CX86RecompilerOps::LDL()
} }
m_RegWorkingSet.BeforeCallDirect(); m_RegWorkingSet.BeforeCallDirect();
m_Assembler.MoveConstToVariable(&R4300iOp::m_Opcode.Value, "R4300iOp::m_Opcode.Value", m_Opcode.Value); m_Assembler.MoveConstToVariable(&g_System->m_OpCodes.m_Opcode.Value, "R4300iOp::m_Opcode.Value", m_Opcode.Value);
m_Assembler.CallFunc((uint32_t)R4300iOp::LDL, "R4300iOp::LDL"); m_Assembler.CallThis((uint32_t)&g_System->m_OpCodes, AddressOf(&R4300iOp::LDL), "R4300iOp::LDL", 4);
m_RegWorkingSet.AfterCallDirect(); m_RegWorkingSet.AfterCallDirect();
} }
@ -2926,8 +2927,8 @@ void CX86RecompilerOps::LDR()
} }
m_RegWorkingSet.BeforeCallDirect(); m_RegWorkingSet.BeforeCallDirect();
m_Assembler.MoveConstToVariable(&R4300iOp::m_Opcode.Value, "R4300iOp::m_Opcode.Value", m_Opcode.Value); m_Assembler.MoveConstToVariable(&g_System->m_OpCodes.m_Opcode.Value, "R4300iOp::m_Opcode.Value", m_Opcode.Value);
m_Assembler.CallFunc((uint32_t)R4300iOp::LDR, "R4300iOp::LDR"); m_Assembler.CallThis((uint32_t)&g_System->m_OpCodes, AddressOf(&R4300iOp::LDR), "R4300iOp::LDR", 4);
m_RegWorkingSet.AfterCallDirect(); m_RegWorkingSet.AfterCallDirect();
} }
@ -3943,8 +3944,8 @@ void CX86RecompilerOps::SDL()
} }
m_RegWorkingSet.BeforeCallDirect(); m_RegWorkingSet.BeforeCallDirect();
m_Assembler.MoveConstToVariable(&R4300iOp::m_Opcode.Value, "R4300iOp::m_Opcode.Value", m_Opcode.Value); m_Assembler.MoveConstToVariable(&g_System->m_OpCodes.m_Opcode.Value, "R4300iOp::m_Opcode.Value", m_Opcode.Value);
m_Assembler.CallFunc((uint32_t)R4300iOp::SDL, "R4300iOp::SDL"); m_Assembler.CallThis((uint32_t)&g_System->m_OpCodes, AddressOf(&R4300iOp::SDL), "R4300iOp::SDL", 4);
m_RegWorkingSet.AfterCallDirect(); m_RegWorkingSet.AfterCallDirect();
} }
@ -3961,8 +3962,8 @@ void CX86RecompilerOps::SDR()
} }
m_RegWorkingSet.BeforeCallDirect(); m_RegWorkingSet.BeforeCallDirect();
m_Assembler.MoveConstToVariable(&R4300iOp::m_Opcode.Value, "R4300iOp::m_Opcode.Value", m_Opcode.Value); m_Assembler.MoveConstToVariable(&g_System->m_OpCodes.m_Opcode.Value, "R4300iOp::m_Opcode.Value", m_Opcode.Value);
m_Assembler.CallFunc((uint32_t)R4300iOp::SDR, "R4300iOp::SDR"); m_Assembler.CallThis((uint32_t)&g_System->m_OpCodes, AddressOf(&R4300iOp::SDR), "R4300iOp::SDR", 4);
m_RegWorkingSet.AfterCallDirect(); m_RegWorkingSet.AfterCallDirect();
} }
@ -5197,8 +5198,8 @@ void CX86RecompilerOps::SPECIAL_DMULT()
} }
m_RegWorkingSet.BeforeCallDirect(); m_RegWorkingSet.BeforeCallDirect();
m_Assembler.MoveConstToVariable(&R4300iOp::m_Opcode.Value, "R4300iOp::m_Opcode.Value", m_Opcode.Value); m_Assembler.MoveConstToVariable(&g_System->m_OpCodes.m_Opcode.Value, "R4300iOp::m_Opcode.Value", m_Opcode.Value);
m_Assembler.CallFunc((uint32_t)R4300iOp::SPECIAL_DMULT, "R4300iOp::SPECIAL_DMULT"); m_Assembler.CallThis((uint32_t)&g_System->m_OpCodes, AddressOf(&R4300iOp::SPECIAL_DMULT), "R4300iOp::SPECIAL_DMULT", 4);
m_RegWorkingSet.AfterCallDirect(); m_RegWorkingSet.AfterCallDirect();
} }
@ -5207,8 +5208,8 @@ void CX86RecompilerOps::SPECIAL_DMULTU()
m_RegWorkingSet.UnMap_GPR(m_Opcode.rs, true); m_RegWorkingSet.UnMap_GPR(m_Opcode.rs, true);
m_RegWorkingSet.UnMap_GPR(m_Opcode.rt, true); m_RegWorkingSet.UnMap_GPR(m_Opcode.rt, true);
m_RegWorkingSet.BeforeCallDirect(); m_RegWorkingSet.BeforeCallDirect();
m_Assembler.MoveConstToVariable(&R4300iOp::m_Opcode.Value, "R4300iOp::m_Opcode.Value", m_Opcode.Value); m_Assembler.MoveConstToVariable(&g_System->m_OpCodes.m_Opcode.Value, "R4300iOp::m_Opcode.Value", m_Opcode.Value);
m_Assembler.CallFunc((uint32_t)R4300iOp::SPECIAL_DMULTU, "R4300iOp::SPECIAL_DMULTU"); m_Assembler.CallThis((uint32_t)&g_System->m_OpCodes, AddressOf(&R4300iOp::SPECIAL_DMULTU), "R4300iOp::SPECIAL_DMULTU", 4);
m_RegWorkingSet.AfterCallDirect(); m_RegWorkingSet.AfterCallDirect();
} }
@ -5217,8 +5218,8 @@ void CX86RecompilerOps::SPECIAL_DDIV()
m_RegWorkingSet.UnMap_GPR(m_Opcode.rs, true); m_RegWorkingSet.UnMap_GPR(m_Opcode.rs, true);
m_RegWorkingSet.UnMap_GPR(m_Opcode.rt, true); m_RegWorkingSet.UnMap_GPR(m_Opcode.rt, true);
m_RegWorkingSet.BeforeCallDirect(); m_RegWorkingSet.BeforeCallDirect();
m_Assembler.MoveConstToVariable(&R4300iOp::m_Opcode.Value, "R4300iOp::m_Opcode.Value", m_Opcode.Value); m_Assembler.MoveConstToVariable(&g_System->m_OpCodes.m_Opcode.Value, "R4300iOp::m_Opcode.Value", m_Opcode.Value);
m_Assembler.CallFunc((uint32_t)R4300iOp::SPECIAL_DDIV, "R4300iOp::SPECIAL_DDIV"); m_Assembler.CallThis((uint32_t)&g_System->m_OpCodes, AddressOf(&R4300iOp::SPECIAL_DDIV), "R4300iOp::SPECIAL_DDIV", 4);
m_RegWorkingSet.AfterCallDirect(); m_RegWorkingSet.AfterCallDirect();
} }
@ -5227,8 +5228,8 @@ void CX86RecompilerOps::SPECIAL_DDIVU()
m_RegWorkingSet.UnMap_GPR(m_Opcode.rs, true); m_RegWorkingSet.UnMap_GPR(m_Opcode.rs, true);
m_RegWorkingSet.UnMap_GPR(m_Opcode.rt, true); m_RegWorkingSet.UnMap_GPR(m_Opcode.rt, true);
m_RegWorkingSet.BeforeCallDirect(); m_RegWorkingSet.BeforeCallDirect();
m_Assembler.MoveConstToVariable(&R4300iOp::m_Opcode.Value, "R4300iOp::m_Opcode.Value", m_Opcode.Value); m_Assembler.MoveConstToVariable(&g_System->m_OpCodes.m_Opcode.Value, "R4300iOp::m_Opcode.Value", m_Opcode.Value);
m_Assembler.CallFunc((uint32_t)R4300iOp::SPECIAL_DDIVU, "R4300iOp::SPECIAL_DDIVU"); m_Assembler.CallThis((uint32_t)&g_System->m_OpCodes, AddressOf(&R4300iOp::SPECIAL_DDIVU), "R4300iOp::SPECIAL_DDIVU", 4);
m_RegWorkingSet.AfterCallDirect(); m_RegWorkingSet.AfterCallDirect();
} }
@ -8440,8 +8441,8 @@ void CX86RecompilerOps::UnknownOpcode()
} }
m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() - g_System->CountPerOp()); m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() - g_System->CountPerOp());
m_Assembler.MoveConstToVariable(&R4300iOp::m_Opcode.Value, "R4300iOp::m_Opcode.Value", m_Opcode.Value); m_Assembler.MoveConstToVariable(&g_System->m_OpCodes.m_Opcode.Value, "R4300iOp::m_Opcode.Value", m_Opcode.Value);
m_Assembler.CallFunc((uint32_t)R4300iOp::UnknownOpcode, "R4300iOp::UnknownOpcode"); m_Assembler.CallThis((uint32_t)&g_System->m_OpCodes, AddressOf(&R4300iOp::UnknownOpcode), "R4300iOp::UnknownOpcode", 4);
m_Assembler.ret(); m_Assembler.ret();
if (m_PipelineStage == PIPELINE_STAGE_NORMAL) if (m_PipelineStage == PIPELINE_STAGE_NORMAL)
{ {
@ -8688,7 +8689,7 @@ void CX86RecompilerOps::CompileInPermLoop(CRegInfo & RegSet, uint32_t ProgramCou
m_Assembler.MoveConstToVariable(&m_Reg.m_PROGRAM_COUNTER, "PROGRAM_COUNTER", ProgramCounter); m_Assembler.MoveConstToVariable(&m_Reg.m_PROGRAM_COUNTER, "PROGRAM_COUNTER", ProgramCounter);
RegSet.WriteBackRegisters(); RegSet.WriteBackRegisters();
UpdateCounters(RegSet, false, true, false); UpdateCounters(RegSet, false, true, false);
m_Assembler.CallFunc(AddressOf(R4300iOp::InPermLoop), "R4300iOp::InPermLoop"); m_Assembler.CallThis((uint32_t)&g_System->m_OpCodes, AddressOf(&R4300iOp::InPermLoop), "R4300iOp::InPermLoop", 4);
m_Assembler.CallThis((uint32_t)g_SystemTimer, AddressOf(&CSystemTimer::TimerDone), "CSystemTimer::TimerDone", 4); m_Assembler.CallThis((uint32_t)g_SystemTimer, AddressOf(&CSystemTimer::TimerDone), "CSystemTimer::TimerDone", 4);
m_CodeBlock.Log("CompileSystemCheck 3"); m_CodeBlock.Log("CompileSystemCheck 3");
CompileSystemCheck((uint32_t)-1, RegSet); CompileSystemCheck((uint32_t)-1, RegSet);
@ -9572,11 +9573,13 @@ void CX86RecompilerOps::OverflowDelaySlot(bool TestTimer)
if (TestTimer) if (TestTimer)
{ {
m_Assembler.MoveConstToVariable(&R4300iOp::m_TestTimer, "R4300iOp::m_TestTimer", TestTimer); m_Assembler.MoveConstToVariable(&g_System->m_TestTimer, "R4300iOp::m_TestTimer", TestTimer);
} }
m_Assembler.PushImm32("g_System->CountPerOp()", g_System->CountPerOp()); m_Assembler.PushImm32("g_System->CountPerOp()", g_System->CountPerOp());
m_Assembler.CallThis((uint32_t)&g_System->m_OpCodes, AddressOf(&R4300iOp::ExecuteOps), "R4300iOp::ExecuteOps", 8); m_Assembler.CallThis((uint32_t)&g_System->m_OpCodes, AddressOf(&R4300iOp::ExecuteOps), "R4300iOp::ExecuteOps", 8);
m_Assembler.AddConstToX86Reg(asmjit::x86::esp, 4);
if (g_System->bFastSP() && g_Recompiler) if (g_System->bFastSP() && g_Recompiler)
{ {
m_Assembler.CallThis((uint32_t)g_Recompiler, AddressOf(&CRecompiler::ResetMemoryStackPos), "CRecompiler::ResetMemoryStackPos", 4); m_Assembler.CallThis((uint32_t)g_Recompiler, AddressOf(&CRecompiler::ResetMemoryStackPos), "CRecompiler::ResetMemoryStackPos", 4);

View File

@ -54,7 +54,7 @@ void CCPULog::PushState()
CPUState * state = &m_Array[m_Index++]; CPUState * state = &m_Array[m_Index++];
state->pc = g_Reg->m_PROGRAM_COUNTER; state->pc = g_Reg->m_PROGRAM_COUNTER;
state->opcode = R4300iOp::m_Opcode; state->opcode = g_System->Opcode();
memcpy(state->gpr, g_Reg->m_GPR, sizeof(g_Reg->m_GPR)); memcpy(state->gpr, g_Reg->m_GPR, sizeof(g_Reg->m_GPR));
state->gprHi = g_Reg->m_HI; state->gprHi = g_Reg->m_HI;

View File

@ -746,7 +746,7 @@ LRESULT CDebugMemoryView::OnHxGetByteInfo(LPNMHDR lpNMHDR)
if (g_Settings->LoadBool(Debugger_SteppingOps)) if (g_Settings->LoadBool(Debugger_SteppingOps))
{ {
COpInfo opInfo(R4300iOp::m_Opcode); COpInfo opInfo(g_System->Opcode());
if (opInfo.IsStoreCommand()) if (opInfo.IsStoreCommand())
{ {
cpuReadWriteAddress = opInfo.GetLoadStoreAddress(); cpuReadWriteAddress = opInfo.GetLoadStoreAddress();

View File

@ -562,7 +562,7 @@ have_bp:
void CDebuggerUI::HandleCartToRamDMA(void) void CDebuggerUI::HandleCartToRamDMA(void)
{ {
COpInfo opInfo(R4300iOp::m_Opcode); COpInfo opInfo(g_System->Opcode());
uint32_t dmaRomAddr = g_Reg->PI_CART_ADDR_REG & 0x0FFFFFFF; uint32_t dmaRomAddr = g_Reg->PI_CART_ADDR_REG & 0x0FFFFFFF;
uint32_t dmaRamAddr = g_Reg->PI_DRAM_ADDR_REG | 0x80000000; uint32_t dmaRamAddr = g_Reg->PI_DRAM_ADDR_REG | 0x80000000;
@ -588,7 +588,7 @@ void CDebuggerUI::CPUStepStarted()
if (m_Breakpoints->NumMemLocks() > 0) if (m_Breakpoints->NumMemLocks() > 0)
{ {
COpInfo opInfo(R4300iOp::m_Opcode); COpInfo opInfo(g_System->Opcode());
bool bStoreOp = opInfo.IsStoreCommand(); bool bStoreOp = opInfo.IsStoreCommand();
if (bStoreOp) if (bStoreOp)
@ -607,7 +607,7 @@ void CDebuggerUI::CPUStepStarted()
{ {
JSHookCpuStepEnv hookEnv; JSHookCpuStepEnv hookEnv;
hookEnv.pc = g_Reg->m_PROGRAM_COUNTER; hookEnv.pc = g_Reg->m_PROGRAM_COUNTER;
hookEnv.opInfo = COpInfo(R4300iOp::m_Opcode); hookEnv.opInfo = COpInfo(g_System->Opcode());
if (m_ScriptSystem->HaveCpuExecCallbacks(hookEnv.pc)) if (m_ScriptSystem->HaveCpuExecCallbacks(hookEnv.pc))
{ {
@ -639,7 +639,7 @@ void CDebuggerUI::CPUStepStarted()
if (m_Breakpoints->HaveRegBP()) if (m_Breakpoints->HaveRegBP())
{ {
R4300iInstruction opInfo(g_Reg->m_PROGRAM_COUNTER, R4300iOp::m_Opcode.Value); R4300iInstruction opInfo(g_Reg->m_PROGRAM_COUNTER, g_System->Opcode().Value);
if (m_Breakpoints->HaveAnyGPRWriteBP()) if (m_Breakpoints->HaveAnyGPRWriteBP())
{ {
@ -687,7 +687,7 @@ void CDebuggerUI::CPUStepEnded()
return; return;
} }
R4300iOpcode Opcode = R4300iOp::m_Opcode; R4300iOpcode Opcode = g_System->Opcode();
uint32_t op = Opcode.op; uint32_t op = Opcode.op;
uint32_t funct = Opcode.funct; uint32_t funct = Opcode.funct;