aboutsummaryrefslogtreecommitdiff
path: root/disas/disas-mon.c
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2024-04-02 23:44:53 -1000
committerRichard Henderson <richard.henderson@linaro.org>2024-05-15 08:55:19 +0200
commit4c833c60e0479d4eec5384fa9ede11ebab78a304 (patch)
treefeeb58d4c2d4130930034db090e7cbf55ae0411f /disas/disas-mon.c
parentc0d691ab844db8cdf2be8f6cf43887cfff56e386 (diff)
disas: Use translator_st to get disassembly data
Read from already translated pages, or saved mmio data. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'disas/disas-mon.c')
-rw-r--r--disas/disas-mon.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/disas/disas-mon.c b/disas/disas-mon.c
index 5d6d9aa02d..37bf16ac79 100644
--- a/disas/disas-mon.c
+++ b/disas/disas-mon.c
@@ -11,6 +11,19 @@
#include "hw/core/cpu.h"
#include "monitor/monitor.h"
+/*
+ * Get LENGTH bytes from info's buffer, at target address memaddr.
+ * Transfer them to myaddr.
+ */
+static int
+virtual_read_memory(bfd_vma memaddr, bfd_byte *myaddr, int length,
+ struct disassemble_info *info)
+{
+ CPUDebug *s = container_of(info, CPUDebug, info);
+ int r = cpu_memory_rw_debug(s->cpu, memaddr, myaddr, length, 0);
+ return r ? EIO : 0;
+}
+
static int
physical_read_memory(bfd_vma memaddr, bfd_byte *myaddr, int length,
struct disassemble_info *info)
@@ -38,6 +51,8 @@ void monitor_disas(Monitor *mon, CPUState *cpu, uint64_t pc,
if (is_physical) {
s.info.read_memory_func = physical_read_memory;
+ } else {
+ s.info.read_memory_func = virtual_read_memory;
}
s.info.buffer_vma = pc;