Core: Make R4300iOp::ExecuteCPU() and R4300iOp::ExecuteOps(int32_t Cycles) non static
This commit is contained in:
parent
d3edbf6dda
commit
7f42f70283
|
@ -15,7 +15,6 @@
|
|||
#include <math.h>
|
||||
|
||||
bool R4300iOp::m_TestTimer = false;
|
||||
R4300iOp::Func * R4300iOp::m_R4300i_Opcode = nullptr;
|
||||
R4300iOpcode R4300iOp::m_Opcode;
|
||||
|
||||
R4300iOp::Func R4300iOp::Jump_Opcode[64];
|
||||
|
@ -41,10 +40,14 @@ const int32_t R4300iOp::SWR_SHIFT[4] = {24, 16, 8, 0};
|
|||
const int32_t R4300iOp::LWL_SHIFT[4] = {0, 8, 16, 24};
|
||||
const int32_t R4300iOp::LWR_SHIFT[4] = {24, 16, 8, 0};
|
||||
|
||||
void R4300iOp::BuildCPU()
|
||||
R4300iOp::R4300iOp()
|
||||
{
|
||||
m_TestTimer = false;
|
||||
BuildInterpreter();
|
||||
}
|
||||
|
||||
R4300iOp::~R4300iOp()
|
||||
{
|
||||
R4300iOp::m_TestTimer = false;
|
||||
m_R4300i_Opcode = R4300iOp::BuildInterpreter();
|
||||
}
|
||||
|
||||
void R4300iOp::InPermLoop()
|
||||
|
@ -77,10 +80,9 @@ void R4300iOp::ExecuteCPU()
|
|||
bool & Done = g_System->m_EndEmulation;
|
||||
PIPELINE_STAGE & PipelineStage = g_System->m_PipelineStage;
|
||||
uint32_t & PROGRAM_COUNTER = *_PROGRAM_COUNTER;
|
||||
R4300iOpcode & Opcode = R4300iOp::m_Opcode;
|
||||
uint32_t & JumpToLocation = g_System->m_JumpToLocation;
|
||||
uint32_t & JumpDelayLocation = g_System->m_JumpDelayLocation;
|
||||
bool & TestTimer = R4300iOp::m_TestTimer;
|
||||
bool & TestTimer = m_TestTimer;
|
||||
const int32_t & bDoSomething = g_SystemEvents->DoSomething();
|
||||
uint32_t CountPerOp = g_System->CountPerOp();
|
||||
int32_t & NextTimer = *g_NextTimer;
|
||||
|
@ -90,7 +92,7 @@ void R4300iOp::ExecuteCPU()
|
|||
{
|
||||
while (!Done)
|
||||
{
|
||||
if (!g_MMU->MemoryValue32(PROGRAM_COUNTER, Opcode.Value))
|
||||
if (!g_MMU->MemoryValue32(PROGRAM_COUNTER, m_Opcode.Value))
|
||||
{
|
||||
g_Reg->TriggerAddressException(PROGRAM_COUNTER, EXC_RMISS);
|
||||
PROGRAM_COUNTER = JumpToLocation;
|
||||
|
@ -130,7 +132,7 @@ void R4300iOp::ExecuteCPU()
|
|||
// WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %d %d",*_PROGRAM_COUNTER,*g_NextTimer,g_SystemTimer->CurrentType());
|
||||
} */
|
||||
|
||||
m_R4300i_Opcode[Opcode.op]();
|
||||
Jump_Opcode[m_Opcode.op]();
|
||||
_GPR[0].DW = 0; // MIPS $zero hard-wired to 0
|
||||
NextTimer -= CountPerOp;
|
||||
|
||||
|
@ -237,7 +239,7 @@ void R4300iOp::ExecuteOps(int32_t Cycles)
|
|||
//WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %s t9: %08X v1: %08X",*_PROGRAM_COUNTER,R4300iInstruction(*_PROGRAM_COUNTER, Opcode.Value).NameAndParam().c_str(),_GPR[0x19].UW[0],_GPR[0x03].UW[0]);
|
||||
//WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %d %d",*_PROGRAM_COUNTER,*g_NextTimer,g_SystemTimer->CurrentType());
|
||||
}*/
|
||||
m_R4300i_Opcode[Opcode.op]();
|
||||
Jump_Opcode[Opcode.op]();
|
||||
_GPR[0].DW = 0; /* MIPS $zero hard-wired to 0 */
|
||||
|
||||
Cycles -= CountPerOp;
|
||||
|
@ -376,7 +378,7 @@ void R4300iOp::COP1_L()
|
|||
Jump_CoP1_L[m_Opcode.funct]();
|
||||
}
|
||||
|
||||
R4300iOp::Func * R4300iOp::BuildInterpreter()
|
||||
void R4300iOp::BuildInterpreter()
|
||||
{
|
||||
Jump_Opcode[0] = SPECIAL;
|
||||
Jump_Opcode[1] = REGIMM;
|
||||
|
@ -996,8 +998,6 @@ R4300iOp::Func * R4300iOp::BuildInterpreter()
|
|||
Jump_CoP2[29] = CPO2_INVALID_OP;
|
||||
Jump_CoP2[30] = CPO2_INVALID_OP;
|
||||
Jump_CoP2[31] = CPO2_INVALID_OP;
|
||||
|
||||
return Jump_Opcode;
|
||||
}
|
||||
|
||||
// Opcode functions
|
||||
|
@ -3323,23 +3323,6 @@ void R4300iOp::UnknownOpcode()
|
|||
}
|
||||
}
|
||||
|
||||
bool R4300iOp::MemoryBreakpoint()
|
||||
{
|
||||
if (g_Settings->LoadBool(Debugger_SteppingOps))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
g_Settings->SaveBool(Debugger_SteppingOps, true);
|
||||
g_Debugger->WaitForStep();
|
||||
if (SkipOp())
|
||||
{
|
||||
// Skip command if instructed by the debugger
|
||||
g_Settings->SaveBool(Debugger_SkipOp, false);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool R4300iOp::TestCop1UsableException(void)
|
||||
{
|
||||
if (g_Reg->STATUS_REGISTER.CU1 == 0)
|
||||
|
|
|
@ -8,15 +8,17 @@ class CX86RecompilerOps;
|
|||
|
||||
class R4300iOp :
|
||||
public CLogging,
|
||||
protected CDebugSettings,
|
||||
protected CSystemRegisters
|
||||
private CDebugSettings,
|
||||
private CSystemRegisters
|
||||
{
|
||||
friend CX86RecompilerOps;
|
||||
|
||||
public:
|
||||
static void BuildCPU();
|
||||
static void ExecuteCPU();
|
||||
static void ExecuteOps(int32_t Cycles);
|
||||
R4300iOp();
|
||||
~R4300iOp(void);
|
||||
|
||||
void ExecuteCPU();
|
||||
void ExecuteOps(int32_t Cycles);
|
||||
static void InPermLoop();
|
||||
|
||||
typedef void (*Func)();
|
||||
|
@ -232,14 +234,15 @@ public:
|
|||
static void ReservedInstruction();
|
||||
static void UnknownOpcode();
|
||||
|
||||
static Func * BuildInterpreter();
|
||||
|
||||
static bool m_TestTimer;
|
||||
static R4300iOpcode m_Opcode;
|
||||
|
||||
static bool MemoryBreakpoint();
|
||||
private:
|
||||
R4300iOp(const R4300iOp &);
|
||||
R4300iOp & operator=(const R4300iOp &);
|
||||
|
||||
void BuildInterpreter(void);
|
||||
|
||||
protected:
|
||||
static void SPECIAL();
|
||||
static void REGIMM();
|
||||
static void COP0();
|
||||
|
@ -279,5 +282,4 @@ protected:
|
|||
|
||||
static const uint32_t SWL_MASK[4], SWR_MASK[4], LWL_MASK[4], LWR_MASK[4];
|
||||
static const int32_t SWL_SHIFT[4], SWR_SHIFT[4], LWL_SHIFT[4], LWR_SHIFT[4];
|
||||
static R4300iOp::Func * m_R4300i_Opcode;
|
||||
};
|
||||
|
|
|
@ -625,6 +625,23 @@ bool CMipsMemoryVM::VAddrToPAddr(uint32_t VAddr, uint32_t & PAddr) const
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CMipsMemoryVM::MemoryBreakpoint()
|
||||
{
|
||||
if (g_Settings->LoadBool(Debugger_SteppingOps))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
g_Settings->SaveBool(Debugger_SteppingOps, true);
|
||||
g_Debugger->WaitForStep();
|
||||
if (SkipOp())
|
||||
{
|
||||
// Skip command if instructed by the debugger
|
||||
g_Settings->SaveBool(Debugger_SkipOp, false);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMipsMemoryVM::LB_VAddr32(uint32_t VAddr, uint8_t & Value)
|
||||
{
|
||||
uint32_t BaseAddress = m_TLB_ReadMap[VAddr >> 12];
|
||||
|
|
|
@ -48,8 +48,8 @@ class CArmRecompilerOps;
|
|||
#endif
|
||||
|
||||
class CMipsMemoryVM :
|
||||
private R4300iOp,
|
||||
private CGameSettings
|
||||
private CGameSettings,
|
||||
private CDebugSettings
|
||||
{
|
||||
public:
|
||||
CMipsMemoryVM(CN64System & System, bool SavesReadOnly);
|
||||
|
@ -163,6 +163,8 @@ private:
|
|||
static void RdramChanged(CMipsMemoryVM * _this);
|
||||
static void ChangeMiIntrMask();
|
||||
|
||||
bool MemoryBreakpoint();
|
||||
|
||||
bool LB_VAddr32(uint32_t VAddr, uint8_t & Value);
|
||||
bool LH_VAddr32(uint32_t VAddr, uint16_t & Value);
|
||||
bool LW_VAddr32(uint32_t VAddr, uint32_t & Value);
|
||||
|
|
|
@ -61,9 +61,6 @@ CN64System::CN64System(CPlugins * Plugins, uint32_t randomizer_seed, bool SavesR
|
|||
}
|
||||
m_Limiter.SetHertz(gameHertz);
|
||||
g_Settings->SaveDword(GameRunning_ScreenHertz, gameHertz);
|
||||
WriteTrace(TraceN64System, TraceDebug, "Setting up system");
|
||||
R4300iOp::BuildCPU();
|
||||
|
||||
if (!m_MMU_VM.Initialize(SyncSystem))
|
||||
{
|
||||
WriteTrace(TraceN64System, TraceWarning, "MMU failed to initialize");
|
||||
|
@ -1077,7 +1074,7 @@ void CN64System::ExecuteCPU()
|
|||
void CN64System::ExecuteInterpret()
|
||||
{
|
||||
SetActiveSystem();
|
||||
R4300iOp::ExecuteCPU();
|
||||
m_OpCodes.ExecuteCPU();
|
||||
}
|
||||
|
||||
void CN64System::ExecuteRecompiler()
|
||||
|
@ -1123,7 +1120,7 @@ void CN64System::UpdateSyncCPU(CN64System * const SecondCPU, uint32_t const Cycl
|
|||
}
|
||||
|
||||
SecondCPU->SetActiveSystem(true);
|
||||
R4300iOp::ExecuteOps(Cycles);
|
||||
m_OpCodes.ExecuteOps(Cycles);
|
||||
SetActiveSystem(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -180,6 +180,7 @@ private:
|
|||
CMipsMemoryVM m_MMU_VM;
|
||||
CRegisters m_Reg;
|
||||
CTLB m_TLB;
|
||||
R4300iOp m_OpCodes;
|
||||
CMempak m_Mempak;
|
||||
CFramePerSecond m_FPS;
|
||||
CProfiling m_CPU_Usage; // Used to track the CPU usage
|
||||
|
|
|
@ -183,7 +183,7 @@ void CRecompiler::RecompilerMain_Lookup()
|
|||
|
||||
while (m_MMU.VAddrToPAddr(PROGRAM_COUNTER, PhysicalAddr) && PhysicalAddr >= g_System->RdramSize())
|
||||
{
|
||||
R4300iOp::ExecuteOps(g_System->CountPerOp());
|
||||
g_System->m_OpCodes.ExecuteOps(g_System->CountPerOp());
|
||||
opsExecuted += g_System->CountPerOp();
|
||||
}
|
||||
|
||||
|
@ -296,7 +296,7 @@ void CRecompiler::RecompilerMain_Lookup_validate()
|
|||
|
||||
while (m_MMU.VAddrToPAddr(PC, PhysicalAddr) && PhysicalAddr >= g_System->RdramSize())
|
||||
{
|
||||
R4300iOp::ExecuteOps(g_System->CountPerOp());
|
||||
g_System->m_OpCodes.ExecuteOps(g_System->CountPerOp());
|
||||
opsExecuted += g_System->CountPerOp();
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ void CX86RecompilerOps::x86CompilerBreakPoint()
|
|||
}
|
||||
continue;
|
||||
}
|
||||
R4300iOp::ExecuteOps(g_System->CountPerOp());
|
||||
g_System->m_OpCodes.ExecuteOps(g_System->CountPerOp());
|
||||
if (g_SyncSystem)
|
||||
{
|
||||
g_System->UpdateSyncCPU(g_SyncSystem, g_System->CountPerOp());
|
||||
|
@ -67,7 +67,7 @@ void CX86RecompilerOps::x86CompilerBreakPoint()
|
|||
|
||||
if (g_System->PipelineStage() != PIPELINE_STAGE_NORMAL)
|
||||
{
|
||||
R4300iOp::ExecuteOps(g_System->CountPerOp());
|
||||
g_System->m_OpCodes.ExecuteOps(g_System->CountPerOp());
|
||||
if (g_SyncSystem)
|
||||
{
|
||||
g_System->UpdateSyncCPU(g_SyncSystem, g_System->CountPerOp());
|
||||
|
@ -78,7 +78,7 @@ void CX86RecompilerOps::x86CompilerBreakPoint()
|
|||
|
||||
void CX86RecompilerOps::x86BreakPointDelaySlot()
|
||||
{
|
||||
R4300iOp::ExecuteOps(g_System->CountPerOp());
|
||||
g_SyncSystem->m_OpCodes.ExecuteOps(g_System->CountPerOp());
|
||||
if (g_SyncSystem)
|
||||
{
|
||||
g_System->UpdateSyncCPU(g_SyncSystem, g_System->CountPerOp());
|
||||
|
@ -90,7 +90,7 @@ void CX86RecompilerOps::x86BreakPointDelaySlot()
|
|||
}
|
||||
if (g_System->PipelineStage() != PIPELINE_STAGE_NORMAL)
|
||||
{
|
||||
R4300iOp::ExecuteOps(g_System->CountPerOp());
|
||||
g_System->m_OpCodes.ExecuteOps(g_System->CountPerOp());
|
||||
if (g_SyncSystem)
|
||||
{
|
||||
g_System->UpdateSyncCPU(g_SyncSystem, g_System->CountPerOp());
|
||||
|
@ -110,7 +110,7 @@ void CX86RecompilerOps::x86MemoryBreakPoint()
|
|||
{
|
||||
g_Reg->m_PROGRAM_COUNTER -= 4;
|
||||
*g_NextTimer += g_System->CountPerOp();
|
||||
R4300iOp::ExecuteOps(g_System->CountPerOp());
|
||||
g_System->m_OpCodes.ExecuteOps(g_System->CountPerOp());
|
||||
}
|
||||
x86CompilerBreakPoint();
|
||||
}
|
||||
|
@ -9576,9 +9576,7 @@ void CX86RecompilerOps::OverflowDelaySlot(bool TestTimer)
|
|||
}
|
||||
|
||||
m_Assembler.PushImm32("g_System->CountPerOp()", g_System->CountPerOp());
|
||||
m_Assembler.CallFunc((uint32_t)R4300iOp::ExecuteOps, "R4300iOp::ExecuteOps");
|
||||
m_Assembler.AddConstToX86Reg(asmjit::x86::esp, 4);
|
||||
|
||||
m_Assembler.CallThis((uint32_t)&g_System->m_OpCodes, AddressOf(&R4300iOp::ExecuteOps), "R4300iOp::ExecuteOps", 8);
|
||||
if (g_System->bFastSP() && g_Recompiler)
|
||||
{
|
||||
m_Assembler.CallThis((uint32_t)g_Recompiler, AddressOf(&CRecompiler::ResetMemoryStackPos), "CRecompiler::ResetMemoryStackPos", 4);
|
||||
|
|
|
@ -24,4 +24,4 @@ CMempak * g_Mempak = nullptr;
|
|||
CRandom * g_Random = nullptr;
|
||||
CEnhancements * g_Enhancements = nullptr;
|
||||
|
||||
int * g_NextTimer;
|
||||
int32_t * g_NextTimer;
|
Loading…
Reference in New Issue