X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=opcodes%2Fsparc-dis.c;h=d48dee5d757e995eb6728e4628eb7e3035ee42d5;hb=8b89fe14b522cd6e5d160ff17defa8ecec243b11;hp=7857e4ca2b27218706d4bfe49844f470eb51c891;hpb=2615994e91176ae1a147439f81c452e5f5965920;p=deliverable%2Fbinutils-gdb.git diff --git a/opcodes/sparc-dis.c b/opcodes/sparc-dis.c index 7857e4ca2b..d48dee5d75 100644 --- a/opcodes/sparc-dis.c +++ b/opcodes/sparc-dis.c @@ -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-2016 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 - #include "sysdep.h" +#include #include "opcode/sparc.h" #include "dis-asm.h" #include "libiberty.h" @@ -31,7 +28,12 @@ /* Bitmask of v9 architectures. */ #define MASK_V9 ((1 << SPARC_OPCODE_ARCH_V9) \ | (1 << SPARC_OPCODE_ARCH_V9A) \ - | (1 << SPARC_OPCODE_ARCH_V9B)) + | (1 << SPARC_OPCODE_ARCH_V9B) \ + | (1 << SPARC_OPCODE_ARCH_V9C) \ + | (1 << SPARC_OPCODE_ARCH_V9D) \ + | (1 << SPARC_OPCODE_ARCH_V9E) \ + | (1 << SPARC_OPCODE_ARCH_V9V) \ + | (1 << SPARC_OPCODE_ARCH_V9M)) /* 1 if INSN is for v9 only. */ #define V9_ONLY_P(insn) (! ((insn)->architecture & ~MASK_V9)) /* 1 if INSN is for v9. */ @@ -89,7 +91,7 @@ static char *v9_priv_reg_names[] = "tpc", "tnpc", "tstate", "tt", "tick", "tba", "pstate", "tl", "pil", "cwp", "cansave", "canrestore", "cleanwin", "otherwin", "wstate", "fq", "gl" - /* "ver" - special cased */ + /* "ver" and "pmcdper" - special cased */ }; /* These are ordered according to there register number in @@ -97,19 +99,19 @@ static char *v9_priv_reg_names[] = static char *v9_hpriv_reg_names[] = { "hpstate", "htstate", "resv2", "hintp", "resv4", "htba", "hver", - "resv7", "resv8", "resv9", "resv10", "resv11", "resv12", "resv13", + "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" + "resv21", "resv22", "hmcdper", "hmcddfr", "resv25", "resv26", "hva_mask_nz", + "hstick_offset", "hstick_enable", "resv30", "hstick_cmpr" }; /* These are ordered according to there register number in rd and wr insns (-16). */ static char *v9a_asr_reg_names[] = { - "pcr", "pic", "dcr", "gsr", "set_softint", "clear_softint", - "softint", "tick_cmpr", "stick", "stick_cmpr", "resv26", - "resv27", "cps" + "pcr", "pic", "dcr", "gsr", "softint_set", "softint_clear", + "softint", "tick_cmpr", "stick", "stick_cmpr", "cfr", + "pause", "mwait" }; /* Macros used to extract instruction fields. Not all fields have @@ -224,7 +226,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 : @@ -243,6 +246,21 @@ compute_arch_mask (unsigned long mach) case bfd_mach_sparc_v8plusb : case bfd_mach_sparc_v9b : return SPARC_OPCODE_ARCH_MASK (SPARC_OPCODE_ARCH_V9B); + case bfd_mach_sparc_v8plusc : + case bfd_mach_sparc_v9c : + return SPARC_OPCODE_ARCH_MASK (SPARC_OPCODE_ARCH_V9C); + case bfd_mach_sparc_v8plusd : + case bfd_mach_sparc_v9d : + return SPARC_OPCODE_ARCH_MASK (SPARC_OPCODE_ARCH_V9D); + case bfd_mach_sparc_v8pluse : + case bfd_mach_sparc_v9e : + return SPARC_OPCODE_ARCH_MASK (SPARC_OPCODE_ARCH_V9E); + case bfd_mach_sparc_v8plusv : + case bfd_mach_sparc_v9v : + return SPARC_OPCODE_ARCH_MASK (SPARC_OPCODE_ARCH_V9V); + case bfd_mach_sparc_v8plusm : + case bfd_mach_sparc_v9m : + return SPARC_OPCODE_ARCH_MASK (SPARC_OPCODE_ARCH_V9M); } abort (); } @@ -339,8 +357,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 */ @@ -551,7 +578,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; @@ -649,6 +676,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 @@ -704,6 +732,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. */ { @@ -782,6 +814,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; @@ -797,6 +833,8 @@ print_insn_sparc (bfd_vma memaddr, disassemble_info *info) case '?': if (X_RS1 (insn) == 31) (*info->fprintf_func) (stream, "%%ver"); + else if (X_RS1 (insn) == 23) + (*info->fprintf_func) (stream, "%%pmcdper"); else if ((unsigned) X_RS1 (insn) < 17) (*info->fprintf_func) (stream, "%%%s", v9_priv_reg_names[X_RS1 (insn)]); @@ -805,7 +843,11 @@ print_insn_sparc (bfd_vma memaddr, disassemble_info *info) break; case '!': - if ((unsigned) X_RD (insn) < 17) + if (X_RD (insn) == 31) + (*info->fprintf_func) (stream, "%%ver"); + else if (X_RD (insn) == 23) + (*info->fprintf_func) (stream, "%%pmcdper"); + else if ((unsigned) X_RD (insn) < 17) (*info->fprintf_func) (stream, "%%%s", v9_priv_reg_names[X_RD (insn)]); else