On 17.06.2011, at 22:39, Scott Wood wrote: > Signed-off-by: Scott Wood <scottw...@freescale.com> > --- > hmp-commands.hx | 2 +- > monitor.c | 5 ++- > target-ppc/cpu.h | 2 + > target-ppc/helper.c | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++ > 4 files changed, 95 insertions(+), 3 deletions(-) > > diff --git a/hmp-commands.hx b/hmp-commands.hx > index 6ad8806..014a4fb 100644 > --- a/hmp-commands.hx > +++ b/hmp-commands.hx > @@ -1306,7 +1306,7 @@ show i8259 (PIC) state > @item info pci > show emulated PCI device info > @item info tlb > -show virtual to physical memory mappings (i386, SH4 and SPARC only) > +show virtual to physical memory mappings (i386, SH4, SPARC, and PPC only) > @item info mem > show the active virtual memory mappings (i386 only) > @item info jit > diff --git a/monitor.c b/monitor.c > index 6af6a4d..68e94af 100644 > --- a/monitor.c > +++ b/monitor.c > @@ -2408,7 +2408,7 @@ static void tlb_info(Monitor *mon) > > #endif > > -#if defined(TARGET_SPARC) > +#if defined(TARGET_SPARC) || defined(TARGET_PPC) > static void tlb_info(Monitor *mon) > { > CPUState *env1 = mon_get_cpu(); > @@ -2901,7 +2901,8 @@ static const mon_cmd_t info_cmds[] = { > .user_print = do_pci_info_print, > .mhandler.info_new = do_pci_info, > }, > -#if defined(TARGET_I386) || defined(TARGET_SH4) || defined(TARGET_SPARC) > +#if defined(TARGET_I386) || defined(TARGET_SH4) || defined(TARGET_SPARC) || \ > + defined(TARGET_PPC) > { > .name = "tlb", > .args_type = "", > diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h > index 5d80b1b..48f7e2c 100644 > --- a/target-ppc/cpu.h > +++ b/target-ppc/cpu.h > @@ -2020,4 +2020,6 @@ static inline ppcmas_tlb_t *booke206_get_tlbm(CPUState > *env, const int tlbn, > > extern void (*cpu_ppc_hypercall)(CPUState *); > > +void dump_mmu(FILE *f, fprintf_function cpu_fprintf, CPUState *env); > + > #endif /* !defined (__CPU_PPC_H__) */ > diff --git a/target-ppc/helper.c b/target-ppc/helper.c > index 5d007c5..e22b1cb 100644 > --- a/target-ppc/helper.c > +++ b/target-ppc/helper.c > @@ -1451,6 +1451,95 @@ found_tlb: > return ret; > } > > +static const char *book3e_tsize_to_str[32] = { > + "1K", "2K", "4K", "8K", "16K", "32K", "64K", "128K", "256K", "512K", > + "1M", "2M", "4M", "8M", "16M", "32M", "64M", "128M", "256M", "512M", > + "1G", "2G", "4G", "8G", "16G", "32G", "64G", "128G", "256G", "512G", > + "1T", "2T" > +}; > + > +static void mmubooke206_dump_one_tlb(FILE *f, fprintf_function cpu_fprintf, > + CPUState *env, int tlbn, int offset, > + int tlbsize) > +{ > + ppcmas_tlb_t *entry; > + int i; > + > + cpu_fprintf(f, "\nTLB%d:\n", tlbn); > + cpu_fprintf(f, "Effective Physical Size TID TS SRWX > URWX WIMGE U0123\n"); > + > + entry = &env->tlb.tlbm[offset]; > + for (i = 0; i < tlbsize; i++, entry++) { > + target_phys_addr_t ea, pa, size; > + int tsize; > + > + /* valid? */ > + if (!(entry->mas1 & MAS1_VALID)) { > + continue; > + } > + > + tsize = (entry->mas1 & MAS1_TSIZE_MASK) >> MAS1_TSIZE_SHIFT; > + size = 1024ULL << tsize;
Isn't that what booke206_tlb_to_page_size() is there for? Hrm - but you still need tsize. I see. Fair enough - I can't think of a cleaner way atm either. Alex