qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] hmp: implement hmp_ram_memory_dump
@ 2023-10-16 16:42 Alex Bennée
  2023-10-21 14:30 ` Dr. David Alan Gilbert
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Bennée @ 2023-10-16 16:42 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alex Bennée, Richard Henderson, Dr. David Alan Gilbert

While reviewing the tb-stats series I was confused by the different
between physical and ram address. This implements the RAM dump so I
can replicate the disassembly of "info tb". Whether or not that is a
good idea remains to be discussed.

Based-on: 20231003183058.1639121-1-richard.henderson@linaro.org
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Cc: Richard Henderson <richard.henderson@linaro.org>
---
 include/monitor/hmp-target.h |  1 +
 monitor/hmp-cmds-target.c    | 10 ++++++++++
 hmp-commands.hx              | 19 ++++++++++++++++++-
 3 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/include/monitor/hmp-target.h b/include/monitor/hmp-target.h
index 730507bd65..a3fa7dc089 100644
--- a/include/monitor/hmp-target.h
+++ b/include/monitor/hmp-target.h
@@ -50,6 +50,7 @@ void hmp_info_sgx(Monitor *mon, const QDict *qdict);
 void hmp_info_via(Monitor *mon, const QDict *qdict);
 void hmp_memory_dump(Monitor *mon, const QDict *qdict);
 void hmp_physical_memory_dump(Monitor *mon, const QDict *qdict);
+void hmp_ram_memory_dump(Monitor *mon, const QDict *qdict);
 void hmp_info_registers(Monitor *mon, const QDict *qdict);
 void hmp_gva2gpa(Monitor *mon, const QDict *qdict);
 void hmp_gpa2hva(Monitor *mon, const QDict *qdict);
diff --git a/monitor/hmp-cmds-target.c b/monitor/hmp-cmds-target.c
index 476cf68e81..21ce790502 100644
--- a/monitor/hmp-cmds-target.c
+++ b/monitor/hmp-cmds-target.c
@@ -253,6 +253,16 @@ void hmp_physical_memory_dump(Monitor *mon, const QDict *qdict)
     memory_dump(mon, count, format, size, addr, MON_DISAS_GPA);
 }
 
+void hmp_ram_memory_dump(Monitor *mon, const QDict *qdict)
+{
+    int count = qdict_get_int(qdict, "count");
+    int format = qdict_get_int(qdict, "format");
+    int size = qdict_get_int(qdict, "size");
+    hwaddr addr = qdict_get_int(qdict, "addr");
+
+    memory_dump(mon, count, format, size, addr, MON_DISAS_GRA);
+}
+
 void *gpa2hva(MemoryRegion **p_mr, hwaddr addr, uint64_t size, Error **errp)
 {
     Int128 gpa_region_size;
diff --git a/hmp-commands.hx b/hmp-commands.hx
index e1d78ab69d..5a9ecefdcb 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -471,7 +471,10 @@ ERST
 
 SRST
 ``x/``\ *fmt* *addr*
-  Virtual memory dump starting at *addr*.
+  Virtual memory dump starting at *addr*. See xp/ for physical memory and xr/ for ram
+
+  *fmt* is a format which tells the command how to format the
+  data. Its syntax is: ``/{count}{format}{size}``
 ERST
 
     {
@@ -530,7 +533,21 @@ SRST
     0x000b8090: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
 
 ERST
+    {
+        .name       = "xr",
+        .args_type  = "fmt:/,addr:l",
+        .params     = "/fmt addr",
+        .help       = "ram memory dump starting at 'addr'",
+        .cmd        = hmp_ram_memory_dump,
+    },
+
+SRST
+``xr /``\ *fmt* *addr*
+  RAM memory dump starting at *addr*. See xp/ for physical and x/ for virtual memory
 
+  *fmt* is a format which tells the command how to format the
+  data. Its syntax is: ``/{count}{format}{size}``
+ERST
     {
         .name       = "gpa2hva",
         .args_type  = "addr:l",
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-10-21 14:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-16 16:42 [RFC PATCH] hmp: implement hmp_ram_memory_dump Alex Bennée
2023-10-21 14:30 ` Dr. David Alan Gilbert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).