[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH-for-9.1 11/21] target/nios2: Move monitor commands to monitor.c
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH-for-9.1 11/21] target/nios2: Move monitor commands to monitor.c |
Date: |
Thu, 21 Mar 2024 16:48:27 +0100 |
Move 'info tlb' monitor commands to monitor.c,
rename dump_mmu() as nios2_info_mmu().
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/nios2/cpu.h | 2 +-
target/nios2/mmu.c | 27 ---------------------------
target/nios2/monitor.c | 28 +++++++++++++++++++++++++++-
3 files changed, 28 insertions(+), 29 deletions(-)
diff --git a/target/nios2/cpu.h b/target/nios2/cpu.h
index 4164a3432e..27e835cf40 100644
--- a/target/nios2/cpu.h
+++ b/target/nios2/cpu.h
@@ -250,7 +250,7 @@ static inline void nios2_update_crs(CPUNios2State *env)
void nios2_tcg_init(void);
void nios2_cpu_do_interrupt(CPUState *cs);
-void dump_mmu(CPUNios2State *env);
+void nios2_info_mmu(Monitor *mon, CPUNios2State *env);
void nios2_cpu_dump_state(CPUState *cpu, FILE *f, int flags);
G_NORETURN void nios2_cpu_do_unaligned_access(CPUState *cpu, vaddr addr,
MMUAccessType access_type, int
mmu_idx,
diff --git a/target/nios2/mmu.c b/target/nios2/mmu.c
index 272bd9fc6a..278eba1b0a 100644
--- a/target/nios2/mmu.c
+++ b/target/nios2/mmu.c
@@ -19,7 +19,6 @@
*/
#include "qemu/osdep.h"
-#include "qemu/qemu-print.h"
#include "cpu.h"
#include "exec/exec-all.h"
#include "mmu.h"
@@ -187,29 +186,3 @@ void nios2_mmu_init(CPUNios2State *env)
mmu->tlb_entry_mask = (cpu->tlb_num_entries / cpu->tlb_num_ways) - 1;
mmu->tlb = g_new0(Nios2TLBEntry, cpu->tlb_num_entries);
}
-
-void dump_mmu(CPUNios2State *env)
-{
- Nios2CPU *cpu = env_archcpu(env);
- int i;
-
- qemu_printf("MMU: ways %d, entries %d, pid bits %d\n",
- cpu->tlb_num_ways, cpu->tlb_num_entries,
- cpu->pid_num_bits);
-
- for (i = 0; i < cpu->tlb_num_entries; i++) {
- Nios2TLBEntry *entry = &env->mmu.tlb[i];
- qemu_printf("TLB[%d] = %08X %08X %c VPN %05X "
- "PID %02X %c PFN %05X %c%c%c%c\n",
- i, entry->tag, entry->data,
- (entry->tag & (1 << 10)) ? 'V' : '-',
- entry->tag >> 12,
- entry->tag & ((1 << cpu->pid_num_bits) - 1),
- (entry->tag & (1 << 11)) ? 'G' : '-',
- FIELD_EX32(entry->data, CR_TLBACC, PFN),
- (entry->data & CR_TLBACC_C) ? 'C' : '-',
- (entry->data & CR_TLBACC_R) ? 'R' : '-',
- (entry->data & CR_TLBACC_W) ? 'W' : '-',
- (entry->data & CR_TLBACC_X) ? 'X' : '-');
- }
-}
diff --git a/target/nios2/monitor.c b/target/nios2/monitor.c
index 0152dec3fa..c6043769e4 100644
--- a/target/nios2/monitor.c
+++ b/target/nios2/monitor.c
@@ -22,14 +22,40 @@
* THE SOFTWARE.
*/
#include "qemu/osdep.h"
+#include "qemu/qemu-print.h"
#include "cpu.h"
#include "monitor/monitor.h"
#include "monitor/hmp-target.h"
#include "monitor/hmp.h"
+void nios2_info_mmu(Monitor *mon, CPUNios2State *env)
+{
+ Nios2CPU *cpu = env_archcpu(env);
+
+ qemu_printf("MMU: ways %d, entries %d, pid bits %d\n",
+ cpu->tlb_num_ways, cpu->tlb_num_entries,
+ cpu->pid_num_bits);
+
+ for (int i = 0; i < cpu->tlb_num_entries; i++) {
+ Nios2TLBEntry *entry = &env->mmu.tlb[i];
+ qemu_printf("TLB[%d] = %08X %08X %c VPN %05X "
+ "PID %02X %c PFN %05X %c%c%c%c\n",
+ i, entry->tag, entry->data,
+ (entry->tag & (1 << 10)) ? 'V' : '-',
+ entry->tag >> 12,
+ entry->tag & ((1 << cpu->pid_num_bits) - 1),
+ (entry->tag & (1 << 11)) ? 'G' : '-',
+ FIELD_EX32(entry->data, CR_TLBACC, PFN),
+ (entry->data & CR_TLBACC_C) ? 'C' : '-',
+ (entry->data & CR_TLBACC_R) ? 'R' : '-',
+ (entry->data & CR_TLBACC_W) ? 'W' : '-',
+ (entry->data & CR_TLBACC_X) ? 'X' : '-');
+ }
+}
+
void hmp_info_tlb(Monitor *mon, const QDict *qdict)
{
CPUArchState *env1 = mon_get_cpu_env(mon);
- dump_mmu(env1);
+ nios2_info_mmu(mon, env1);
}
--
2.41.0
- [PATCH-for-9.1 05/21] target/m68k: Replace qemu_printf() by monitor_printf() in monitor, (continued)
- [PATCH-for-9.1 05/21] target/m68k: Replace qemu_printf() by monitor_printf() in monitor, Philippe Mathieu-Daudé, 2024/03/21
- [PATCH-for-9.1 06/21] target/m68k: Have dump_ttr() take a @description argument, Philippe Mathieu-Daudé, 2024/03/21
- [PATCH-for-9.1 07/21] target/m68k: Move MMU monitor commands from helper.c to monitor.c, Philippe Mathieu-Daudé, 2024/03/21
- [PATCH-for-9.1 08/21] target/microblaze: Prefix MMU API with 'mb_', Philippe Mathieu-Daudé, 2024/03/21
- [PATCH-for-9.1 09/21] target/mips: Prefix MMU API with 'mips_', Philippe Mathieu-Daudé, 2024/03/21
- [PATCH-for-9.1 10/21] target/nios2: Prefix MMU API with 'nios2_', Philippe Mathieu-Daudé, 2024/03/21
- [PATCH-for-9.1 11/21] target/nios2: Move monitor commands to monitor.c,
Philippe Mathieu-Daudé <=
- [PATCH-for-9.1 12/21] target/nios2: Replace qemu_printf() by monitor_printf() in monitor, Philippe Mathieu-Daudé, 2024/03/21
- [PATCH-for-9.1 13/21] target/ppc: Replace qemu_printf() by monitor_printf() in monitor, Philippe Mathieu-Daudé, 2024/03/21
- [PATCH-for-9.1 14/21] target/sh4: Extract sh4_dump_mmu() from hmp_info_tlb(), Philippe Mathieu-Daudé, 2024/03/21
- [PATCH-for-9.0? 15/21] target/sparc: Fix string format errors when DEBUG_MMU is defined, Philippe Mathieu-Daudé, 2024/03/21
- [PATCH-for-9.1 16/21] target/sparc: Replace qemu_printf() by monitor_printf() in monitor, Philippe Mathieu-Daudé, 2024/03/21
- [PATCH-for-9.1 17/21] target/xtensa: Prefix MMU API with 'xtensa_', Philippe Mathieu-Daudé, 2024/03/21
- [PATCH-for-9.1 21/21] target/xtensa: Replace qemu_printf() by monitor_printf() in monitor, Philippe Mathieu-Daudé, 2024/03/21
- [PATCH-for-9.1 18/21] target/xtensa: Extract MMU API to new mmu.c/mmu.h files, Philippe Mathieu-Daudé, 2024/03/21
- [PATCH-for-9.1 20/21] target/xtensa: Move monitor commands to monitor.c, Philippe Mathieu-Daudé, 2024/03/21