RSP: Move rdp logging in to it's own class
This commit is contained in:
parent
6ed1c3edfb
commit
4681f07bf8
|
@ -159,7 +159,7 @@ void RspRomClosed(void)
|
||||||
}
|
}
|
||||||
g_RSPRegisterHandler.reset(nullptr);
|
g_RSPRegisterHandler.reset(nullptr);
|
||||||
ClearAllx86Code();
|
ClearAllx86Code();
|
||||||
StopRDPLog();
|
RDPLog.StopLog();
|
||||||
StopCPULog();
|
StopCPULog();
|
||||||
|
|
||||||
#ifdef GenerateLog
|
#ifdef GenerateLog
|
||||||
|
|
|
@ -874,15 +874,6 @@ void CRSPRecompiler::CompilerRSPBlock(void)
|
||||||
#endif
|
#endif
|
||||||
RSP_LW_IMEM(CompilePC, &m_OpCode.Value);
|
RSP_LW_IMEM(CompilePC, &m_OpCode.Value);
|
||||||
|
|
||||||
if (LogRDP && NextInstruction != RSPPIPELINE_DELAY_SLOT_DONE)
|
|
||||||
{
|
|
||||||
char str[40];
|
|
||||||
sprintf(str, "%X", CompilePC);
|
|
||||||
PushImm32(str, CompilePC);
|
|
||||||
Call_Direct((void *)RDP_LogLoc, "RDP_LogLoc");
|
|
||||||
AddConstToX86Reg(x86_ESP, 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_OpCode.Value == 0xFFFFFFFF)
|
if (m_OpCode.Value == 0xFFFFFFFF)
|
||||||
{
|
{
|
||||||
// I think this pops up an unknown OP dialog
|
// I think this pops up an unknown OP dialog
|
||||||
|
|
|
@ -2172,8 +2172,8 @@ void CRSPRecompilerOps::Cop0_MF(void)
|
||||||
PushImm32(str, m_OpCode.rd);
|
PushImm32(str, m_OpCode.rd);
|
||||||
sprintf(str, "%X", CompilePC);
|
sprintf(str, "%X", CompilePC);
|
||||||
PushImm32(str, CompilePC);
|
PushImm32(str, CompilePC);
|
||||||
Call_Direct((void *)RDP_LogMF0, "RDP_LogMF0");
|
MoveConstToX86reg((uint32_t)(&RDPLog), x86_ECX);
|
||||||
AddConstToX86Reg(x86_ESP, 8);
|
Call_Direct(AddressOf(&CRDPLog::LogMF0), "CRDPLog::LogMF0");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef Compile_Cop0
|
#ifndef Compile_Cop0
|
||||||
|
@ -2306,8 +2306,8 @@ void CRSPRecompilerOps::Cop0_MT(void)
|
||||||
PushImm32(str, m_OpCode.rd);
|
PushImm32(str, m_OpCode.rd);
|
||||||
sprintf(str, "%X", CompilePC);
|
sprintf(str, "%X", CompilePC);
|
||||||
PushImm32(str, CompilePC);
|
PushImm32(str, CompilePC);
|
||||||
Call_Direct((void *)RDP_LogMT0, "RDP_LogMT0");
|
MoveConstToX86reg((uint32_t)(&RDPLog), x86_ECX);
|
||||||
AddConstToX86Reg(x86_ESP, 12);
|
Call_Direct(AddressOf(&CRDPLog::LogMT0), "CRDPLog::LogMT0");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef Compile_Cop0
|
#ifndef Compile_Cop0
|
||||||
|
@ -2397,7 +2397,8 @@ void CRSPRecompilerOps::Cop0_MT(void)
|
||||||
|
|
||||||
if (LogRDP)
|
if (LogRDP)
|
||||||
{
|
{
|
||||||
Call_Direct((void *)RDP_LogDlist, "RDP_LogDlist");
|
MoveConstToX86reg((uint32_t)(&RDPLog), x86_ECX);
|
||||||
|
Call_Direct(AddressOf(&CRDPLog::LogDlist), "CRDPLog::LogDlist");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RSPInfo.ProcessRdpList != NULL)
|
if (RSPInfo.ProcessRdpList != NULL)
|
||||||
|
|
|
@ -612,28 +612,11 @@ void CRSPRecompilerOps::Compile_Section_000(void)
|
||||||
|
|
||||||
CPU_Message("Compiling: %X to ..., RSP optimization $000", CompilePC);
|
CPU_Message("Compiling: %X to ..., RSP optimization $000", CompilePC);
|
||||||
CPU_Message(" %X %s", CompilePC + 0x00, RSPInstruction(CompilePC + 0x00, vmudn.Value).NameAndParam().c_str());
|
CPU_Message(" %X %s", CompilePC + 0x00, RSPInstruction(CompilePC + 0x00, vmudn.Value).NameAndParam().c_str());
|
||||||
if (LogRDP)
|
|
||||||
{
|
|
||||||
char str[40];
|
|
||||||
sprintf(str, "%X", CompilePC);
|
|
||||||
PushImm32(str, CompilePC);
|
|
||||||
Call_Direct((void *)RDP_LogLoc, "RDP_LogLoc");
|
|
||||||
AddConstToX86Reg(x86_ESP, 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < Section_000_VMADN; i++)
|
for (i = 0; i < Section_000_VMADN; i++)
|
||||||
{
|
{
|
||||||
RSP_LW_IMEM(CompilePC + 0x04 + (i * 4), &vmadn.Value);
|
RSP_LW_IMEM(CompilePC + 0x04 + (i * 4), &vmadn.Value);
|
||||||
CPU_Message(" %X %s", CompilePC + 0x04 + (i * 4), RSPInstruction(CompilePC + 0x04 + (i * 4), vmadn.Value).NameAndParam().c_str());
|
CPU_Message(" %X %s", CompilePC + 0x04 + (i * 4), RSPInstruction(CompilePC + 0x04 + (i * 4), vmadn.Value).NameAndParam().c_str());
|
||||||
|
|
||||||
if (LogRDP)
|
|
||||||
{
|
|
||||||
char str[40];
|
|
||||||
sprintf(str, "%X", CompilePC + 0x04 + (i * 4));
|
|
||||||
PushImm32(str, CompilePC + 0x04 + (i * 4));
|
|
||||||
Call_Direct((void *)RDP_LogLoc, "RDP_LogLoc");
|
|
||||||
AddConstToX86Reg(x86_ESP, 4);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RSP_Sections_VMUDN(vmudn, Low16BitAccum);
|
RSP_Sections_VMUDN(vmudn, Low16BitAccum);
|
||||||
|
@ -849,14 +832,6 @@ void CRSPRecompilerOps::Compile_Section_002(void)
|
||||||
{
|
{
|
||||||
RSP_LW_IMEM(CompilePC + (Count * 0x04), &op[Count].Value);
|
RSP_LW_IMEM(CompilePC + (Count * 0x04), &op[Count].Value);
|
||||||
CPU_Message(" %X %s", CompilePC + (Count * 0x04), RSPInstruction(CompilePC + (Count * 0x04), op[Count].Value).NameAndParam().c_str());
|
CPU_Message(" %X %s", CompilePC + (Count * 0x04), RSPInstruction(CompilePC + (Count * 0x04), op[Count].Value).NameAndParam().c_str());
|
||||||
if (LogRDP)
|
|
||||||
{
|
|
||||||
char str[40];
|
|
||||||
sprintf(str, "%X", CompilePC + (Count * 0x04));
|
|
||||||
PushImm32(str, CompilePC + (Count * 0x04));
|
|
||||||
Call_Direct((void *)RDP_LogLoc, "RDP_LogLoc");
|
|
||||||
AddConstToX86Reg(x86_ESP, 4);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vmudh = op[0];
|
vmudh = op[0];
|
||||||
|
|
|
@ -849,7 +849,7 @@ void RSPOp::Cop0_MT(void)
|
||||||
{
|
{
|
||||||
if (LogRDP && g_CPUCore == InterpreterCPU)
|
if (LogRDP && g_CPUCore == InterpreterCPU)
|
||||||
{
|
{
|
||||||
RDP_LogMT0(*m_SP_PC_REG, m_OpCode.rd, m_GPR[m_OpCode.rt].UW);
|
RDPLog.LogMT0(*m_SP_PC_REG, m_OpCode.rd, m_GPR[m_OpCode.rt].UW);
|
||||||
}
|
}
|
||||||
switch (m_OpCode.rd)
|
switch (m_OpCode.rd)
|
||||||
{
|
{
|
||||||
|
@ -865,7 +865,7 @@ void RSPOp::Cop0_MT(void)
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
*m_DPC_END_REG = m_GPR[m_OpCode.rt].UW;
|
*m_DPC_END_REG = m_GPR[m_OpCode.rt].UW;
|
||||||
RDP_LogDlist();
|
RDPLog.LogDlist();
|
||||||
if (ProcessRdpList != nullptr)
|
if (ProcessRdpList != nullptr)
|
||||||
{
|
{
|
||||||
ProcessRdpList();
|
ProcessRdpList();
|
||||||
|
|
|
@ -6,9 +6,10 @@
|
||||||
#include <Common/path.h>
|
#include <Common/path.h>
|
||||||
#include <Project64-rsp-core/RSPInfo.h>
|
#include <Project64-rsp-core/RSPInfo.h>
|
||||||
#include <Project64-rsp-core/Settings/RspSettings.h>
|
#include <Project64-rsp-core/Settings/RspSettings.h>
|
||||||
|
#include <Project64-rsp-core/cpu/RspSystem.h>
|
||||||
#include <Settings/Settings.h>
|
#include <Settings/Settings.h>
|
||||||
|
|
||||||
CLog * RDPLog = nullptr;
|
CRDPLog RDPLog(RSPSystem);
|
||||||
CLog * CPULog = nullptr;
|
CLog * CPULog = nullptr;
|
||||||
|
|
||||||
void StartCPULog(void)
|
void StartCPULog(void)
|
||||||
|
@ -61,31 +62,44 @@ void CPU_Message(const char * Message, ...)
|
||||||
CPULog->Log(Msg.c_str());
|
CPULog->Log(Msg.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartRDPLog(void)
|
CRDPLog::CRDPLog(CRSPSystem & System) :
|
||||||
|
m_System(System),
|
||||||
|
m_Log(nullptr),
|
||||||
|
m_DPC_START_REG(System.m_DPC_START_REG),
|
||||||
|
m_DPC_END_REG(System.m_DPC_END_REG),
|
||||||
|
m_DPC_CURRENT_REG(System.m_DPC_CURRENT_REG),
|
||||||
|
m_DPC_STATUS_REG(System.m_DPC_STATUS_REG),
|
||||||
|
m_DPC_CLOCK_REG(System.m_DPC_CLOCK_REG),
|
||||||
|
m_RDRAM(System.m_RDRAM),
|
||||||
|
m_DMEM(System.m_DMEM)
|
||||||
{
|
{
|
||||||
if (RDPLog == nullptr && Set_DirectoryLog != 0)
|
}
|
||||||
|
|
||||||
|
void CRDPLog::StartLog(void)
|
||||||
|
{
|
||||||
|
if (m_Log == nullptr && Set_DirectoryLog != 0)
|
||||||
{
|
{
|
||||||
char LogDir[260];
|
char LogDir[260];
|
||||||
CPath LogFilePath(GetSystemSettingSz(Set_DirectoryLog, LogDir, sizeof(LogDir)), "RDP_Log.txt");
|
CPath LogFilePath(GetSystemSettingSz(Set_DirectoryLog, LogDir, sizeof(LogDir)), "RDP_Log.txt");
|
||||||
RDPLog = new CLog;
|
m_Log = new CLog;
|
||||||
RDPLog->Open(LogFilePath);
|
m_Log->Open(LogFilePath);
|
||||||
RDPLog->SetMaxFileSize(400 * 1024 * 1024);
|
m_Log->SetMaxFileSize(400 * 1024 * 1024);
|
||||||
// RDPLog->SetFlush(true);
|
// RDPLog->SetFlush(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StopRDPLog(void)
|
void CRDPLog::StopLog(void)
|
||||||
{
|
{
|
||||||
if (RDPLog != NULL)
|
if (m_Log != nullptr)
|
||||||
{
|
{
|
||||||
delete RDPLog;
|
delete m_Log;
|
||||||
RDPLog = NULL;
|
m_Log = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RDP_Message(const char * Message, ...)
|
void CRDPLog::Message(const char * Message, ...)
|
||||||
{
|
{
|
||||||
if (RDPLog == NULL)
|
if (m_Log == nullptr)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -99,56 +113,56 @@ void RDP_Message(const char * Message, ...)
|
||||||
|
|
||||||
Msg += "\r\n";
|
Msg += "\r\n";
|
||||||
|
|
||||||
RDPLog->Log(Msg.c_str());
|
m_Log->Log(Msg.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void RDP_LogMT0(uint32_t PC, int Reg, uint32_t Value)
|
void CRDPLog::LogMT0(uint32_t PC, int Reg, uint32_t Value)
|
||||||
{
|
{
|
||||||
if (RDPLog == NULL)
|
if (m_Log == nullptr)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
switch (Reg)
|
switch (Reg)
|
||||||
{
|
{
|
||||||
case 0: RDP_Message("%03X: Stored 0x%08X into SP_MEM_ADDR_REG", PC, Value); break;
|
case 0: Message("%03X: Stored 0x%08X into SP_MEM_ADDR_REG", PC, Value); break;
|
||||||
case 1: RDP_Message("%03X: Stored 0x%08X into SP_DRAM_ADDR_REG", PC, Value); break;
|
case 1: Message("%03X: Stored 0x%08X into SP_DRAM_ADDR_REG", PC, Value); break;
|
||||||
case 2: RDP_Message("%03X: Stored 0x%08X into SP_RD_LEN_REG", PC, Value); break;
|
case 2: Message("%03X: Stored 0x%08X into SP_RD_LEN_REG", PC, Value); break;
|
||||||
case 3: RDP_Message("%03X: Stored 0x%08X into SP_WR_LEN_REG", PC, Value); break;
|
case 3: Message("%03X: Stored 0x%08X into SP_WR_LEN_REG", PC, Value); break;
|
||||||
case 4: RDP_Message("%03X: Stored 0x%08X into SP_STATUS_REG", PC, Value); break;
|
case 4: Message("%03X: Stored 0x%08X into SP_STATUS_REG", PC, Value); break;
|
||||||
case 5: RDP_Message("%03X: Stored 0x%08X into Reg 5 ???", PC, Value); break;
|
case 5: Message("%03X: Stored 0x%08X into Reg 5 ???", PC, Value); break;
|
||||||
case 6: RDP_Message("%03X: Stored 0x%08X into Reg 6 ???", PC, Value); break;
|
case 6: Message("%03X: Stored 0x%08X into Reg 6 ???", PC, Value); break;
|
||||||
case 7: RDP_Message("%03X: Stored 0x%08X into SP_SEMAPHORE_REG", PC, Value); break;
|
case 7: Message("%03X: Stored 0x%08X into SP_SEMAPHORE_REG", PC, Value); break;
|
||||||
case 8: RDP_Message("%03X: Stored 0x%08X into DPC_START_REG", PC, Value); break;
|
case 8: Message("%03X: Stored 0x%08X into DPC_START_REG", PC, Value); break;
|
||||||
case 9: RDP_Message("%03X: Stored 0x%08X into DPC_END_REG", PC, Value); break;
|
case 9: Message("%03X: Stored 0x%08X into DPC_END_REG", PC, Value); break;
|
||||||
case 10: RDP_Message("%03X: Stored 0x%08X into DPC_CURRENT_REG", PC, Value); break;
|
case 10: Message("%03X: Stored 0x%08X into DPC_CURRENT_REG", PC, Value); break;
|
||||||
case 11: RDP_Message("%03X: Stored 0x%08X into DPC_STATUS_REG", PC, Value); break;
|
case 11: Message("%03X: Stored 0x%08X into DPC_STATUS_REG", PC, Value); break;
|
||||||
case 12: RDP_Message("%03X: Stored 0x%08X into DPC_CLOCK_REG", PC, Value); break;
|
case 12: Message("%03X: Stored 0x%08X into DPC_CLOCK_REG", PC, Value); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RDP_LogMF0(uint32_t PC, int Reg)
|
void CRDPLog::LogMF0(uint32_t PC, int Reg)
|
||||||
{
|
{
|
||||||
switch (Reg)
|
switch (Reg)
|
||||||
{
|
{
|
||||||
case 8: RDP_Message("%03X: Read 0x%08X from DPC_START_REG", PC, *RSPInfo.DPC_START_REG); break;
|
case 8: Message("%03X: Read 0x%08X from DPC_START_REG", PC, *m_DPC_START_REG); break;
|
||||||
case 9: RDP_Message("%03X: Read 0x%08X from DPC_END_REG", PC, *RSPInfo.DPC_END_REG); break;
|
case 9: Message("%03X: Read 0x%08X from DPC_END_REG", PC, *m_DPC_END_REG); break;
|
||||||
case 10: RDP_Message("%03X: Read 0x%08X from DPC_CURRENT_REG", PC, *RSPInfo.DPC_CURRENT_REG); break;
|
case 10: Message("%03X: Read 0x%08X from DPC_CURRENT_REG", PC, *m_DPC_CURRENT_REG); break;
|
||||||
case 11: RDP_Message("%03X: Read 0x%08X from DPC_STATUS_REG", PC, *RSPInfo.DPC_STATUS_REG); break;
|
case 11: Message("%03X: Read 0x%08X from DPC_STATUS_REG", PC, *m_DPC_STATUS_REG); break;
|
||||||
case 12: RDP_Message("%03X: Read 0x%08X from DPC_CLOCK_REG", PC, *RSPInfo.DPC_CLOCK_REG); break;
|
case 12: Message("%03X: Read 0x%08X from DPC_CLOCK_REG", PC, *m_DPC_CLOCK_REG); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RDP_LogDlist(void)
|
void CRDPLog::LogDlist(void)
|
||||||
{
|
{
|
||||||
if (RDPLog == NULL)
|
if (m_Log == nullptr)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uint32_t Length = *RSPInfo.DPC_END_REG - *RSPInfo.DPC_CURRENT_REG;
|
uint32_t Length = *m_DPC_END_REG - *m_DPC_CURRENT_REG;
|
||||||
RDP_Message(" Dlist length = %d bytes", Length);
|
Message(" Dlist length = %d bytes", Length);
|
||||||
|
|
||||||
uint32_t Pos = *RSPInfo.DPC_CURRENT_REG;
|
uint32_t Pos = *m_DPC_CURRENT_REG;
|
||||||
while (Pos < *RSPInfo.DPC_END_REG)
|
while (Pos < *m_DPC_END_REG)
|
||||||
{
|
{
|
||||||
char Hex[100], Ascii[30];
|
char Hex[100], Ascii[30];
|
||||||
uint32_t count;
|
uint32_t count;
|
||||||
|
@ -156,10 +170,10 @@ void RDP_LogDlist(void)
|
||||||
memset(&Hex, 0, sizeof(Hex));
|
memset(&Hex, 0, sizeof(Hex));
|
||||||
memset(&Ascii, 0, sizeof(Ascii));
|
memset(&Ascii, 0, sizeof(Ascii));
|
||||||
|
|
||||||
uint8_t * Mem = RSPInfo.DMEM;
|
uint8_t * Mem = m_DMEM;
|
||||||
if ((*RSPInfo.DPC_STATUS_REG & DPC_STATUS_XBUS_DMEM_DMA) == 0)
|
if ((*m_DPC_STATUS_REG & DPC_STATUS_XBUS_DMEM_DMA) == 0)
|
||||||
{
|
{
|
||||||
Mem = RSPInfo.RDRAM;
|
Mem = m_RDRAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (count = 0; count < 0x10; count++, Pos++)
|
for (count = 0; count < 0x10; count++, Pos++)
|
||||||
|
@ -188,13 +202,6 @@ void RDP_LogDlist(void)
|
||||||
strcat(Ascii, tmp);
|
strcat(Ascii, tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RDP_Message(" %s %s", Hex, Ascii);
|
Message(" %s %s", Hex, Ascii);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RDP_LogLoc(uint32_t /*PC*/)
|
|
||||||
{
|
|
||||||
// RDP_Message("%03X %08X %08X %08X %08X %08X %08X %08X %08X %08X %08X %08X %08X",PC, RSP_GPR[26].UW, *(uint32_t *)&RSPInfo.IMEM[0xDBC],
|
|
||||||
// RSP_Flags[0].UW, RSP_Vect[0].UW[0],RSP_Vect[0].UW[1],RSP_Vect[0].UW[2],RSP_Vect[0].UW[3],
|
|
||||||
// RSP_Vect[28].UW[0],RSP_Vect[28].UW[1],RSP_Vect[28].UW[2],RSP_Vect[28].UW[3],RSP_Vect[31].UW[0]);
|
|
||||||
}
|
|
||||||
|
|
|
@ -5,10 +5,31 @@ void StartCPULog(void);
|
||||||
void StopCPULog(void);
|
void StopCPULog(void);
|
||||||
void CPU_Message(const char * Message, ...);
|
void CPU_Message(const char * Message, ...);
|
||||||
|
|
||||||
void StartRDPLog(void);
|
class CRSPSystem;
|
||||||
void StopRDPLog(void);
|
class CLog;
|
||||||
void RDP_Message(const char * Message, ...);
|
|
||||||
void RDP_LogDlist(void);
|
class CRDPLog
|
||||||
void RDP_LogMT0(uint32_t PC, int Reg, uint32_t Value);
|
{
|
||||||
void RDP_LogMF0(uint32_t PC, int Reg);
|
public:
|
||||||
void RDP_LogLoc(uint32_t PC);
|
CRDPLog(CRSPSystem & System);
|
||||||
|
|
||||||
|
void StartLog(void);
|
||||||
|
void StopLog(void);
|
||||||
|
void Message(const char * Message, ...);
|
||||||
|
void LogDlist(void);
|
||||||
|
void LogMT0(uint32_t PC, int Reg, uint32_t Value);
|
||||||
|
void LogMF0(uint32_t PC, int Reg);
|
||||||
|
|
||||||
|
private:
|
||||||
|
CRSPSystem & m_System;
|
||||||
|
CLog * m_Log;
|
||||||
|
uint32_t *& m_DPC_START_REG;
|
||||||
|
uint32_t *& m_DPC_END_REG;
|
||||||
|
uint32_t *& m_DPC_CURRENT_REG;
|
||||||
|
uint32_t *& m_DPC_STATUS_REG;
|
||||||
|
uint32_t *& m_DPC_CLOCK_REG;
|
||||||
|
uint8_t *& m_RDRAM;
|
||||||
|
uint8_t *& m_DMEM;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern CRDPLog RDPLog;
|
||||||
|
|
|
@ -76,36 +76,36 @@ uint32_t CRSPSystem::RunInterpreterCPU(uint32_t Cycles)
|
||||||
}
|
}
|
||||||
CycleCount = 0;
|
CycleCount = 0;
|
||||||
uint32_t & GprR0 = m_Reg.m_GPR[0].UW;
|
uint32_t & GprR0 = m_Reg.m_GPR[0].UW;
|
||||||
uint32_t & PrgCount = *m_SP_PC_REG;
|
uint32_t & ProgramCounter = *m_SP_PC_REG;
|
||||||
while (RSP_Running)
|
while (RSP_Running)
|
||||||
{
|
{
|
||||||
if (g_RSPDebugger != nullptr)
|
if (g_RSPDebugger != nullptr)
|
||||||
{
|
{
|
||||||
g_RSPDebugger->BeforeExecuteOp();
|
g_RSPDebugger->BeforeExecuteOp();
|
||||||
}
|
}
|
||||||
m_OpCode.Value = *(uint32_t *)(RSPInfo.IMEM + (PrgCount & 0xFFC));
|
m_OpCode.Value = *(uint32_t *)(m_IMEM + (ProgramCounter & 0xFFC));
|
||||||
(m_Op.*(m_Op.Jump_Opcode[m_OpCode.op]))();
|
(m_Op.*(m_Op.Jump_Opcode[m_OpCode.op]))();
|
||||||
GprR0 = 0x00000000; // MIPS $zero hard-wired to 0
|
GprR0 = 0x00000000; // MIPS $zero hard-wired to 0
|
||||||
|
|
||||||
switch (RSP_NextInstruction)
|
switch (RSP_NextInstruction)
|
||||||
{
|
{
|
||||||
case RSPPIPELINE_NORMAL:
|
case RSPPIPELINE_NORMAL:
|
||||||
PrgCount = (PrgCount + 4) & 0xFFC;
|
ProgramCounter = (ProgramCounter + 4) & 0xFFC;
|
||||||
break;
|
break;
|
||||||
case RSPPIPELINE_DELAY_SLOT:
|
case RSPPIPELINE_DELAY_SLOT:
|
||||||
RSP_NextInstruction = RSPPIPELINE_JUMP;
|
RSP_NextInstruction = RSPPIPELINE_JUMP;
|
||||||
PrgCount = (PrgCount + 4) & 0xFFC;
|
ProgramCounter = (ProgramCounter + 4) & 0xFFC;
|
||||||
break;
|
break;
|
||||||
case RSPPIPELINE_JUMP:
|
case RSPPIPELINE_JUMP:
|
||||||
RSP_NextInstruction = RSPPIPELINE_NORMAL;
|
RSP_NextInstruction = RSPPIPELINE_NORMAL;
|
||||||
PrgCount = RSP_JumpTo;
|
ProgramCounter = RSP_JumpTo;
|
||||||
break;
|
break;
|
||||||
case RSPPIPELINE_SINGLE_STEP:
|
case RSPPIPELINE_SINGLE_STEP:
|
||||||
PrgCount = (PrgCount + 4) & 0xFFC;
|
ProgramCounter = (ProgramCounter + 4) & 0xFFC;
|
||||||
RSP_NextInstruction = RSPPIPELINE_SINGLE_STEP_DONE;
|
RSP_NextInstruction = RSPPIPELINE_SINGLE_STEP_DONE;
|
||||||
break;
|
break;
|
||||||
case RSPPIPELINE_SINGLE_STEP_DONE:
|
case RSPPIPELINE_SINGLE_STEP_DONE:
|
||||||
PrgCount = (PrgCount + 4) & 0xFFC;
|
ProgramCounter = (ProgramCounter + 4) & 0xFFC;
|
||||||
*m_SP_STATUS_REG |= SP_STATUS_HALT;
|
*m_SP_STATUS_REG |= SP_STATUS_HALT;
|
||||||
RSP_Running = false;
|
RSP_Running = false;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -11,6 +11,7 @@ class CRSPSystem
|
||||||
friend class CRSPRecompilerOps;
|
friend class CRSPRecompilerOps;
|
||||||
friend class CRSPRecompiler;
|
friend class CRSPRecompiler;
|
||||||
friend class RSPDebuggerUI;
|
friend class RSPDebuggerUI;
|
||||||
|
friend class CRDPLog;
|
||||||
friend void UpdateRSPRegistersScreen(void);
|
friend void UpdateRSPRegistersScreen(void);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
#include <Project64-rsp/breakpoint.h>
|
#include <Project64-rsp/breakpoint.h>
|
||||||
|
|
||||||
void UpdateRSPRegistersScreen(void);
|
void UpdateRSPRegistersScreen(void);
|
||||||
void RDP_LogLoc(DWORD /*PC*/);
|
|
||||||
|
|
||||||
RSPDebuggerUI::RSPDebuggerUI(CRSPSystem & System) :
|
RSPDebuggerUI::RSPDebuggerUI(CRSPSystem & System) :
|
||||||
m_System(System),
|
m_System(System),
|
||||||
|
@ -93,8 +92,6 @@ void RSPDebuggerUI::BeforeExecuteOp(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RDP_LogLoc(*PrgCount);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RSPDebuggerUI::UnknownOpcode(void)
|
void RSPDebuggerUI::UnknownOpcode(void)
|
||||||
|
@ -124,6 +121,6 @@ void RSPDebuggerUI::RDP_LogMF0(uint32_t PC, uint32_t Reg)
|
||||||
{
|
{
|
||||||
if (LogRDP && g_CPUCore == InterpreterCPU)
|
if (LogRDP && g_CPUCore == InterpreterCPU)
|
||||||
{
|
{
|
||||||
::RDP_LogMF0(PC, Reg);
|
RDPLog.LogMF0(PC, Reg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -351,11 +351,11 @@ void ProcessMenuItem(int32_t ID)
|
||||||
LogRDP = !Checked;
|
LogRDP = !Checked;
|
||||||
if (LogRDP)
|
if (LogRDP)
|
||||||
{
|
{
|
||||||
StartRDPLog();
|
RDPLog.StartLog();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
StopRDPLog();
|
RDPLog.StopLog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -611,7 +611,7 @@ EXPORT void EnableDebugging(int Enabled)
|
||||||
#endif
|
#endif
|
||||||
if (LogRDP)
|
if (LogRDP)
|
||||||
{
|
{
|
||||||
StartRDPLog();
|
RDPLog.StartLog();
|
||||||
}
|
}
|
||||||
if (LogX86Code)
|
if (LogX86Code)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue