Commit 7c664e2f4efbf27b1fa47ceed0c4e661fb681238

Authored by aurel32
1 parent 0cfe11ea

SH4: Added monitoring of TLBs

This patch might interest some people trying (as I try to do) to fix
some tlbs for kernel/user space data sharing.

Signed-off-by: Lionel Landwerlin <lionel.landwerlin@openwide.fr>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6670 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 32 additions and 1 deletions
monitor.c
@@ -1245,6 +1245,35 @@ static void mem_info(void) @@ -1245,6 +1245,35 @@ static void mem_info(void)
1245 } 1245 }
1246 #endif 1246 #endif
1247 1247
  1248 +#if defined(TARGET_SH4)
  1249 +
  1250 +static void print_tlb(int idx, tlb_t *tlb)
  1251 +{
  1252 + term_printf(" tlb%i:\t"
  1253 + "asid=%hhu vpn=%x\tppn=%x\tsz=%hhu size=%u\t"
  1254 + "v=%hhu shared=%hhu cached=%hhu prot=%hhu "
  1255 + "dirty=%hhu writethrough=%hhu\n",
  1256 + idx,
  1257 + tlb->asid, tlb->vpn, tlb->ppn, tlb->sz, tlb->size,
  1258 + tlb->v, tlb->sh, tlb->c, tlb->pr,
  1259 + tlb->d, tlb->wt);
  1260 +}
  1261 +
  1262 +static void tlb_info(void)
  1263 +{
  1264 + CPUState *env = mon_get_cpu();
  1265 + int i;
  1266 +
  1267 + term_printf ("ITLB:\n");
  1268 + for (i = 0 ; i < ITLB_SIZE ; i++)
  1269 + print_tlb (i, &env->itlb[i]);
  1270 + term_printf ("UTLB:\n");
  1271 + for (i = 0 ; i < UTLB_SIZE ; i++)
  1272 + print_tlb (i, &env->utlb[i]);
  1273 +}
  1274 +
  1275 +#endif
  1276 +
1248 static void do_info_kqemu(void) 1277 static void do_info_kqemu(void)
1249 { 1278 {
1250 #ifdef USE_KQEMU 1279 #ifdef USE_KQEMU
@@ -1556,9 +1585,11 @@ static const term_cmd_t info_cmds[] = { @@ -1556,9 +1585,11 @@ static const term_cmd_t info_cmds[] = {
1556 "", "show i8259 (PIC) state", }, 1585 "", "show i8259 (PIC) state", },
1557 { "pci", "", pci_info, 1586 { "pci", "", pci_info,
1558 "", "show PCI info", }, 1587 "", "show PCI info", },
1559 -#if defined(TARGET_I386) 1588 +#if defined(TARGET_I386) || defined(TARGET_SH4)
1560 { "tlb", "", tlb_info, 1589 { "tlb", "", tlb_info,
1561 "", "show virtual to physical memory mappings", }, 1590 "", "show virtual to physical memory mappings", },
  1591 +#endif
  1592 +#if defined(TARGET_I386)
1562 { "mem", "", mem_info, 1593 { "mem", "", mem_info,
1563 "", "show the active virtual memory mappings", }, 1594 "", "show the active virtual memory mappings", },
1564 { "hpet", "", do_info_hpet, 1595 { "hpet", "", do_info_hpet,