* opcodess/arm-opc.h (arm_opcodes): Add cirrus insns.
[deliverable/binutils-gdb.git] / opcodes / arm-dis.c
index 686b18a1a919dd83e0e505fd4aa45d7882025f88..104b933bbc2fb1f1591701f703ea5de75ec09828 100644 (file)
@@ -1,5 +1,6 @@
 /* Instruction printing code for the ARM
-   Copyright (C) 1994, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. 
+   Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+   Free Software Foundation, Inc.
    Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
    Modification by James G. Smith (jsmith@cygnus.co.uk)
 
@@ -200,7 +201,7 @@ print_insn_arm (pc, info, given)
                                offset = - offset;
                          
                              /* pre-indexed */
-                             func (stream, ", #%x]", offset);
+                             func (stream, ", #%d]", offset);
 
                              offset += pc + 8;
 
@@ -214,7 +215,7 @@ print_insn_arm (pc, info, given)
                          else
                            {
                              /* Post indexed.  */
-                             func (stream, "], #%x", offset);
+                             func (stream, "], #%d", offset);
 
                              offset = pc + 8;  /* ie ignore the offset.  */
                            }
@@ -279,7 +280,7 @@ print_insn_arm (pc, info, given)
                          if ((given & 0x00800000) == 0)
                            offset = -offset;
                          
-                         func (stream, "[pc, #%x]\t; ", offset);
+                         func (stream, "[pc, #%d]\t; ", offset);
                          
                          (*info->print_address_func)
                            (offset + pc + 8, info);
@@ -444,6 +445,25 @@ print_insn_arm (pc, info, given)
                      }
                      break;
 
+                   case 'I':
+                     /* Print a Cirrus/DSP shift immediate.  */
+                     /* Immediates are 7bit signed ints with bits 0..3 in
+                        bits 0..3 of opcode and bits 4..6 in bits 5..7
+                        of opcode.  */
+                     {
+                       int imm;
+
+                       imm = (given & 0xf) | ((given & 0xe0) >> 1);
+
+                       /* Is ``imm'' a negative number?  */
+                       if (imm & 0x40)
+                         imm |= (-1 << 7);
+
+                       func (stream, "%d", imm);
+                     }
+
+                     break;
+
                    case 'C':
                      func (stream, "_");
                      if (given & 0x80000)
@@ -668,15 +688,32 @@ print_insn_thumb (pc, info, given)
           /* Special processing for Thumb 2 instruction BL sequence:  */
           if (!*c) /* Check for empty (not NULL) assembler string.  */
             {
+             long offset;
+             
              info->bytes_per_chunk = 4;
              info->bytes_per_line  = 4;
+
+             offset = BDISP23 (given);
              
              if ((given & 0x10000000) == 0)
-                 func (stream, "blx\t");
+               {
+                 func (stream, "blx\t");
+
+                 /* The spec says that bit 1 of the branch's destination
+                    address comes from bit 1 of the instruction's
+                    address and not from the offset in the instruction.  */
+                 if (offset & 0x1)
+                   {
+                     /* func (stream, "*malformed!* "); */
+                     offset &= ~ 0x1;
+                   }
+
+                 offset |= ((pc & 0x2) >> 1);
+               }
              else
-                func (stream, "bl\t");
-               
-              info->print_address_func (BDISP23 (given) * 2 + pc + 4, info);
+               func (stream, "bl\t");
+
+             info->print_address_func (offset * 2 + pc + 4, info);
               return 4;
             }
           else
@@ -1087,7 +1124,7 @@ the -M switch:\n"));
   for (i = NUM_ARM_REGNAMES; i--;)
     fprintf (stream, "  reg-names-%s %*c%s\n",
             regnames[i].name,
-            14 - strlen (regnames[i].name), ' ',
+            (int)(14 - strlen (regnames[i].name)), ' ',
             regnames[i].description);
 
   fprintf (stream, "  force-thumb              Assume all insns are Thumb insns\n");
This page took 0.0272 seconds and 4 git commands to generate.