summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Huth <huth@tuxfamily.org>2022-04-03 11:02:37 (GMT)
committerThomas Huth <huth@tuxfamily.org>2022-04-03 11:04:42 (GMT)
commit14013d4696b35e1d756269e516589fd597002e43 (patch)
treee338c23598ef8c454f5238b458cbd69b2a11f9be
parent6a86f054cc560a858bbe60c7529dafe2cf6ec604 (diff)
downloadhatari-14013d4696b.zip
hatari-14013d4696b.tar.gz
Add an 'info mmu' debugger command
-rw-r--r--src/debug/debugInfo.c3
-rw-r--r--src/includes/m68000.h1
-rw-r--r--src/m68000.c35
3 files changed, 37 insertions, 2 deletions
diff --git a/src/debug/debugInfo.c b/src/debug/debugInfo.c
index d01bb02..6dacc9d 100644
--- a/src/debug/debugInfo.c
+++ b/src/debug/debugInfo.c
@@ -668,13 +668,14 @@ static const struct {
{ true, "dspmemdump",DebugInfo_DspMemDump, DebugInfo_DspMemArgs, "Dump DSP memory from given <space> <address>" },
{ true, "dspregs", DebugInfo_DspRegister,NULL, "Show DSP register contents" },
#endif
- { false, "dta", DebugInfo_DTA, NULL, "Show current [or given] DTA information" },
+ { false, "dta", DebugInfo_DTA, NULL, "Show current [or given] DTA information" },
{ true, "file", DebugInfo_FileParse, DebugInfo_FileArgs, "Parse commands from given debugger input <file>" },
{ false,"gemdos", GemDOS_Info, NULL, "Show GEMDOS HDD emu information (with <value>, show opcodes)" },
{ true, "history", History_Show, NULL, "Show history of last <count> instructions" },
{ false,"ikbd", IKBD_Info, NULL, "Show IKBD (SCI) register contents" },
{ true, "memdump", DebugInfo_CpuMemDump, NULL, "Dump CPU memory from given <address>" },
{ false,"mfp", MFP_Info, NULL, "Show MFP register contents" },
+ { false,"mmu", M68000_MMU_Info, NULL, "Show MMU register contents" },
{ false,"nvram", NvRam_Info, NULL, "Show (TT/Falcon) NVRAM contents" },
{ false,"osheader", DebugInfo_OSHeader, NULL, "Show TOS OS header contents" },
{ true, "regaddr", DebugInfo_RegAddr, DebugInfo_RegAddrArgs, "Show <disasm|memdump> from CPU/DSP address pointed by <register>" },
diff --git a/src/includes/m68000.h b/src/includes/m68000.h
index db5fd20..eff2cdf 100644
--- a/src/includes/m68000.h
+++ b/src/includes/m68000.h
@@ -378,5 +378,6 @@ extern void M68000_ChangeCpuFreq ( void );
extern Uint16 M68000_GetSR ( void );
extern void M68000_SetSR ( Uint16 v );
extern void M68000_SetPC ( uaecptr v );
+extern void M68000_MMU_Info(FILE *fp, Uint32 flags);
#endif
diff --git a/src/m68000.c b/src/m68000.c
index 1db6cb4..5cec68b 100644
--- a/src/m68000.c
+++ b/src/m68000.c
@@ -89,6 +89,8 @@ const char M68000_fileid[] = "Hatari m68000.c";
#include "tos.h"
#include "falcon/crossbar.h"
#include "cart.h"
+#include "cpu/cpummu.h"
+#include "cpu/cpummu030.h"
#if ENABLE_DSP_EMU
#include "dsp.h"
@@ -861,4 +863,35 @@ void M68000_SetPC ( uaecptr v )
fill_prefetch();
}
-
+/**
+ * Dump the contents of the MMU registers
+ */
+void M68000_MMU_Info(FILE *fp, Uint32 flags)
+{
+ if (!ConfigureParams.System.bMMU || ConfigureParams.System.nCpuLevel < 2)
+ {
+ fprintf(fp, "MMU is not enabled.\n");
+ return;
+ }
+ else if (ConfigureParams.System.nCpuLevel <= 3) /* 68020/68030 mode? */
+ {
+ fprintf(fp, "MMUSR:\t0x%04x\n", mmusr_030);
+ fprintf(fp, "SRP:\t0x%016" PRIx64 "\n", (uint64_t)srp_030);
+ fprintf(fp, "CRP:\t0x%016" PRIx64 "\n", (uint64_t)crp_030);
+ fprintf(fp, "TC:\t0x%08x\n", tc_030);
+ fprintf(fp, "TT0:\t0x%08x\n", tt0_030);
+ fprintf(fp, "TT1:\t0x%08x\n", tt1_030);
+ }
+ else /* 68040 / 68060 mode */
+ {
+ fprintf(fp, "MMUSR:\t0x%04x\n", regs.mmusr);
+ fprintf(fp, "SRP:\t0x%08x\n", regs.srp);
+ fprintf(fp, "URP:\t0x%08x\n", regs.urp);
+ fprintf(fp, "TC:\t0x%08x\n", regs.tcr);
+ fprintf(fp, "DTT0:\t0x%08x\n", regs.dtt0);
+ fprintf(fp, "DTT1:\t0x%08x\n", regs.dtt1);
+ fprintf(fp, "ITT0:\t0x%08x\n", regs.itt0);
+ fprintf(fp, "ITT0:\t0x%08x\n", regs.itt1);
+ /* TODO: Also call mmu_dump_tables() here? */
+ }
+}