From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH v5 8/9] disas: Remove monitor_disas_is_physical
Date: Tue, 17 Oct 2017 08:37:41 -0700 [thread overview]
Message-ID: <20171017153742.10026-9-richard.henderson@linaro.org> (raw)
In-Reply-To: <20171017153742.10026-1-richard.henderson@linaro.org>
Even though there is only one monitor, and thus no race on this
global data object, there is also no point in having it. We can
just as well record the decision in the read_memory_function that
we select.
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
disas.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/disas.c b/disas.c
index 0d212f2ac5..194c523885 100644
--- a/disas.c
+++ b/disas.c
@@ -513,19 +513,11 @@ const char *lookup_symbol(target_ulong orig_addr)
#include "monitor/monitor.h"
-static int monitor_disas_is_physical;
-
static int
-monitor_read_memory (bfd_vma memaddr, bfd_byte *myaddr, int length,
+physical_read_memory(bfd_vma memaddr, bfd_byte *myaddr, int length,
struct disassemble_info *info)
{
- CPUDebug *s = container_of(info, CPUDebug, info);
-
- if (monitor_disas_is_physical) {
- cpu_physical_memory_read(memaddr, myaddr, length);
- } else {
- cpu_memory_rw_debug(s->cpu, memaddr, myaddr, length, 0);
- }
+ cpu_physical_memory_read(memaddr, myaddr, length);
return 0;
}
@@ -540,8 +532,8 @@ void monitor_disas(Monitor *mon, CPUState *cpu,
INIT_DISASSEMBLE_INFO(s.info, (FILE *)mon, monitor_fprintf);
s.cpu = cpu;
- monitor_disas_is_physical = is_physical;
- s.info.read_memory_func = monitor_read_memory;
+ s.info.read_memory_func
+ = (is_physical ? physical_read_memory : target_read_memory);
s.info.print_address_func = generic_print_address;
s.info.buffer_vma = pc;
s.info.cap_arch = -1;
--
2.13.6
next prev parent reply other threads:[~2017-10-17 15:38 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-17 15:37 [Qemu-devel] [PATCH v5 0/9] Support the Capstone disassembler Richard Henderson
2017-10-17 15:37 ` [Qemu-devel] [PATCH v5 1/9] target/i386: Convert to disas_set_info hook Richard Henderson
2017-10-17 15:37 ` [Qemu-devel] [PATCH v5 2/9] target/ppc: " Richard Henderson
2017-10-17 15:37 ` [Qemu-devel] [PATCH v5 3/9] disas: Remove unused flags arguments Richard Henderson
2017-10-17 15:37 ` [Qemu-devel] [PATCH v5 4/9] disas: Support the Capstone disassembler library Richard Henderson
2017-10-18 21:48 ` Philippe Mathieu-Daudé
2017-10-17 15:37 ` [Qemu-devel] [PATCH v5 5/9] i386: Support Capstone in disas_set_info Richard Henderson
2017-10-17 15:37 ` [Qemu-devel] [PATCH v5 6/9] arm: " Richard Henderson
2017-10-17 15:37 ` [Qemu-devel] [PATCH v5 7/9] ppc: " Richard Henderson
2017-10-17 15:37 ` Richard Henderson [this message]
2017-10-17 15:37 ` [Qemu-devel] [PATCH v5 9/9] disas: Add capstone as submodule Richard Henderson
2017-10-18 5:48 ` Gerd Hoffmann
2017-10-18 13:26 ` Richard Henderson
2017-10-18 13:29 ` Eric Blake
2017-10-18 13:34 ` Daniel P. Berrange
2017-10-18 14:14 ` Richard Henderson
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=20171017153742.10026-9-richard.henderson@linaro.org \
--to=richard.henderson@linaro.org \
--cc=qemu-devel@nongnu.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).