From: Jeff Law Date: Sat, 31 Aug 1996 21:21:27 +0000 (+0000) Subject: * v850-dis.c (print_insn_v850): Properly handle disassembling X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e05cae190b4917c8d045244469d2161c1574cb5c;p=binutils-gdb.git * 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. --- diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index ff369ead23d..ba6cd41612c 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 673113724cd..2970ab913b9 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