@@ -44,6 +44,7 @@ int target_get_monitor_def(CPUState *cs, const char *name, uint64_t *pval);
CPUArchState *mon_get_cpu_env(Monitor *mon);
CPUState *mon_get_cpu(Monitor *mon);
+void hmp_info_mmu(Monitor *mon, const QDict *qdict);
void hmp_info_mem(Monitor *mon, const QDict *qdict);
void hmp_info_tlb(Monitor *mon, const QDict *qdict);
void hmp_mce(Monitor *mon, const QDict *qdict);
@@ -31,6 +31,7 @@
#include "qapi/error.h"
#include "qapi/qmp/qdict.h"
#include "sysemu/hw_accel.h"
+#include "sysemu/tcg.h"
/* Set the current CPU defined by the user. Callers must hold BQL. */
int monitor_set_cpu(Monitor *mon, int cpu_index)
@@ -379,3 +380,39 @@ void hmp_gpa2hpa(Monitor *mon, const QDict *qdict)
memory_region_unref(mr);
}
#endif
+
+__attribute__((weak))
+void hmp_info_mem(Monitor *mon, const QDict *qdict)
+{
+ monitor_puts(mon,
+ "No per-CPU mapping information available on this target\n");
+}
+
+__attribute__((weak))
+void hmp_info_tlb(Monitor *mon, const QDict *qdict)
+{
+ monitor_puts(mon,
+ "No per-CPU TLB information available on this target\n");
+}
+
+void hmp_info_mmu(Monitor *mon, const QDict *qdict)
+{
+ bool tlb = qdict_get_try_bool(qdict, "tlb", false);
+ bool mem = qdict_get_try_bool(qdict, "mem", false);
+
+ if (!tcg_enabled()) {
+ monitor_puts(mon, "This command is specific to TCG accelerator\n");
+ return;
+ }
+
+ if (!tlb && !mem) {
+ tlb = mem = true;
+ }
+
+ if (mem) {
+ hmp_info_mem(mon, qdict);
+ }
+ if (tlb) {
+ hmp_info_tlb(mon, qdict);
+ }
+}
@@ -208,6 +208,20 @@ SRST
Show PCI information.
ERST
+ {
+ .name = "mmu",
+ .args_type = "tlb:-t,mem:-m",
+ .params = "[-t][-m]",
+ .help = "show virtual to physical memory "
+ "(-t: TLB; -m: active mapping)",
+ .cmd = hmp_info_mmu,
+ },
+
+SRST
+ ``info mmu``
+ Show virtual to physical memory mappings.
+ERST
+
#if defined(TARGET_I386) || defined(TARGET_SH4) || defined(TARGET_SPARC) || \
defined(TARGET_PPC) || defined(TARGET_XTENSA) || defined(TARGET_M68K)
{
Introduce the 'info mmu' command. For now it only forward to the 'info tlb' and 'info mem' commands, which will be deprecated. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- include/monitor/hmp-target.h | 1 + monitor/hmp-cmds-target.c | 37 ++++++++++++++++++++++++++++++++++++ hmp-commands-info.hx | 14 ++++++++++++++ 3 files changed, 52 insertions(+)