On Tue, Sep 14, 2021 at 7:35 AM Daniel P. Berrangé <berra...@redhat.com> wrote: > > Change the "info tlb" implementation to use the format_tlb callback. > > Signed-off-by: Daniel P. Berrangé <berra...@redhat.com> > --- > target/xtensa/cpu.h | 2 +- > target/xtensa/mmu_helper.c | 126 +++++++++++++++++++++---------------- > target/xtensa/monitor.c | 10 ++- > 3 files changed, 79 insertions(+), 59 deletions(-) > > diff --git a/target/xtensa/mmu_helper.c b/target/xtensa/mmu_helper.c > index b01ff9399a..d499255984 100644 > --- a/target/xtensa/mmu_helper.c > +++ b/target/xtensa/mmu_helper.c > @@ -1055,7 +1055,7 @@ int xtensa_get_physical_addr(CPUXtensaState *env, bool > update_tlb, > } > } > > -static void dump_tlb(CPUXtensaState *env, bool dtlb) > +static void dump_tlb(CPUXtensaState *env, bool dtlb, GString *buf) > { > unsigned wi, ei; > const xtensa_tlb *conf = > @@ -1094,34 +1094,40 @@ static void dump_tlb(CPUXtensaState *env, bool dtlb) > > if (print_header) { > print_header = false; > - qemu_printf("Way %u (%d %s)\n", wi, sz, sz_text); > - qemu_printf("\tVaddr Paddr ASID Attr RWX > Cache\n" > - "\t---------- ---------- ---- ---- --- > -------\n"); > + g_string_append_printf(buf, "Way %u (%d %s)\n", > + wi, sz, sz_text); > + g_string_append_printf(buf, "\tVaddr Paddr " > + "ASID Attr RWX Cache\n" > + "\t---------- ---------- ---- " > + "---- --- -------\n");
These lines had a nice visual alignment, now they are broken randomly. Can we please keep them aligned? > } > - qemu_printf("\t0x%08x 0x%08x 0x%02x 0x%02x %c%c%c %-7s\n", > - entry->vaddr, > - entry->paddr, > - entry->asid, > - entry->attr, > - (access & PAGE_READ) ? 'R' : '-', > - (access & PAGE_WRITE) ? 'W' : '-', > - (access & PAGE_EXEC) ? 'X' : '-', > - cache_text[cache_idx] ? > - cache_text[cache_idx] : "Invalid"); > + g_string_append_printf(buf, "\t0x%08x 0x%08x 0x%02x " > + "0x%02x %c%c%c %-7s\n", > + entry->vaddr, > + entry->paddr, > + entry->asid, > + entry->attr, > + (access & PAGE_READ) ? 'R' : '-', > + (access & PAGE_WRITE) ? 'W' : '-', > + (access & PAGE_EXEC) ? 'X' : '-', > + cache_text[cache_idx] ? > + cache_text[cache_idx] : "Invalid"); > } > } > } > } > > static void dump_mpu(CPUXtensaState *env, > - const xtensa_mpu_entry *entry, unsigned n) > + const xtensa_mpu_entry *entry, unsigned n, GString *buf) > { > unsigned i; > > - qemu_printf("\t%s Vaddr Attr Ring0 Ring1 System Type > CPU cache\n" > - "\t%s ---------- ---------- ----- ----- ------------- > ---------\n", > - env ? "En" : " ", > - env ? "--" : " "); > + g_string_append_printf(buf, "\t%s Vaddr Attr " > + "Ring0 Ring1 System Type CPU cache\n" > + "\t%s ---------- ---------- ----- ----- " > + "------------- ---------\n", And here as well? -- Thanks. -- Max