diff options
author | Jeff Law <law@redhat.com> | 1996-08-31 21:21:27 +0000 |
---|---|---|
committer | Jeff Law <law@redhat.com> | 1996-08-31 21:21:27 +0000 |
commit | e05cae190b4917c8d045244469d2161c1574cb5c (patch) | |
tree | 29069f322835d9aba6bdc265e63dd461ebb31811 /opcodes/v850-dis.c | |
parent | a5f2a4e50e373ca13b5a637397f68356dae93415 (diff) | |
download | gdb-e05cae190b4917c8d045244469d2161c1574cb5c.zip gdb-e05cae190b4917c8d045244469d2161c1574cb5c.tar.gz gdb-e05cae190b4917c8d045244469d2161c1574cb5c.tar.bz2 |
* v850-dis.c (print_insn_v850): Properly handle disassembling
a two byte insn at the end of a memory region when the memory
region's size is only two byte aligned.
Diffstat (limited to 'opcodes/v850-dis.c')
-rw-r--r-- | opcodes/v850-dis.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/opcodes/v850-dis.c b/opcodes/v850-dis.c index 6731137..2970ab9 100644 --- a/opcodes/v850-dis.c +++ b/opcodes/v850-dis.c @@ -47,15 +47,30 @@ print_insn_v850 (memaddr, info) bfd_byte buffer[4]; unsigned long insn; - status = (*info->read_memory_func) (memaddr, buffer, 4, info); + /* First figure out how big the opcode is. */ + status = (*info->read_memory_func) (memaddr, buffer, 2, info); if (status != 0) { (*info->memory_error_func) (status, memaddr, info); return -1; } - insn = bfd_getl32 (buffer); + insn = bfd_getl16 (buffer); + + /* If this is a 4 byte insn, read 4 bytes of stuff. */ + if ((insn & 0x0600) == 0x0600) + { + status = (*info->read_memory_func) (memaddr, buffer, 2, info); + if (status != 0) + { + (*info->memory_error_func) (status, memaddr, info); + return -1; + } + insn = bfd_getl32 (buffer); + } disassemble (insn, info); + + /* Make sure we tell our caller how many bytes we consumed. */ if ((insn & 0x0600) == 0x0600) return 4; else |