Automatic date update in version.in
[platform/upstream/binutils.git] / opcodes / sparc-dis.c
index b7f0cc2..9f0b96e 100644 (file)
@@ -1,7 +1,5 @@
 /* Print SPARC instructions.
-   Copyright 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010
-   Free Software Foundation, Inc.
+   Copyright (C) 1989-2014 Free Software Foundation, Inc.
 
    This file is part of the GNU opcodes library.
 
@@ -20,9 +18,8 @@
    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
    MA 02110-1301, USA.  */
 
-#include <stdio.h>
-
 #include "sysdep.h"
+#include <stdio.h>
 #include "opcode/sparc.h"
 #include "dis-asm.h"
 #include "libiberty.h"
@@ -100,7 +97,7 @@ static char *v9_hpriv_reg_names[] =
   "resv7", "resv8", "resv9", "resv10", "resv11", "resv12", "resv13", 
   "resv14", "resv15", "resv16", "resv17", "resv18", "resv19", "resv20",
   "resv21", "resv22", "resv23", "resv24", "resv25", "resv26", "resv27",
-  "resv28", "resv29", "resv30", "hstick_cmpr"
+  "hstick_offset", "hstick_enable", "resv30", "hstick_cmpr"
 };
 
 /* These are ordered according to there register number in
@@ -108,8 +105,8 @@ static char *v9_hpriv_reg_names[] =
 static char *v9a_asr_reg_names[] =
 {
   "pcr", "pic", "dcr", "gsr", "set_softint", "clear_softint",
-  "softint", "tick_cmpr", "stick", "stick_cmpr", "resv26",
-  "resv27", "cps"
+  "softint", "tick_cmpr", "stick", "stick_cmpr", "cfr",
+  "pause", "mwait"
 };
 
 /* Macros used to extract instruction fields.  Not all fields have
@@ -129,6 +126,7 @@ static char *v9a_asr_reg_names[] =
 
 /* These are for v9.  */
 #define X_DISP16(i)  (((((i) >> 20) & 3) << 14) | (((i) >> 0) & 0x3fff))
+#define X_DISP10(i)  (((((i) >> 19) & 3) << 8) | (((i) >> 5) & 0xff))
 #define X_DISP19(i)  (((i) >> 0) & 0x7ffff)
 #define X_MEMBAR(i)  ((i) & 0x7f)
 
@@ -223,7 +221,8 @@ compute_arch_mask (unsigned long mach)
     {
     case 0 :
     case bfd_mach_sparc :
-      return SPARC_OPCODE_ARCH_MASK (SPARC_OPCODE_ARCH_V8);
+      return (SPARC_OPCODE_ARCH_MASK (SPARC_OPCODE_ARCH_V8)
+              | SPARC_OPCODE_ARCH_MASK (SPARC_OPCODE_ARCH_LEON));
     case bfd_mach_sparc_sparclet :
       return SPARC_OPCODE_ARCH_MASK (SPARC_OPCODE_ARCH_SPARCLET);
     case bfd_mach_sparc_sparclite :
@@ -338,8 +337,17 @@ compare_opcodes (const void * a, const void * b)
   i = strcmp (op0->name, op1->name);
   if (i)
     {
-      if (op0->flags & F_ALIAS) /* If they're both aliases, be arbitrary.  */
-       return i;
+      if (op0->flags & F_ALIAS)
+       {
+         if (op0->flags & F_PREFERRED)
+           return -1;
+         if (op1->flags & F_PREFERRED)
+           return 1;
+
+         /* If they're both aliases, and neither is marked as preferred,
+            be arbitrary.  */
+         return i;
+       }
       else
        fprintf (stderr,
                 /* xgettext:c-format */
@@ -550,7 +558,7 @@ print_insn_sparc (bfd_vma memaddr, disassemble_info *info)
              /* Can't do simple format if source and dest are different.  */
              continue;
 
-         (*info->fprintf_func) (stream, opcode->name);
+         (*info->fprintf_func) (stream, "%s", opcode->name);
 
          {
            const char *s;
@@ -648,6 +656,7 @@ print_insn_sparc (bfd_vma memaddr, disassemble_info *info)
                    break;
                  case 'H':     /* Double/even.  */
                  case 'J':     /* Quad/multiple of 4.  */
+                 case '}':     /* Double/even.  */
                    fregx (X_RD (insn));
                    break;
 #undef freg
@@ -703,6 +712,10 @@ print_insn_sparc (bfd_vma memaddr, disassemble_info *info)
                    }
                    break;
 
+                 case ')':     /* 5 bit unsigned immediate from RS3.  */
+                   (info->fprintf_func) (stream, "%#x", (unsigned int) X_RS3 (insn));
+                   break;
+
                  case 'X':     /* 5 bit unsigned immediate.  */
                  case 'Y':     /* 6 bit unsigned immediate.  */
                    {
@@ -743,6 +756,11 @@ print_insn_sparc (bfd_vma memaddr, disassemble_info *info)
                      break;
                    }
 
+                 case '=':
+                   info->target = memaddr + SEX (X_DISP10 (insn), 10) * 4;
+                   (*info->print_address_func) (info->target, info);
+                   break;
+
                  case 'k':
                    info->target = memaddr + SEX (X_DISP16 (insn), 16) * 4;
                    (*info->print_address_func) (info->target, info);
@@ -776,6 +794,10 @@ print_insn_sparc (bfd_vma memaddr, disassemble_info *info)
                    (*info->fprintf_func) (stream, "%%fprs");
                    break;
 
+                 case '{':
+                   (*info->fprintf_func) (stream, "%%mcdper");
+                   break;
+
                  case 'o':
                    (*info->fprintf_func) (stream, "%%asi");
                    break;