* complaints.c: New file, code moved from utils.c.
[deliverable/binutils-gdb.git] / gdb / am29k-pinsn.c
index c933629d7acc277aa26d2234f2f5d24d31f55f08..337bf90c34bcc630e1fadc5006b94ea9045b7d31 100644 (file)
@@ -6,8 +6,8 @@ This file is part of GDB.
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 1, or (at your option)
-any later version.
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -15,14 +15,12 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with this program; see the file COPYING.  If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
-
-#include <stdio.h>
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include "defs.h"
 #include "target.h"
-#include "am29k-opcode.h"
+#include "opcode/a29k.h"
 
 /* Print a symbolic representation of a general-purpose
    register number NUM on STREAM.
@@ -129,18 +127,24 @@ print_insn (memaddr, stream)
   /* The four bytes of the instruction.  */
   unsigned char insn24, insn16, insn8, insn0;
 
-  struct am29k_opcode *opcode;
+  struct a29k_opcode *opcode;
 
   read_memory (memaddr, &insn[0], 4);
 
   find_bytes (insn, &insn0, &insn8, &insn16, &insn24);
 
+  /* Handle the nop (aseq 0x40,gr1,gr1) specially */
+  if ((insn24==0x70) && (insn16==0x40) && (insn8==0x01) && (insn0==0x01)) {
+    fprintf_filtered (stream,"nop");
+    return 4;
+  }
+
   /* The opcode is always in insn24.  */
-  for (opcode = &am29k_opcodes[0];
-       opcode < &am29k_opcodes[NUM_OPCODES];
+  for (opcode = &a29k_opcodes[0];
+       opcode < &a29k_opcodes[num_opcodes];
        ++opcode)
     {
-      if (insn24 == opcode->opcode)
+      if ((insn24<<24) == opcode->opcode)
        {
          char *s;
          
@@ -203,7 +207,7 @@ print_insn (memaddr, stream)
                  break;
 
                case 'v':
-                 fprintf_filtered (stream, "%#x", insn16);
+                 fprintf_filtered (stream, "0x%x", insn16);
                  break;
 
                case 's':
@@ -227,11 +231,11 @@ print_insn (memaddr, stream)
                  break;
 
                case 'F':
-                 fprintf_filtered (stream, "%d", (insn0 >> 18) & 15);
+                 fprintf_filtered (stream, "%d", (insn16 >> 2) & 15);
                  break;
 
                case 'C':
-                 fprintf_filtered (stream, "%d", (insn0 >> 16) & 3);
+                 fprintf_filtered (stream, "%d", insn16 & 3);
                  break;
 
                default:
@@ -290,7 +294,7 @@ print_insn (memaddr, stream)
          return 4;
        }
     }
-  fprintf_filtered (stream, ".word %#8x",
+  fprintf_filtered (stream, ".word 0x%8x",
                    (insn24 << 24) + (insn16 << 16) + (insn8 << 8) + insn0);
   return 4;
 }
This page took 0.024272 seconds and 4 git commands to generate.