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.
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