*** empty log message ***
[deliverable/binutils-gdb.git] / opcodes / v850-dis.c
index c43f6dbea7047d51a66fabbcdc2c5364de56d01f..7c449f67ad1c44434d1d2e9a7bb6e869925bc5a9 100644 (file)
@@ -1,5 +1,6 @@
 /* Disassemble V850 instructions.
-   Copyright (C) 1996 Free Software Foundation, Inc.
+   Copyright 1996, 1997, 1998, 2000, 2001, 2002
+   Free Software Foundation, Inc.
 
 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
@@ -18,9 +19,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include <stdio.h>
 
-#include "ansidecl.h"
+#include "sysdep.h"
 #include "opcode/v850.h" 
 #include "dis-asm.h"
+#include "opintl.h"
 
 static const char *const v850_reg_names[] =
 { "r0", "r1", "r2", "sp", "gp", "r5", "r6", "r7", 
@@ -31,10 +33,8 @@ static const char *const v850_reg_names[] =
 static const char *const v850_sreg_names[] =
 { "eipc", "eipsw", "fepc", "fepsw", "ecr", "psw", "sr6", "sr7", 
   "sr8", "sr9", "sr10", "sr11", "sr12", "sr13", "sr14", "sr15",
-/* start-sanitize-v850e */
   "ctpc", "ctpsw", "dbpc", "dbpsw", "ctbp", "sr21", "sr22", "sr23", 
   "sr24", "sr25", "sr26", "sr27", "sr28", "sr29", "sr30", "sr31",
-/* end-sanitize-v850e */
   "sr16", "sr17", "sr18", "sr19", "sr20", "sr21", "sr22", "sr23", 
   "sr24", "sr25", "sr26", "sr27", "sr28", "sr29", "sr30", "sr31" };
 
@@ -42,24 +42,25 @@ static const char *const v850_cc_names[] =
 { "v", "c/l", "z", "nh", "s/n", "t", "lt", "le", 
   "nv", "nc/nl", "nz", "h", "ns/p", "sa", "ge", "gt" };
 
+static int disassemble
+  PARAMS ((bfd_vma, struct disassemble_info *, unsigned long));
+
 static int
 disassemble (memaddr, info, insn)
      bfd_vma memaddr;
      struct disassemble_info *info;
      unsigned long insn;
 {
-  struct v850_opcode *          op = (struct v850_opcode *)v850_opcodes;
-  const struct v850_operand *   operand;
-  int                           match = 0;
-  int                          short_op = ((insn & 0x0600) != 0x0600);
-  int                          bytes_read;
-  int                          target_processor;
+  struct v850_opcode *op = (struct v850_opcode *)v850_opcodes;
+  const struct v850_operand *operand;
+  int match = 0;
+  int short_op = ((insn & 0x0600) != 0x0600);
+  int bytes_read;
+  int target_processor;
   
-/* start-sanitize-v850e */
   /* Special case: 32 bit MOV */
   if ((insn & 0xffe0) == 0x0620)
-    short_op = true;
-/* end-sanitize-v850e */
+    short_op = 1;
   
   bytes_read = short_op ? 2 : 4;
   
@@ -74,15 +75,9 @@ disassemble (memaddr, info, insn)
       target_processor = PROCESSOR_V850;
       break;
 
-/* start-sanitize-v850e */
     case bfd_mach_v850e:
       target_processor = PROCESSOR_V850E;
       break;
-
-    case bfd_mach_v850eq: 
-      target_processor = PROCESSOR_V850EQ;
-      break;
-/* end-sanitize-v850e */
     }
   
   /* Find the opcode.  */
