From 6d9990585c2c4995e5e168ea637eae09f3745c40 Mon Sep 17 00:00:00 2001 From: skidau Date: Sun, 12 Oct 2014 20:03:29 +1100 Subject: [PATCH] Added some of the MMU registers into the debugger Register window --- .../Core/DolphinWX/Debugger/RegisterView.cpp | 60 ++++++++++++++++++- Source/Core/DolphinWX/Debugger/RegisterView.h | 4 +- 2 files changed, 61 insertions(+), 3 deletions(-) diff --git a/Source/Core/DolphinWX/Debugger/RegisterView.cpp b/Source/Core/DolphinWX/Debugger/RegisterView.cpp index 25635db528..ce991f24e1 100644 --- a/Source/Core/DolphinWX/Debugger/RegisterView.cpp +++ b/Source/Core/DolphinWX/Debugger/RegisterView.cpp @@ -24,7 +24,7 @@ class wxWindow; // F-zero 80005e60 wtf?? static const char *special_reg_names[] = { - "PC", "LR", "CTR", "CR", "FPSCR", "MSR", "SRR0", "SRR1", "Exceptions", "Int Mask", "Int Cause", + "PC", "LR", "CTR", "CR", "FPSCR", "MSR", "SRR0", "SRR1", "Exceptions", "Int Mask", "Int Cause", "DSISR", "DAR", "PT hashmask" }; static u32 GetSpecialRegValue(int reg) @@ -42,6 +42,9 @@ static u32 GetSpecialRegValue(int reg) case 8: return PowerPC::ppcState.Exceptions; case 9: return ProcessorInterface::GetMask(); case 10: return ProcessorInterface::GetCause(); + case 11: return PowerPC::ppcState.spr[SPR_DSISR]; + case 12: return PowerPC::ppcState.spr[SPR_DAR]; + case 13: return (PowerPC::ppcState.pagetable_hashmask << 6) | PowerPC::ppcState.pagetable_base; default: return 0; } } @@ -57,6 +60,58 @@ wxString CRegTable::GetValue(int row, int col) case 2: return StrToWxStr(GekkoDisassembler::GetFPRName(row)); case 3: return wxString::Format("%016llx", riPS0(row)); case 4: return wxString::Format("%016llx", riPS1(row)); + case 5: + { + if (row < 4) + { + return wxString::Format("DBAT%01d", row); + } + if (row < 8) + { + return wxString::Format("IBAT%01d", row - 4); + } + if (row < 12) + { + return wxString::Format("DBAT%01d", row - 4); + } + if (row < 16) + { + return wxString::Format("IBAT%01d", row - 8); + } + } + case 6: + { + if (row < 4) + { + return wxString::Format("%016llx", (u64)PowerPC::ppcState.spr[SPR_DBAT0U + row * 2] << 32 | PowerPC::ppcState.spr[SPR_DBAT0L + row * 2]); + } + if (row < 8) + { + return wxString::Format("%016llx", (u64)PowerPC::ppcState.spr[SPR_IBAT0U + (row - 4) * 2] << 32 | PowerPC::ppcState.spr[SPR_IBAT0L + (row - 4) * 2]); + } + if (row < 12) + { + return wxString::Format("%016llx", (u64)PowerPC::ppcState.spr[SPR_DBAT4U + (row - 12) * 2] << 32 | PowerPC::ppcState.spr[SPR_DBAT4L + (row - 12) * 2]); + } + if (row < 16) + { + return wxString::Format("%016llx", (u64)PowerPC::ppcState.spr[SPR_IBAT4U + (row - 16) * 2] << 32 | PowerPC::ppcState.spr[SPR_IBAT4L + (row - 16) * 2]); + } + } + case 7: + { + if (row < 16) + { + return wxString::Format("SR%02d", row); + } + } + case 8: + { + if (row < 16) + { + return wxString::Format("%08x", PowerPC::ppcState.sr[row]); + } + } default: return wxEmptyString; } } @@ -91,6 +146,9 @@ static void SetSpecialRegValue(int reg, u32 value) // Should we just change the value, or use ProcessorInterface::SetInterrupt() to make the system aware? // case 9: return ProcessorInterface::GetMask(); // case 10: return ProcessorInterface::GetCause(); + case 11: PowerPC::ppcState.spr[SPR_DSISR] = value; break; + case 12: PowerPC::ppcState.spr[SPR_DAR] = value; break; + //case 13: (PowerPC::ppcState.pagetable_hashmask << 6) | PowerPC::ppcState.pagetable_base; default: return; } } diff --git a/Source/Core/DolphinWX/Debugger/RegisterView.h b/Source/Core/DolphinWX/Debugger/RegisterView.h index 46d150b41b..663d8734b5 100644 --- a/Source/Core/DolphinWX/Debugger/RegisterView.h +++ b/Source/Core/DolphinWX/Debugger/RegisterView.h @@ -34,7 +34,7 @@ class CRegTable : public wxGridTableBase { enum { - NUM_SPECIALS = 11, + NUM_SPECIALS = 14, }; public: @@ -48,7 +48,7 @@ public: memset(m_CachedFRegHasChanged, 0, sizeof(m_CachedFRegHasChanged)); } - int GetNumberCols() override { return 5; } + int GetNumberCols() override { return 9; } int GetNumberRows() override { return 32 + NUM_SPECIALS; } bool IsEmptyCell(int row, int col) override { return row > 31 && col > 2; } wxString GetValue(int row, int col) override;