Extract sh4_dump_mmu() from hmp_info_tlb(), replacing monitor_printf(FIXED_STRING_WITHOUT_FORMAT) by monitor_puts().
Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org> --- target/sh4/cpu.h | 2 ++ target/sh4/monitor.c | 22 +++++++++++++++------- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/target/sh4/cpu.h b/target/sh4/cpu.h index 9211da6bde..4e2e9ffd66 100644 --- a/target/sh4/cpu.h +++ b/target/sh4/cpu.h @@ -385,4 +385,6 @@ static inline void cpu_get_tb_cpu_state(CPUSH4State *env, vaddr *pc, #endif } +void sh4_dump_mmu(Monitor *mon, CPUSH4State *env); + #endif /* SH4_CPU_H */ diff --git a/target/sh4/monitor.c b/target/sh4/monitor.c index 2da6a5426e..1befb42b07 100644 --- a/target/sh4/monitor.c +++ b/target/sh4/monitor.c @@ -39,20 +39,28 @@ static void print_tlb(Monitor *mon, int idx, tlb_t *tlb) tlb->d, tlb->wt); } +void sh4_dump_mmu(Monitor *mon, CPUSH4State *env) +{ + int i; + + monitor_puts(mon, "ITLB:\n"); + for (i = 0 ; i < ITLB_SIZE ; i++) { + print_tlb (mon, i, &env->itlb[i]); + } + monitor_puts(mon, "UTLB:\n"); + for (i = 0 ; i < UTLB_SIZE ; i++) { + print_tlb (mon, i, &env->utlb[i]); + } +} + void hmp_info_tlb(Monitor *mon, const QDict *qdict) { CPUArchState *env = mon_get_cpu_env(mon); - int i; if (!env) { monitor_printf(mon, "No CPU available\n"); return; } - monitor_printf (mon, "ITLB:\n"); - for (i = 0 ; i < ITLB_SIZE ; i++) - print_tlb (mon, i, &env->itlb[i]); - monitor_printf (mon, "UTLB:\n"); - for (i = 0 ; i < UTLB_SIZE ; i++) - print_tlb (mon, i, &env->utlb[i]); + sh4_dump_mmu(mon, env); } -- 2.41.0