summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Source/Core/Common/Src/CommonFuncs.h2
-rw-r--r--Source/Core/Common/Src/CommonTypes.h3
-rw-r--r--Source/Core/Common/Src/Log.h2
-rw-r--r--Source/Core/Common/Src/LogManager.cpp2
-rw-r--r--Source/Core/Common/Src/Thread.h8
-rw-r--r--Source/Core/Core/Src/CoreTiming.cpp6
-rw-r--r--Source/Core/Core/Src/HW/CommandProcessor.cpp2
-rw-r--r--Source/Core/Core/Src/PowerPC/Interpreter/Interpreter.cpp4
-rw-r--r--Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Branch.cpp4
-rw-r--r--Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Integer.cpp4
-rw-r--r--Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp16
-rw-r--r--Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp4
-rw-r--r--Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp6
-rw-r--r--Source/Core/Core/Src/PowerPC/PPCAnalyst.cpp8
-rw-r--r--Source/Core/Core/Src/PowerPC/PPCTables.cpp10
-rw-r--r--Source/Core/Core/Src/PowerPC/PowerPC.cpp22
-rw-r--r--Source/Core/Core/Src/Tracer.cpp2
-rw-r--r--Source/DSPSpy/Makefile2
-rw-r--r--Source/DSPSpy/main_spy.cpp84
19 files changed, 103 insertions, 88 deletions
diff --git a/Source/Core/Common/Src/CommonFuncs.h b/Source/Core/Common/Src/CommonFuncs.h
index 86933fdfa0..d71e9fe24d 100644
--- a/Source/Core/Common/Src/CommonFuncs.h
+++ b/Source/Core/Common/Src/CommonFuncs.h
@@ -30,7 +30,9 @@
char* strndup (char const *s, size_t n);
size_t strnlen(const char *s, size_t n);
#else
+#ifdef __linux__
#include <byteswap.h>
+#endif
#endif // APPLE
#include <errno.h>
// go to debugger mode
diff --git a/Source/Core/Common/Src/CommonTypes.h b/Source/Core/Common/Src/CommonTypes.h
index 2dee2425d1..6f9d985deb 100644
--- a/Source/Core/Common/Src/CommonTypes.h
+++ b/Source/Core/Common/Src/CommonTypes.h
@@ -39,6 +39,8 @@ typedef signed __int64 s64;
#else
+#ifndef GEKKO
+
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
@@ -49,6 +51,7 @@ typedef short s16;
typedef int s32;
typedef long long s64;
+#endif
// For using windows lock code
#define TCHAR char
#define LONG int
diff --git a/Source/Core/Common/Src/Log.h b/Source/Core/Common/Src/Log.h
index b7c83ddf2f..a9f2833d07 100644
--- a/Source/Core/Common/Src/Log.h
+++ b/Source/Core/Common/Src/Log.h
@@ -42,7 +42,7 @@ enum LOG_TYPE {
DVDINTERFACE,
DYNA_REC,
EXPANSIONINTERFACE,
- GEKKO,
+ POWERPC,
GPFIFO,
HLE,
MASTER_LOG,
diff --git a/Source/Core/Common/Src/LogManager.cpp b/Source/Core/Common/Src/LogManager.cpp
index f2a47334e0..71bafb9529 100644
--- a/Source/Core/Common/Src/LogManager.cpp
+++ b/Source/Core/Common/Src/LogManager.cpp
@@ -40,7 +40,7 @@ LogManager::LogManager()\
m_Log[LogTypes::GPFIFO] = new LogContainer("GP", "GPFifo");
m_Log[LogTypes::EXPANSIONINTERFACE] = new LogContainer("EXI", "ExpansionInt");
m_Log[LogTypes::AUDIO_INTERFACE] = new LogContainer("AI", "AudioInt");
- m_Log[LogTypes::GEKKO] = new LogContainer("GEKKO", "IBM CPU");
+ m_Log[LogTypes::POWERPC] = new LogContainer("PowerPC", "IBM CPU");
m_Log[LogTypes::HLE] = new LogContainer("HLE", "HLE");
m_Log[LogTypes::DSPHLE] = new LogContainer("DSPHLE", "DSP HLE");
m_Log[LogTypes::DSPLLE] = new LogContainer("DSPLLE", "DSP LLE");
diff --git a/Source/Core/Common/Src/Thread.h b/Source/Core/Common/Src/Thread.h
index 8a0fb88669..61e69509a1 100644
--- a/Source/Core/Common/Src/Thread.h
+++ b/Source/Core/Common/Src/Thread.h
@@ -26,6 +26,8 @@
#include <unistd.h>
#ifdef _POSIX_THREADS
#include <pthread.h>
+#elif GEKKO
+#include <ogc/lwp_threads.h>
#else
#error unsupported platform (no pthreads?)
#endif
@@ -59,8 +61,10 @@ class CriticalSection
#ifdef _WIN32
CRITICAL_SECTION section;
#else
+#ifdef _POSIX_THREADS
pthread_mutex_t mutex;
#endif
+#endif
public:
CriticalSection(int spincount = 1000);
@@ -96,8 +100,10 @@ private:
HANDLE m_hThread;
DWORD m_threadId;
#else
+#ifdef _POSIX_THREADS
pthread_t thread_id;
#endif
+#endif
};
@@ -140,9 +146,11 @@ private:
static const int THREAD_WAIT_TIMEOUT = 5000; // INFINITE or 5000 for example
#else
bool is_set_;
+#ifdef _POSIX_THREADS
pthread_cond_t event_;
pthread_mutex_t mutex_;
#endif
+#endif
};
void InitThreading();
diff --git a/Source/Core/Core/Src/CoreTiming.cpp b/Source/Core/Core/Src/CoreTiming.cpp
index 223f5d96a4..0ce53b27c8 100644
--- a/Source/Core/Core/Src/CoreTiming.cpp
+++ b/Source/Core/Core/Src/CoreTiming.cpp
@@ -378,7 +378,7 @@ void Advance()
}
if (!first)
{
- WARN_LOG(GEKKO, "WARNING - no events in queue. Setting downcount to 10000");
+ WARN_LOG(POWERPC, "WARNING - no events in queue. Setting downcount to 10000");
downcount += 10000;
}
else
@@ -397,14 +397,14 @@ void LogPendingEvents()
Event *ptr = first;
while (ptr)
{
- INFO_LOG(GEKKO, "PENDING: Now: %lld Pending: %lld Type: %d", globalTimer, ptr->time, ptr->type);
+ INFO_LOG(POWERPC, "PENDING: Now: %lld Pending: %lld Type: %d", globalTimer, ptr->time, ptr->type);
ptr = ptr->next;
}
}
void Idle()
{
- DEBUG_LOG(GEKKO, "Idle");
+ DEBUG_LOG(POWERPC, "Idle");
idledCycles += downcount;
downcount = 0;
diff --git a/Source/Core/Core/Src/HW/CommandProcessor.cpp b/Source/Core/Core/Src/HW/CommandProcessor.cpp
index d9343572af..c7cc4d21e9 100644
--- a/Source/Core/Core/Src/HW/CommandProcessor.cpp
+++ b/Source/Core/Core/Src/HW/CommandProcessor.cpp
@@ -660,7 +660,7 @@ void CatchUpGPU()
//MessageBox(0,"Breakpoint enabled",0,0);
if ((fifo.CPReadPointer & ~0x1F) == (fifo.CPBreakpoint & ~0x1F))
{
- //_assert_msg_(GEKKO,0,"BP: %08x",fifo.CPBreakpoint);
+ //_assert_msg_(POWERPC,0,"BP: %08x",fifo.CPBreakpoint);
//LOG(COMMANDPROCESSOR,"!!! BP irq raised");
fifo.bFF_Breakpoint = 1;
m_CPStatusReg.Breakpoint = 1;
diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter.cpp b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter.cpp
index a646adcae4..7cf5b445a8 100644
--- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter.cpp
+++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter.cpp
@@ -148,7 +148,7 @@ void Run()
//2: check for breakpoint
if (BreakPoints::IsAddressBreakPoint(PC))
{
- INFO_LOG(GEKKO, "Hit Breakpoint - %08x", PC);
+ INFO_LOG(POWERPC, "Hit Breakpoint - %08x", PC);
CCPU::Break();
if (BreakPoints::IsTempBreakPoint(PC))
BreakPoints::Remove(PC);
@@ -193,7 +193,7 @@ void unknown_instruction(UGeckoInstruction _inst)
DisassembleGekko(Memory::ReadUnchecked_U32(last_pc), last_pc, disasm, 256);
printf("Last PC = %08x : %s\n", last_pc, disasm);
Debugger::PrintCallstack();
- _dbg_assert_msg_(GEKKO, 0, "\nIntCPU: Unknown instr %08x at PC = %08x last_PC = %08x LR = %08x\n", _inst.hex, PC, last_pc, LR);
+ _dbg_assert_msg_(POWERPC, 0, "\nIntCPU: Unknown instr %08x at PC = %08x last_PC = %08x LR = %08x\n", _inst.hex, PC, last_pc, LR);
}
} // namespace
diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Branch.cpp b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Branch.cpp
index c8d3a4475e..bd87088cad 100644
--- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Branch.cpp
+++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Branch.cpp
@@ -108,7 +108,7 @@ void HLEFunction(UGeckoInstruction _inst)
void CompiledBlock(UGeckoInstruction _inst)
{
- _assert_msg_(GEKKO, 0, "CompiledBlock - shouldn't be here!");
+ _assert_msg_(POWERPC, 0, "CompiledBlock - shouldn't be here!");
}
void rfi(UGeckoInstruction _inst)
@@ -129,7 +129,7 @@ void rfi(UGeckoInstruction _inst)
void rfid(UGeckoInstruction _inst)
{
- _dbg_assert_msg_(GEKKO,0,"Instruction unimplemented (does this instruction even exist?)","rfid");
+ _dbg_assert_msg_(POWERPC,0,"Instruction unimplemented (does this instruction even exist?)","rfid");
m_EndBlock = true;
}
diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Integer.cpp b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Integer.cpp
index f729c8e433..2736dcefde 100644
--- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Integer.cpp
+++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Integer.cpp
@@ -169,7 +169,7 @@ void twi(UGeckoInstruction _inst)
s32 b = _inst.SIMM_16;
s32 TO = _inst.TO;
- ERROR_LOG(GEKKO, "twi rA %x SIMM %x TO %0x", a, b, TO);
+ ERROR_LOG(POWERPC, "twi rA %x SIMM %x TO %0x", a, b, TO);
if ( ((a < b) && (TO & 0x10))
|| ((a > b) && (TO & 0x08))
@@ -397,7 +397,7 @@ void tw(UGeckoInstruction _inst)
s32 b = m_GPR[_inst.RB];
s32 TO = _inst.TO;
- ERROR_LOG(GEKKO, "tw rA %0x rB %0x TO %0x", a, b, TO);
+ ERROR_LOG(POWERPC, "tw rA %0x rB %0x TO %0x", a, b, TO);
if ( ((a < b) && (TO & 0x10))
|| ((a > b) && (TO & 0x08))
diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp
index 11467cbde8..8c1a899eb6 100644
--- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp
+++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp
@@ -265,7 +265,7 @@ void stwu(UGeckoInstruction _inst)
void dcba(UGeckoInstruction _inst)
{
- _assert_msg_(GEKKO,0,"dcba - Not implemented - not a Gekko instruction");
+ _assert_msg_(POWERPC,0,"dcba - Not implemented - not a Gekko instruction");
}
void dcbf(UGeckoInstruction _inst)
@@ -285,24 +285,24 @@ void dcbf(UGeckoInstruction _inst)
void dcbi(UGeckoInstruction _inst)
{
//Used during initialization
- //_assert_msg_(GEKKO,0,"dcbi - Not implemented");
+ //_assert_msg_(POWERPC,0,"dcbi - Not implemented");
}
void dcbst(UGeckoInstruction _inst)
{
- //_assert_msg_(GEKKO,0,"dcbst - Not implemented");
+ //_assert_msg_(POWERPC,0,"dcbst - Not implemented");
}
void dcbt(UGeckoInstruction _inst)
{
//This should tell GFX plugin to throw out any cached data here
//Used by Ikaruga
- //_assert_msg_(GEKKO,0,"dcbt - Not implemented");
+ //_assert_msg_(POWERPC,0,"dcbt - Not implemented");
}
void dcbtst(UGeckoInstruction _inst)
{
- _assert_msg_(GEKKO,0,"dcbtst - Not implemented");
+ _assert_msg_(POWERPC,0,"dcbtst - Not implemented");
}
// __________________________________________________________________________________________________
@@ -324,17 +324,17 @@ void dcbz(UGeckoInstruction _inst)
void eciwx(UGeckoInstruction _inst)
{
- _assert_msg_(GEKKO,0,"eciwx - Not implemented");
+ _assert_msg_(POWERPC,0,"eciwx - Not implemented");
}
void ecowx(UGeckoInstruction _inst)
{
- _assert_msg_(GEKKO,0,"ecowx - Not implemented");
+ _assert_msg_(POWERPC,0,"ecowx - Not implemented");
}
void eieio(UGeckoInstruction _inst)
{
- _assert_msg_(GEKKO,0,"eieio - Not implemented");
+ _assert_msg_(POWERPC,0,"eieio - Not implemented");
}
void icbi(UGeckoInstruction _inst)
diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp
index c2839ce360..37a468d87a 100644
--- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp
+++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp
@@ -110,7 +110,7 @@ void Helper_Quantize(const u32 _Addr, const float _fValue,
break;
default:
- _dbg_assert_msg_(GEKKO,0,"PS dequantize","Unknown type to read");
+ _dbg_assert_msg_(POWERPC,0,"PS dequantize","Unknown type to read");
break;
}
}
@@ -147,7 +147,7 @@ float Helper_Dequantize(const u32 _Addr, const EQuantizeType _quantizeType,
break;
default:
- _dbg_assert_msg_(GEKKO,0,"PS dequantize","Unknown type to read");
+ _dbg_assert_msg_(POWERPC,0,"PS dequantize","Unknown type to read");
fResult = 0;
break;
}
diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp
index e813e33a1b..f4f8426fdc 100644
--- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp
+++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp
@@ -297,7 +297,7 @@ void mftb(UGeckoInstruction _inst)
int iIndex = (_inst.TBR >> 5) | ((_inst.TBR & 0x1F) << 5);
if (iIndex == 268) m_GPR[_inst.RD] = TL;
else if (iIndex == 269) m_GPR[_inst.RD] = TU;
- else _dbg_assert_(GEKKO,0);
+ else _dbg_assert_(POWERPC, 0);
}
@@ -372,14 +372,14 @@ void mtspr(UGeckoInstruction _inst)
//TODO(ector): Protect LC memory if LCE is false.
//TODO(ector): Honor PSE.
- //_assert_msg_(GEKKO, WriteGatherPipeEnable, "Write gather pipe not enabled!");
+ //_assert_msg_(POWERPC, WriteGatherPipeEnable, "Write gather pipe not enabled!");
//if ((HID2.PSE == 0))
// MessageBox(NULL, "PSE in HID2 is set", "Warning", MB_OK);
}
break;
case SPR_WPAR:
- _assert_msg_(GEKKO, m_GPR[_inst.RD] == 0x0C008000, "Gather pipe @ %08x");
+ _assert_msg_(POWERPC, m_GPR[_inst.RD] == 0x0C008000, "Gather pipe @ %08x");
GPFifo::ResetGatherPipe();
break;
diff --git a/Source/Core/Core/Src/PowerPC/PPCAnalyst.cpp b/Source/Core/Core/Src/PowerPC/PPCAnalyst.cpp
index 7fb48ff106..0d5eb37fa8 100644
--- a/Source/Core/Core/Src/PowerPC/PPCAnalyst.cpp
+++ b/Source/Core/Core/Src/PowerPC/PPCAnalyst.cpp
@@ -313,7 +313,7 @@ bool Flatten(u32 address, int *realsize, BlockStats *st, BlockRegStats *gpa, Blo
UGeckoInstruction untouched_op = Memory::ReadUnchecked_U32(code[i].address);
if (untouched_op.OPCD == 1) // Do handle HLE instructions.
inst = untouched_op;
- _assert_msg_(GEKKO, inst.hex != 0, "Zero Op - Error flattening %08x op %08x", address + i*4, inst.hex);
+ _assert_msg_(POWERPC, inst.hex != 0, "Zero Op - Error flattening %08x op %08x", address + i*4, inst.hex);
code[i].inst = inst;
code[i].branchTo = -1;
code[i].branchToIndex = -1;
@@ -321,7 +321,7 @@ bool Flatten(u32 address, int *realsize, BlockStats *st, BlockRegStats *gpa, Blo
GekkoOPInfo *opinfo = GetOpInfo(inst);
if (opinfo)
numCycles += opinfo->numCyclesMinusOne + 1;
- _assert_msg_(GEKKO, opinfo != 0, "Invalid Op - Error flattening %08x op %08x", address + i*4, inst.hex);
+ _assert_msg_(POWERPC, opinfo != 0, "Invalid Op - Error flattening %08x op %08x", address + i*4, inst.hex);
bool follow = false;
u32 destination;
if (inst.OPCD == 18)
@@ -355,7 +355,7 @@ bool Flatten(u32 address, int *realsize, BlockStats *st, BlockRegStats *gpa, Blo
}
}
- _assert_msg_(GEKKO, foundExit, "Analyzer ERROR - Function %08x too big", blockstart);
+ _assert_msg_(POWERPC, foundExit, "Analyzer ERROR - Function %08x too big", blockstart);
num_inst++; // why?
st->numCycles = numCycles;
@@ -381,7 +381,7 @@ bool Flatten(u32 address, int *realsize, BlockStats *st, BlockRegStats *gpa, Blo
code[i].wantsPS1 = false;
const GekkoOPInfo *opinfo = GetOpInfo(code[i].inst);
- _assert_msg_(GEKKO, opinfo != 0, "Invalid Op - Error scanning %08x op %08x",address+i*4,inst.hex);
+ _assert_msg_(POWERPC, opinfo != 0, "Invalid Op - Error scanning %08x op %08x",address+i*4,inst.hex);
int flags = opinfo->flags;
if (flags & FL_TIMER)
diff --git a/Source/Core/Core/Src/PowerPC/PPCTables.cpp b/Source/Core/Core/Src/PowerPC/PPCTables.cpp
index e8d510fc67..cf9d4f9db1 100644
--- a/Source/Core/Core/Src/PowerPC/PPCTables.cpp
+++ b/Source/Core/Core/Src/PowerPC/PPCTables.cpp
@@ -86,7 +86,7 @@ GekkoOPInfo *GetOpInfo(UGeckoInstruction _inst)
case 59: return m_infoTable59[_inst.SUBOP5];
case 63: return m_infoTable63[_inst.SUBOP10];
default:
- _assert_msg_(GEKKO,0,"GetOpInfo - invalid subtable op %08x @ %08x", _inst.hex, PC);
+ _assert_msg_(POWERPC,0,"GetOpInfo - invalid subtable op %08x @ %08x", _inst.hex, PC);
return 0;
}
}
@@ -94,7 +94,7 @@ GekkoOPInfo *GetOpInfo(UGeckoInstruction _inst)
{
if ((info->type & 0xFFFFFF) == OPTYPE_INVALID)
{
- _assert_msg_(GEKKO,0,"GetOpInfo - invalid op %08x @ %08x", _inst.hex, PC);
+ _assert_msg_(POWERPC,0,"GetOpInfo - invalid op %08x @ %08x", _inst.hex, PC);
return 0;
}
return m_infoTable[_inst.OPCD];
@@ -115,7 +115,7 @@ Interpreter::_interpreterInstruction GetInterpreterOp(UGeckoInstruction _inst)
case 59: return Interpreter::m_opTable59[_inst.SUBOP5];
case 63: return Interpreter::m_opTable63[_inst.SUBOP10];
default:
- _assert_msg_(GEKKO,0,"GetInterpreterOp - invalid subtable op %08x @ %08x", _inst.hex, PC);
+ _assert_msg_(POWERPC,0,"GetInterpreterOp - invalid subtable op %08x @ %08x", _inst.hex, PC);
return 0;
}
}
@@ -123,7 +123,7 @@ Interpreter::_interpreterInstruction GetInterpreterOp(UGeckoInstruction _inst)
{
if ((info->type & 0xFFFFFF) == OPTYPE_INVALID)
{
- _assert_msg_(GEKKO,0,"GetInterpreterOp - invalid op %08x @ %08x", _inst.hex, PC);
+ _assert_msg_(POWERPC,0,"GetInterpreterOp - invalid op %08x @ %08x", _inst.hex, PC);
return 0;
}
return Interpreter::m_opTable[_inst.OPCD];
@@ -739,7 +739,7 @@ void PrintInstructionRunCounts()
{
if (temp[i].count == 0)
break;
- DEBUG_LOG(GEKKO, "%s : %i", temp[i].name,temp[i].count);
+ DEBUG_LOG(POWERPC, "%s : %i", temp[i].name,temp[i].count);
//PanicAlert("%s : %i", temp[i].name,temp[i].count);
}
}
diff --git a/Source/Core/Core/Src/PowerPC/PowerPC.cpp b/Source/Core/Core/Src/PowerPC/PowerPC.cpp
index e3950487c4..7759b6a9fc 100644
--- a/Source/Core/Core/Src/PowerPC/PowerPC.cpp
+++ b/Source/Core/Core/Src/PowerPC/PowerPC.cpp
@@ -237,7 +237,7 @@ void CheckExceptions()
MSR &= ~0x04EF36;
NPC = 0x80000400;
- INFO_LOG(GEKKO, "EXCEPTION_ISI");
+ INFO_LOG(POWERPC, "EXCEPTION_ISI");
ppcState.Exceptions &= ~EXCEPTION_ISI;
}
else if (ppcState.Exceptions & EXCEPTION_PROGRAM)
@@ -250,7 +250,7 @@ void CheckExceptions()
MSR &= ~0x04EF36;
NPC = 0x80000700;
- INFO_LOG(GEKKO, "EXCEPTION_PROGRAM");
+ INFO_LOG(POWERPC, "EXCEPTION_PROGRAM");
ppcState.Exceptions &= ~EXCEPTION_PROGRAM;
}
else if (ppcState.Exceptions & EXCEPTION_SYSCALL)
@@ -261,7 +261,7 @@ void CheckExceptions()
MSR &= ~0x04EF36;
NPC = 0x80000C00;
- INFO_LOG(GEKKO, "EXCEPTION_SYSCALL (PC=%08x)", PC);
+ INFO_LOG(POWERPC, "EXCEPTION_SYSCALL (PC=%08x)", PC);
ppcState.Exceptions &= ~EXCEPTION_SYSCALL;
}
else if (ppcState.Exceptions & EXCEPTION_FPU_UNAVAILABLE)
@@ -273,7 +273,7 @@ void CheckExceptions()
MSR &= ~0x04EF36;
NPC = 0x80000800;
- INFO_LOG(GEKKO, "EXCEPTION_FPU_UNAVAILABLE");
+ INFO_LOG(POWERPC, "EXCEPTION_FPU_UNAVAILABLE");
ppcState.Exceptions &= ~EXCEPTION_FPU_UNAVAILABLE;
}
else if (ppcState.Exceptions & EXCEPTION_DSI)
@@ -285,7 +285,7 @@ void CheckExceptions()
NPC = 0x80000300;
//DSISR and DAR regs are changed in GenerateDSIException()
- INFO_LOG(GEKKO, "EXCEPTION_DSI");
+ INFO_LOG(POWERPC, "EXCEPTION_DSI");
ppcState.Exceptions &= ~EXCEPTION_DSI;
}
else if (ppcState.Exceptions & EXCEPTION_ALIGNMENT)
@@ -300,7 +300,7 @@ void CheckExceptions()
//TODO crazy amount of DSISR options to check out
- INFO_LOG(GEKKO, "EXCEPTION_ALIGNMENT");
+ INFO_LOG(POWERPC, "EXCEPTION_ALIGNMENT");
ppcState.Exceptions &= ~EXCEPTION_ALIGNMENT;
}
@@ -316,10 +316,10 @@ void CheckExceptions()
MSR &= ~0x04EF36;
NPC = 0x80000500;
- INFO_LOG(GEKKO, "EXCEPTION_EXTERNAL_INT");
+ INFO_LOG(POWERPC, "EXCEPTION_EXTERNAL_INT");
ppcState.Exceptions &= ~EXCEPTION_EXTERNAL_INT;
- _dbg_assert_msg_(GEKKO, (SRR1 & 0x02) != 0, "GEKKO", "EXTERNAL_INT unrecoverable???");
+ _dbg_assert_msg_(POWERPC, (SRR1 & 0x02) != 0, "GEKKO", "EXTERNAL_INT unrecoverable???");
}
else if (ppcState.Exceptions & EXCEPTION_DECREMENTER)
{
@@ -329,13 +329,13 @@ void CheckExceptions()
MSR &= ~0x04EF36;
NPC = 0x80000900;
- INFO_LOG(GEKKO, "EXCEPTION_DECREMENTER");
+ INFO_LOG(POWERPC, "EXCEPTION_DECREMENTER");
ppcState.Exceptions &= ~EXCEPTION_DECREMENTER;
}
else
{
- _dbg_assert_msg_(GEKKO, 0, "Unknown EXT interrupt: Exceptions == %08x", ppcState.Exceptions);
- ERROR_LOG(GEKKO, "Unknown EXTERNAL INTERRUPT exception: Exceptions == %08x", ppcState.Exceptions);
+ _dbg_assert_msg_(POWERPC, 0, "Unknown EXT interrupt: Exceptions == %08x", ppcState.Exceptions);
+ ERROR_LOG(POWERPC, "Unknown EXTERNAL INTERRUPT exception: Exceptions == %08x", ppcState.Exceptions);
}
}
}
diff --git a/Source/Core/Core/Src/Tracer.cpp b/Source/Core/Core/Src/Tracer.cpp
index c2c558234b..efc46179e5 100644
--- a/Source/Core/Core/Src/Tracer.cpp
+++ b/Source/Core/Core/Src/Tracer.cpp
@@ -81,7 +81,7 @@ int SyncTrace()
{
if (PowerPC::ppcState.gpr[i] != state.gpr[i])
{
- DEBUG_LOG(GEKKO, "DIFFERENCE - r%i (local %08x, remote %08x)", i, PowerPC::ppcState.gpr[i], state.gpr[i]);
+ DEBUG_LOG(POWERPC, "DIFFERENCE - r%i (local %08x, remote %08x)", i, PowerPC::ppcState.gpr[i], state.gpr[i]);
difference = true;
}
}
diff --git a/Source/DSPSpy/Makefile b/Source/DSPSpy/Makefile
index ca5a6de34f..402802394d 100644
--- a/Source/DSPSpy/Makefile
+++ b/Source/DSPSpy/Makefile
@@ -20,7 +20,7 @@ BUILD := build
SOURCES := . source
RESOURCES := ../resources
DATA := data
-INCLUDES := include
+INCLUDES := include ../Core/Common/Src .
#---------------------------------------------------------------------------------
# options for code generation
diff --git a/Source/DSPSpy/main_spy.cpp b/Source/DSPSpy/main_spy.cpp
index 0f5cbe2319..da81d42f67 100644
--- a/Source/DSPSpy/main_spy.cpp
+++ b/Source/DSPSpy/main_spy.cpp
@@ -3,7 +3,7 @@
// ops actually do.
// It's very unpolished though
// Use Dolphin's dsptool to generate a new dsp_code.h.
-// Originally written by FIRES?
+// Originally written by duddie and modified by FIRES.
#include <gccore.h>
#include <malloc.h>
@@ -24,6 +24,9 @@
#include "irq.h"
#include "dsp.h"
+// Pull in some constants etc from DSPCore.
+#include "../Core/DSPCore/Src/gdsp_registers.h"
+
// This is where the DSP binary is.
#include "dsp_code.h"
@@ -40,6 +43,7 @@
#define DSPCR_PIINT 0x0002 // assert DSP PI interrupt
#define DSPCR_RES 0x0001 // reset DSP
+// Used for communications with the DSP, such as dumping registers etc.
u16 dspbuffer[16 * 1024] __attribute__ ((aligned (0x4000)));
// #define ENABLE_OUT
@@ -120,51 +124,49 @@ static void my__dsp_handler(u32 nIrq,void *pCtx)
}
-void print_regs(int _step, int _dsp_steps)
+// When comparing regs, ignore the loop stack registers.
+bool regs_equal(int reg, u16 value1, u16 value2) {
+ if (reg >= DSP_REG_ST0 && reg <= DSP_REG_ST3)
+ return true;
+ else
+ return value1 == value2;
+}
+
+void print_reg_block(int x, int y, int sel, const u16 *regs, const u16 *compare_regs)
{
for (int j = 0; j < 4 ; j++)
{
for (int i = 0; i < 8 ; i++)
{
- const int reg = j * 8 + i;
- ds_set_colour(cursor_reg == reg ? COLOR_YELLOW : COLOR_GREEN, COLOR_BLACK);
- ds_printf(0 + j * 8, i + 2, "%02x ", reg);
- ds_set_colour(COLOR_WHITE, COLOR_BLACK);
- if (_step == 0)
- ds_printf(3 + j * 8, i + 2, "%04x", dspreg_in[reg]);
- else
- ds_printf(3 + j * 8, i + 2, "%04x", dspreg_out[_step-1][reg]);
+ // Do not even display the loop stack registers.
+ if (j != 1 || i < 4)
+ {
+ const int reg = j * 8 + i;
+ ds_set_colour(sel == reg ? COLOR_YELLOW : COLOR_GREEN, COLOR_BLACK);
+ ds_printf(x + j * 8, i + y, "%02x ", reg);
+ ds_set_colour(regs_equal(reg, regs[reg], compare_regs[reg]) ? COLOR_WHITE : COLOR_RED, COLOR_BLACK);
+ ds_printf(x + 3 + j * 8, i + y, "%04x", regs[reg]);
+ }
}
}
-
ds_set_colour(COLOR_WHITE, COLOR_BLACK);
- ds_printf(33, 11, "%i / %i ", _step + 1, _dsp_steps);
- for (int j = 0 ; j < 4 ; j++)
- {
- for (int i = 0 ; i < 8 ; i++)
- {
- const int reg = j * 8 + i;
-
- char tmpbuf1[20];
- sprintf(tmpbuf1, "%02x ", reg);
- ds_set_colour(COLOR_GREEN, COLOR_BLACK);
- ds_text_out(33 + j * 8, i + 2, tmpbuf1);
- sprintf(tmpbuf1, "%04x", dspreg_out[_step][reg]);
-
- bool Red = true;
- if (_step == 0)
- Red = dspreg_in[reg] != dspreg_out[_step][reg];
- else
- Red = dspreg_out[_step-1][reg] != dspreg_out[_step][reg];
-
- if (Red)
- ds_set_colour(COLOR_RED, COLOR_BLACK);
- else
- ds_set_colour(COLOR_WHITE, COLOR_BLACK);
- ds_text_out(36 + j * 8, i + 2, tmpbuf1);
- }
- }
+ ds_printf(x+2, y+9, "ACC0: %02x %04x %04x", regs[DSP_REG_ACH0]&0xff, regs[DSP_REG_ACM0], regs[DSP_REG_ACL0]);
+ ds_printf(x+2, y+10, "ACC1: %02x %04x %04x", regs[DSP_REG_ACH1]&0xff, regs[DSP_REG_ACM1], regs[DSP_REG_ACL1]);
+ ds_printf(x+2, y+11, "AX0: %04x %04x", regs[DSP_REG_AXH0], regs[DSP_REG_AXL0]);
+ ds_printf(x+2, y+12, "AX1: %04x %04x", regs[DSP_REG_AXH1], regs[DSP_REG_AXL1]);
+}
+
+void print_regs(int _step, int _dsp_steps)
+{
+ const u16 *regs = _step == 0 ? dspreg_in : dspreg_out[_step - 1];
+ const u16 *regs2 = dspreg_out[_step];
+
+ print_reg_block(0, 2, cursor_reg, regs, regs2);
+ print_reg_block(33, 2, cursor_reg, regs2, regs);
+
+ ds_set_colour(COLOR_WHITE, COLOR_BLACK);
+ ds_printf(33, 17, "%i / %i ", _step + 1, _dsp_steps);
return;
@@ -421,10 +423,10 @@ int main()
print_regs(show_step, dsp_steps);
- ds_printf(2, 14, "Controls:");
- ds_printf(4, 15, "+/- to move");
- ds_printf(4, 16, "B to start over");
- ds_printf(4, 17, "Home to exit");
+ ds_printf(2, 18, "Controls:");
+ ds_printf(4, 19, "+/- to move");
+ ds_printf(4, 20, "B to start over");
+ ds_printf(4, 21, "Home to exit");
switch (ui_mode)
{