]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
68030 MMU debugger table dump
authorToni Wilen <twilen@winuae.net>
Fri, 19 Sep 2025 15:32:45 +0000 (18:32 +0300)
committerToni Wilen <twilen@winuae.net>
Fri, 19 Sep 2025 15:32:45 +0000 (18:32 +0300)
cpummu30.cpp
debug.cpp
include/cpummu030.h

index 584c017a6415c0a071c6030219b0659ef9c649aa..7dd9d80bf36d1b6efc52439e505a6519b4c10660 100644 (file)
@@ -3607,3 +3607,69 @@ void m68k_do_rte_mmu030c (uaecptr a7)
                }
        }
 }
+
+void mmu030_dump_tables(int fc)
+{
+       uaecptr addr = 0, phys_c = 0;
+       uaecptr addr_prev = addr;
+       uaecptr phys_prev = addr;
+       uae_u32 desc_prev = 0xffffffff;
+       uae_u16 status = 0, status_prev = 0;
+
+       console_out_f(_T("FC=%d\n"), fc);
+       for (;;) {
+               struct mmu_debug_data *mdd;
+
+               uae_u32 desc = 0xffffffff;
+               uaecptr phys = 0xffffffff;
+               TRY(prb) {
+                       phys = debug_mmu030_translate(addr, fc, false, &mdd);
+               } CATCH(prb) {
+               } ENDTRY;
+               for (int i = 0; i < MAX_MMU_DEBUG_DESCRIPTOR_LEVEL; i++) {
+                       if (mdd->descriptor[i] == 0xffffffff) {
+                               break;
+                       }
+                       desc = get_long(mdd->descriptor[i]);
+               }
+               status = mmu030.status;
+
+               if (addr == 0) {
+                       desc_prev = desc;
+                       addr_prev = addr;
+                       phys_prev = phys;
+                       phys_c = phys;
+                       status_prev = status;
+               }
+
+               if (((desc_prev & (DESCR_WP | DESCR_CI | DESCR_TYPE_MASK)) != (desc & (DESCR_WP | DESCR_CI | DESCR_TYPE_MASK))) ||
+                       ((status & (MMUSR_SUPER_VIOLATION | MMUSR_WRITE_PROTECTED)) != (status_prev & (MMUSR_SUPER_VIOLATION | MMUSR_WRITE_PROTECTED))) ||
+                       (phys_prev != phys && phys_c != phys) || addr + regs.mmu_page_size == 0) {
+                       uaecptr addr_end = addr;
+                       if (addr_end + regs.mmu_page_size == 0) {
+                               addr_end += regs.mmu_page_size;
+                       }
+                       console_out_f(_T("%08x - %08x (%08x) S=%d,WP=%d - CI=%d,WP=%d,DT=%d\n"),
+                               addr_prev, addr_end - 1, desc_prev,
+                               (status_prev & MMUSR_SUPER_VIOLATION) ? 1 : 0,
+                               (status_prev & MMUSR_WRITE_PROTECTED) ? 1 : 0,
+                               (desc_prev >> 6) & 1,
+                               (desc_prev >> 2) & 1,
+                               (desc_prev >> 0) & 3
+                               );
+                       desc_prev = desc;
+                       addr_prev = addr;
+                       phys_prev = phys;
+                       phys_c = phys;
+                       status_prev = status;
+               }
+
+               addr += regs.mmu_page_size;
+               phys_c += regs.mmu_page_size;
+               if (addr == 0) {
+                       break;
+               }
+       }
+
+
+}
index 70ae6b5d1797a6168377452b183dc38b1a5d794a..2d018698a4ca9473153acd82547da718018d3440 100644 (file)
--- a/debug.cpp
+++ b/debug.cpp
@@ -6624,7 +6624,7 @@ static void debug_do_mmu_translate(uaecptr addrl)
                                        if (desc != 0xffffffff) {
                                                descdata = get_long_debug(desc);
                                                if ((descdata & 3) ==  2) {
-                                                       console_out_f(_T(" - IND %08x (%08x = %08x,PDT=%d)\n"),
+                                                       console_out_f(_T(" - IND  %08x (%08x = %08x,PDT=%d)\n"),
                                                                desc, descdata & ~3, descdata & 3);
                                                        pageidx++;
                                                }
@@ -7244,8 +7244,18 @@ static bool debug_line (TCHAR *input)
                                if (*inptr == 'm' && inptr[1] == 'u') {
                                        inptr += 2;
                                        if (inptr[0] == 'd') {
-                                               if (currprefs.mmu_model >= 68040)
+                                               if (currprefs.mmu_model >= 68040) {
                                                        mmu_dump_tables();
+                                               } else {
+                                                       int fc = debug_mmu_mode;
+                                                       if (more_params(&inptr)) {
+                                                               fc = readint(&inptr, NULL);
+                                                       }
+                                                       if (fc <= 0 || fc > 7) {
+                                                               fc = 2;
+                                                       }
+                                                       mmu030_dump_tables(fc);
+                                               }
                                        } else {
                                                if (currprefs.mmu_model) {
                                                        if (more_params (&inptr))
index 3ccabed0086cc4257f8823458cfda4fc1ea7d33f..ba8fc77280df5923d4221ff5db566ff0b3840dac 100644 (file)
@@ -115,6 +115,7 @@ extern void REGPARAM3 mmu030_put_long_unaligned(uaecptr addr, uae_u32 val, uae_u
 
 extern uaecptr debug_mmu030_translate(uaecptr addr, int fc, bool write, struct mmu_debug_data **mdd);
 extern void debug_mmu030_translate_end(void);
+extern void mmu030_dump_tables(int fc);
 
 static ALWAYS_INLINE uae_u32 uae_mmu030_get_fc_code(void)
 {