This fixes ! to work as documented in a memory region attribute list.
[deliverable/binutils-gdb.git] / opcodes / a29k-dis.c
index 7808a8e0fd3d77edff5defd9d77e9ae5963d5601..72959c975d99d9aa528108b26cae40b0a2d7837d 100644 (file)
@@ -1,5 +1,5 @@
 /* Instruction printing code for the AMD 29000
-   Copyright (C) 1990 Free Software Foundation, Inc.
+   Copyright (C) 1990, 93, 94, 95, 1998 Free Software Foundation, Inc.
    Contributed by Cygnus Support.  Written by Jim Kingdon.
 
 This file is part of GDB.
@@ -16,7 +16,7 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "dis-asm.h"
 #include "opcode/a29k.h"
@@ -43,13 +43,15 @@ print_general (num, info)
    assembler uses.  */
 static void
 print_special (num, info)
-     int num;
+     unsigned int num;
      struct disassemble_info *info;
 {
   /* Register names of registers 0-SPEC0_NUM-1.  */
   static char *spec0_names[] = {
     "vab", "ops", "cps", "cfg", "cha", "chd", "chc", "rbp", "tmc", "tmr",
-    "pc0", "pc1", "pc2", "mmu", "lru"
+    "pc0", "pc1", "pc2", "mmu", "lru", "rsn", "rma0", "rmc0", "rma1", "rmc1",
+    "spc0", "spc1", "spc2", "iba0", "ibc0", "iba1", "ibc1", "dba", "dbc",
+    "cir", "cdr"
     };
 #define SPEC0_NUM ((sizeof spec0_names) / (sizeof spec0_names[0]))
 
@@ -117,12 +119,13 @@ find_bytes_little (insn, insn0, insn8, insn16, insn24)
   *insn0 = insn[0];
 }
 
-typedef (*find_byte_func_type)
+typedef void (*find_byte_func_type)
      PARAMS ((char *, unsigned char *, unsigned char *,
              unsigned char *, unsigned char *));
 
-/* Print one instruction from MEMADDR on STREAM.
+/* Print one instruction from MEMADDR on INFO->STREAM.
    Return the size of the instruction (always 4 on a29k).  */
+
 static int
 print_insn (memaddr, info)
      bfd_vma memaddr;
@@ -136,11 +139,11 @@ print_insn (memaddr, info)
 
   find_byte_func_type find_byte_func = (find_byte_func_type)info->private_data;
 
-  struct a29k_opcode const * opcode;
+  struct a29k_opcode CONST * opcode;
 
   {
     int status =
-      (*info->read_memory_func) (memaddr, (char *) &insn[0], 4, info);
+      (*info->read_memory_func) (memaddr, (bfd_byte *) &insn[0], 4, info);
     if (status != 0)
       {
        (*info->memory_error_func) (status, memaddr, info);
@@ -150,6 +153,8 @@ print_insn (memaddr, info)
 
   (*find_byte_func) (insn, &insn0, &insn8, &insn16, &insn24);
 
+  printf ("%02x%02x%02x%02x ", insn24, insn16, insn8, insn0);
+
   /* Handle the nop (aseq 0x40,gr1,gr1) specially */
   if ((insn24==0x70) && (insn16==0x40) && (insn8==0x01) && (insn0==0x01)) {
     (*info->fprintf_func) (info->stream,"nop");
@@ -161,7 +166,7 @@ print_insn (memaddr, info)
        opcode < &a29k_opcodes[num_opcodes];
        ++opcode)
     {
-      if ((insn24<<24) == opcode->opcode)
+      if (((unsigned long) insn24 << 24) == opcode->opcode)
        {
          char *s;
          
@@ -187,7 +192,7 @@ print_insn (memaddr, info)
                  break;
 
                case 'x':
-                 (*info->fprintf_func) (info->stream, "%d", (insn16 << 8) + insn0);
+                 (*info->fprintf_func) (info->stream, "0x%x", (insn16 << 8) + insn0);
                  break;
 
                case 'h':
@@ -241,6 +246,11 @@ print_insn (memaddr, info)
                  (*info->fprintf_func) (info->stream, "%d", (insn0 >> 4) & 7);
                  break;
 
+               case 'I':
+                 if ((insn16 & 3) != 0)
+                   (*info->fprintf_func) (info->stream, "%d", insn16 & 3);
+                 break;
+
                case 'd':
                  (*info->fprintf_func) (info->stream, "%d", (insn0 >> 2) & 3);
                  break;
@@ -271,7 +281,7 @@ print_insn (memaddr, info)
              unsigned char prev_insn0, prev_insn8, prev_insn16, prev_insn24;
              
              errcode = (*info->read_memory_func) (memaddr - 4,
-                                                  &prev_insn[0],
+                                                  (bfd_byte *) &prev_insn[0],
                                                   4,
                                                   info);
              if (errcode == 0)
@@ -289,7 +299,7 @@ print_insn (memaddr, info)
                  if (is_delayed_branch (prev_insn24))
                    {
                      errcode = (*info->read_memory_func)
-                       (memaddr - 8, &prev_insn[0], 4, info);
+                       (memaddr - 8, (bfd_byte *) &prev_insn[0], 4, info);
                      (*find_byte_func) (prev_insn, &prev_insn0, &prev_insn8,
                                         &prev_insn16, &prev_insn24);
                    }
@@ -317,7 +327,7 @@ print_insn (memaddr, info)
     }
   /* This used to be %8x for binutils.  */
   (*info->fprintf_func)
-    (info->stream, ".word 0x%8x",
+    (info->stream, ".word 0x%08x",
      (insn24 << 24) + (insn16 << 16) + (insn8 << 8) + insn0);
   return 4;
 }
This page took 0.0248660000000001 seconds and 4 git commands to generate.