debugger: Add mregs command.

To dump more registers.
This commit is contained in:
joevt 2023-08-24 15:44:06 -07:00 committed by dingusdev
parent 7cd3aae753
commit ff5c43e6cb
2 changed files with 34 additions and 30 deletions

View File

@ -995,36 +995,6 @@ void mmu_pat_ctx_changed()
}
}
void mmu_print_regs()
{
LOG_SCOPE_FUNCTION(INFO);
LOG_F(INFO, "MSR = 0x%X", ppc_state.msr);
LOG_F(INFO, "BAT registers:");
for (int i = 0; i < 4; i++) {
LOG_F(INFO, "IBAT%dU = 0x%X, IBAT%dL = 0x%X",
i, ppc_state.spr[528+i*2],
i, ppc_state.spr[529+i*2]);
}
if (!is_601) {
for (int i = 0; i < 4; i++) {
LOG_F(INFO, "DBAT%dU = 0x%X, DBAT%dL = 0x%X",
i, ppc_state.spr[536+i*2],
i, ppc_state.spr[537+i*2]);
}
}
LOG_F(INFO, "%s", "");
LOG_F(INFO, "SDR1 = 0x%X", ppc_state.spr[SPR::SDR1]);
LOG_F(INFO, "Segment registers:");
for (int i = 0; i < 16; i++) {
LOG_F(INFO, "SR%d = 0x%X", i, ppc_state.sr[i]);
}
}
// Forward declarations.
template <class T>
static T read_unaligned(uint32_t guest_va, uint8_t *host_va);

View File

@ -376,6 +376,37 @@ static void print_gprs() {
}
}
extern bool is_601;
static void print_mmu_regs()
{
printf("MSR : 0x%08X\n", ppc_state.msr);
printf("\nBAT registers:\n");
for (int i = 0; i < 4; i++) {
printf("IBAT%dU : 0x%08X, IBAT%dL : 0x%08X\n",
i, ppc_state.spr[528+i*2],
i, ppc_state.spr[529+i*2]);
}
if (!is_601) {
for (int i = 0; i < 4; i++) {
printf("DBAT%dU : 0x%08X, DBAT%dL : 0x%08X\n",
i, ppc_state.spr[536+i*2],
i, ppc_state.spr[537+i*2]);
}
}
printf("\n");
printf("SDR1 : 0x%08X\n", ppc_state.spr[SPR::SDR1]);
printf("\nSegment registers:\n");
for (int i = 0; i < 16; i++) {
printf("SR%-2d : 0x%08X\n", i, ppc_state.sr[i]);
}
}
#ifndef _WIN32
#include <signal.h>
@ -457,6 +488,9 @@ void enter_debugger() {
} else {
print_gprs();
}
} else if (cmd == "mregs") {
cmd = "";
print_mmu_regs();
} else if (cmd == "set") {
ss >> expr_str;