qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Dr. David Alan Gilbert" <dave@treblig.org>
Subject: [RFC PATCH] hmp: implement hmp_ram_memory_dump
Date: Mon, 16 Oct 2023 17:42:35 +0100	[thread overview]
Message-ID: <20231016164235.2179049-1-alex.bennee@linaro.org> (raw)

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



             reply	other threads:[~2023-10-16 16:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-16 16:42 Alex Bennée [this message]
2023-10-21 14:30 ` [RFC PATCH] hmp: implement hmp_ram_memory_dump Dr. David Alan Gilbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231016164235.2179049-1-alex.bennee@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=dave@treblig.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).