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>
This commit is contained in:
parent
ddfc8b96ee
commit
6766ba506e
13
disas.c
13
disas.c
@ -39,9 +39,11 @@ target_read_memory (bfd_vma memaddr,
|
|||||||
struct disassemble_info *info)
|
struct disassemble_info *info)
|
||||||
{
|
{
|
||||||
CPUDebug *s = container_of(info, CPUDebug, info);
|
CPUDebug *s = container_of(info, CPUDebug, info);
|
||||||
|
int r;
|
||||||
|
|
||||||
cpu_memory_rw_debug(s->cpu, memaddr, myaddr, length, 0);
|
r = cpu_memory_rw_debug(s->cpu, memaddr, myaddr, length, 0);
|
||||||
return 0;
|
|
||||||
|
return r ? EIO : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print an error message. We can assume that this is in response to
|
/* 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)
|
struct disassemble_info *info)
|
||||||
{
|
{
|
||||||
CPUDebug *s = container_of(info, CPUDebug, info);
|
CPUDebug *s = container_of(info, CPUDebug, info);
|
||||||
|
MemTxResult res;
|
||||||
|
|
||||||
address_space_read(s->cpu->as, memaddr, MEMTXATTRS_UNSPECIFIED,
|
res = address_space_read(s->cpu->as, memaddr, MEMTXATTRS_UNSPECIFIED,
|
||||||
myaddr, length);
|
myaddr, length);
|
||||||
return 0;
|
return res == MEMTX_OK ? 0 : EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Disassembler for the monitor. */
|
/* Disassembler for the monitor. */
|
||||||
|
Loading…
Reference in New Issue
Block a user