2007-06-29 H.J. Lu <hjl@gnu.org>
[deliverable/binutils-gdb.git] / opcodes / m68k-dis.c
index 08a28384cd212f3608981cf6315d3724f5cccf19..d964ef4b281a3d504b77c6dfcd79980820f26c60 100644 (file)
@@ -645,7 +645,9 @@ print_insn_arg (const char *d,
              {"%dtt0",0x006}, {"%dtt1",0x007}, {"%buscr",0x008},
             {"%usp", 0x800}, {"%vbr", 0x801}, {"%caar", 0x802},
             {"%msp", 0x803}, {"%isp", 0x804},
-            {"%flashbar", 0xc04}, {"%rambar", 0xc05}, /* mcf528x added these.  */
+            /* reg c04 is sometimes called flashbar or rambar.
+               rec c05 is also sometimes called rambar.  */
+            {"%rambar0", 0xc04}, {"%rambar1", 0xc05},
 
             /* Should we be calling this psr like we do in case 'Y'?  */
             {"%mmusr",0x805},
@@ -1475,6 +1477,12 @@ print_insn_m68k (bfd_vma memaddr, disassemble_info *info)
 
   bfd_byte *buffer = priv.the_buffer;
 
+  /* Save these printing functions in case we need to restore them
+     later.  */
+  fprintf_ftype save_printer = info->fprintf_func;
+  void (* save_print_address) (bfd_vma, struct disassemble_info *)
+    = info->print_address_func;
+
   info->private_data = (PTR) &priv;
   /* Tell objdump to use two bytes per chunk
      and six bytes per line for displaying raw data.  */
@@ -1485,8 +1493,26 @@ print_insn_m68k (bfd_vma memaddr, disassemble_info *info)
   priv.insn_start = memaddr;
 
   if (setjmp (priv.bailout) != 0)
-    /* Error return.  */
-    return -1;
+    {
+      /* longjmp may be called while these printing functions are
+        temporarily replaced with dummy functions.  Restore them
+        before we leave.
+
+        Admittedly, this save-and-restore operation is somewhat ugly
+        in that we are exposing the fact that match_insn_m68k
+        temporarily replaces insn->fprintf_func and
+        insn->print_address_func.  Perhaps, a real fix is to report a
+        FETCH_DATA failure with a return value of some sort, without
+        using setjmp/longjmp.  A better fix may be to teach the m68k
+        disassembler do its job without temporarily replacing
+        insn->fprintf_func and insn->print_address_func, but that's a
+        task for another day.  */
+      info->fprintf_func = save_printer;
+      info->print_address_func = save_print_address;
+
+      /* Error return.  */
+      return -1;
+    }
 
   arch_mask = bfd_m68k_mach_to_features (info->mach);
   if (!arch_mask)
This page took 0.023152 seconds and 4 git commands to generate.