aboutsummaryrefslogtreecommitdiff
path: root/disas.c
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>2020-05-18 17:53:04 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2020-06-10 12:10:23 -0400
commit6766ba506eb62110b8299d25718565a03220d012 (patch)
treed6b4e7610915b5e2ca975df679b7be7d81b25ebd /disas.c
parentddfc8b96eec648f35f0f054bd3f0a05df6cd34fb (diff)
disas: Let disas::read_memory() handler return EIO on error
Both cpu_memory_rw_debug() and address_space_read() return an error on failed transaction. Check the returned value, and return EIO in case of error. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'disas.c')
-rw-r--r--disas.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/disas.c b/disas.c
index 45285d3f63..c1397d3933 100644
--- a/disas.c
+++ b/disas.c
@@ -39,9 +39,11 @@ target_read_memory (bfd_vma memaddr,
struct disassemble_info *info)
{
CPUDebug *s = container_of(info, CPUDebug, info);
+ int r;
- cpu_memory_rw_debug(s->cpu, memaddr, myaddr, length, 0);
- return 0;
+ r = cpu_memory_rw_debug(s->cpu, memaddr, myaddr, length, 0);
+
+ return r ? EIO : 0;
}
/* Print an error message. We can assume that this is in response to
@@ -718,10 +720,11 @@ physical_read_memory(bfd_vma memaddr, bfd_byte *myaddr, int length,
struct disassemble_info *info)
{
CPUDebug *s = container_of(info, CPUDebug, info);
+ MemTxResult res;
- address_space_read(s->cpu->as, memaddr, MEMTXATTRS_UNSPECIFIED,
- myaddr, length);
- return 0;
+ res = address_space_read(s->cpu->as, memaddr, MEMTXATTRS_UNSPECIFIED,
+ myaddr, length);
+ return res == MEMTX_OK ? 0 : EIO;
}
/* Disassembler for the monitor. */