Skip to contentSkip to conversation

mips/tlb_helper: Add support for 'info tlb' cmd

PATCH New Arkadiy 1 participant 1 message Jul 26, 2021 Arm/Amlogic Meson SoC support

lore
Share & tools
lore

Arkadiy

author
#0 lore raw

PATCH v3 1/1 mips/tlb_helper: Add support for 'info tlb' cmd

From: NDNF <[email protected]>

This adds hmp 'info tlb' command support for the mips platform. 1k pages are not supported.

---
v3: dump all cores, fixed output

---
 hmp-commands-info.hx     |  3 ++-
 target/mips/cpu.h        |  3 +++
 target/mips/meson.build  |  1 +
 target/mips/monitor.c    | 27 ++++++++++++++++++++++
 target/mips/tlb_helper.c | 50 ++++++++++++++++++++++++++++++++++++++++
 5 files changed, 83 insertions(+), 1 deletion(-)
 create mode 100644 target/mips/monitor.c
hmp-commands-info.hx +2 -1
index 117ba25f91..d6aab9839c 100644
@@ -222,7 +222,8 @@ SRST
 ERST
 
 #if defined(TARGET_I386) || defined(TARGET_SH4) || defined(TARGET_SPARC) || \
-    defined(TARGET_PPC) || defined(TARGET_XTENSA) || defined(TARGET_M68K)
+    defined(TARGET_PPC) || defined(TARGET_XTENSA) || defined(TARGET_M68K) || \
+    defined(TARGET_MIPS) || defined(TARGET_MIPS64)
     {
         .name       = "tlb",
         .args_type  = "",
target/mips/cpu.h +3 -0
index b9e227a30e..5aa6f2b760 100644
@@ -1337,6 +1337,9 @@ void itc_reconfigure(struct MIPSITUState *tag);
 /* helper.c */
 target_ulong exception_resume_pc(CPUMIPSState *env);
 
+/*tlb_helper.c*/
+void dump_mmu(CPUMIPSState *env);
+
 static inline void cpu_get_tb_cpu_state(CPUMIPSState *env, target_ulong *pc,
                                         target_ulong *cs_base, uint32_t *flags)
 {
target/mips/meson.build +1 -0
index 9741545440..c0b19048ee 100644
@@ -31,6 +31,7 @@ mips_softmmu_ss.add(files(
   'cp0_timer.c',
   'machine.c',
   'mips-semi.c',
+  'monitor.c',
 ))
 mips_softmmu_ss.add(when: 'CONFIG_TCG', if_true: files(
   'cp0_helper.c',
target/mips/monitor.c new file +27 -0
new file mode 100644
index 0000000000..b7ca9b77e6
@@ -0,0 +1,27 @@
+/*
+ * monitor.c
+ *
+ * Copyright (c) 2010-2021 Institute for System Programming
+ *                         of the Russian Academy of Sciences.
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ *
+ */
+
+#include "qemu/osdep.h"
+#include "cpu.h"
+#include "monitor/monitor.h"
+#include "monitor/hmp-target.h"
+#include "monitor/hmp.h"
+#include "qapi/qmp/qdict.h"
+
+void hmp_info_tlb(Monitor *mon, const QDict *qdict)
+{
+    CPUState *cs;
+    CPU_FOREACH(cs) {
+        monitor_printf(mon, "\nCPU#%d\n", cs->cpu_index);
+        dump_mmu(cs->env_ptr);
+    }
+
+}
target/mips/tlb_helper.c +50 -0

62 lines not on this page · raw message

Signature · 1 line
2.25.1