* v850-dis.c (print_insn_v850): Properly handle disassembling
authorJeff Law <law@redhat.com>
Sat, 31 Aug 1996 21:21:27 +0000 (21:21 +0000)
committerJeff Law <law@redhat.com>
Sat, 31 Aug 1996 21:21:27 +0000 (21:21 +0000)
        a two byte insn at the end of a memory region when the memory
        region's size is only two byte aligned.

opcodes/ChangeLog
opcodes/v850-dis.c

index ff369ead23dd2a9c5ecaea2ee50b668b077832be..ba6cd41612c24bd4c48fc3f801538d05e404d7eb 100644 (file)
@@ -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.
index 673113724cdc3ba9a6353dd0251d3607403d4749..2970ab913b94d5cf7da84a9f157e82b7761581b7 100644 (file)
@@ -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
This page took 0.027383 seconds and 4 git commands to generate.