@@ -91,13 +86,13 @@ disassemble (memaddr, info, insn)
       if ((op->mask & insn) == op->opcode
          && (op->processors & target_processor))
        {
-         const unsigned char * opindex_ptr;
-         unsigned int          opnum;
-         unsigned int          memop;
+         const unsigned char *opindex_ptr;
+         unsigned int opnum;
+         unsigned int memop;
 
          match = 1;
          (*info->fprintf_func) (info->stream, "%s\t", op->name);
-//fprintf (stderr, "match: mask: %x insn: %x, opcode: %x, name: %s\n", op->mask, insn, op->opcode, op->name );
+/*fprintf (stderr, "match: mask: %x insn: %x, opcode: %x, name: %s\n", op->mask, insn, op->opcode, op->name );*/
 
          memop = op->memop;
          /* Now print the operands.
@@ -117,10 +112,10 @@ disassemble (memaddr, info, insn)
               *opindex_ptr != 0;
               opindex_ptr++, opnum++)
            {
-             long      value;
-             int       flag;
-             int       status;
-             bfd_byte  buffer[ 4 ];
+             long value;
+             int flag;
+             int status;
+             bfd_byte buffer[4];
              
              operand = &v850_operands[*opindex_ptr];
              
@@ -204,17 +199,16 @@ disassemble (memaddr, info, insn)
                    break;
                  }
                    
-/* start-sanitize-v850e */
                case V850E_PUSH_POP:
                  {
                    static int list12_regs[32]   = { 30,  0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  0,  0, 31, 29, 28, 23, 22, 21, 20, 27, 26, 25, 24 };
                    static int list18_h_regs[32] = { 19, 18, 17, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 30, 31, 29, 28, 23, 22, 21, 20, 27, 26, 25, 24 };
                    static int list18_l_regs[32] = {  3,  2,  1, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 14, 15, 13, 12,  7,  6,  5,  4, 11, 10,  9,  8 };
-                   int *             regs;
-                   int               i;
+                   int *regs;
+                   int i;
                    unsigned long int mask = 0;
-                   int               pc   = false;
-                   int               sr   = false;
+                   int pc = 0;
+                   int sr = 0;
                    
                    
                    switch (operand->shift)
@@ -223,7 +217,8 @@ disassemble (memaddr, info, insn)
                      case 0xfff8000f: regs = list18_h_regs; break;
                      case 0xfff8001f: regs = list18_l_regs; value &= ~0x10; break;  /* Do not include magic bit */
                      default:
-                       fprintf (stderr, "unknown operand shift: %x\n", operand->shift );                   
+                       /* xgettext:c-format */
+                       fprintf (stderr, _("unknown operand shift: %x\n"), operand->shift );
                        abort();
                      }
 
@@ -234,9 +229,10 @@ disassemble (memaddr, info, insn)
                            switch (regs[ i ])
                              {
                              default: mask |= (1 << regs[ i ]); break;
-                             case 0:  fprintf (stderr, "unknown pop reg: %d\n", i ); abort();
-                             case -1: pc = true; break;
-                             case -2: sr = true; break;
+                               /* xgettext:c-format */
+                             case 0:  fprintf (stderr, _("unknown pop reg: %d\n"), i ); abort();
+                             case -1: pc = 1; break;
+                             case -2: sr = 1; break;
                              }
                          }
                      }
@@ -248,7 +244,7 @@ disassemble (memaddr, info, insn)
                        if (mask)
                          {
                            unsigned int bit;
-                           int          shown_one = false;
+                           int shown_one = 0;
                            
                            for (bit = 0; bit < 32; bit++)
                              if (mask & (1 << bit))
@@ -259,7 +255,7 @@ disassemble (memaddr, info, insn)
                                  if (shown_one)
                                    info->fprintf_func (info->stream, ", ");
                                  else
-                                   shown_one = true;
+                                   shown_one = 1;
                                  
                                  info->fprintf_func (info->stream, v850_reg_names[first]);
                                  
@@ -318,7 +314,6 @@ disassemble (memaddr, info, insn)
                      info->memory_error_func (status, memaddr + bytes_read, info);
                    }
                  break;
-/* end-sanitize-v850e */
                }                 
 
              /* Handle jmp correctly.  */
@@ -353,9 +348,9 @@ print_insn_v850 (memaddr, info)
      bfd_vma memaddr;
      struct disassemble_info * info;
 {
-  int           status;
-  bfd_byte      buffer[ 4 ];
-  unsigned long insn;
+  int status;
+  bfd_byte buffer[4];
+  unsigned long insn = 0;
 
   /* First figure out how big the opcode is.  */
   
This page took 0.026108 seconds and 4 git commands to generate.