aboutsummaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>1996-08-31 21:21:27 +0000
committerJeff Law <law@redhat.com>1996-08-31 21:21:27 +0000
commite05cae190b4917c8d045244469d2161c1574cb5c (patch)
tree29069f322835d9aba6bdc265e63dd461ebb31811 /opcodes
parenta5f2a4e50e373ca13b5a637397f68356dae93415 (diff)
downloadgdb-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')
-rw-r--r--opcodes/ChangeLog4
-rw-r--r--opcodes/v850-dis.c19
2 files changed, 21 insertions, 2 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index ff369ea..ba6cd41 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,6 +1,10 @@
start-sanitize-v850
Sat Aug 31 01:27:26 1996 Jeffrey A Law (law@cygnus.com)
+ * 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.
+
* v850-dis.c (v850_cc_names): Fix stupid thinkos.
* v850-dis.c (v850_reg_names): Define.
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