/* Table of opcodes for the sparc.
Copyright 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2002, 2004
+ 2000, 2002, 2004, 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
-This file is part of the BFD library.
+ This file is part of the GNU opcodes library.
-BFD 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 2, or (at your option) any later
-version.
+ This library 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 3, or (at your option)
+ any later version.
-BFD is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-for more details.
+ It is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of 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 file; see the file COPYING. If not, write to the
+ Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston,
+ MA 02110-1301, USA. */
-You should have received a copy of the GNU General Public License
-along with this software; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
/* FIXME-someday: perhaps the ,a's and such should be embedded in the
instruction's name rather than the args. This would make gas faster, pinsn
#define v6 (MASK_V6 | MASK_V7 | MASK_V8 | MASK_SPARCLET \
| MASK_SPARCLITE | MASK_V9 | MASK_V9A | MASK_V9B)
-/* v6 insns not supported on the sparclet */
+/* v6 insns not supported on the sparclet. */
#define v6notlet (MASK_V6 | MASK_V7 | MASK_V8 \
| MASK_SPARCLITE | MASK_V9 | MASK_V9A | MASK_V9B)
#define v7 (MASK_V7 | MASK_V8 | MASK_SPARCLET \
#define v9 (MASK_V9 | MASK_V9A | MASK_V9B)
#define v9a (MASK_V9A | MASK_V9B)
#define v9b (MASK_V9B)
-/* v6 insns not supported by v9 */
+/* v6 insns not supported by v9. */
#define v6notv9 (MASK_V6 | MASK_V7 | MASK_V8 \
| MASK_SPARCLET | MASK_SPARCLITE)
/* v9a instructions which would appear to be aliases to v9's impdep's
- otherwise */
+ otherwise. */
#define v9notv9a (MASK_V9)
/* Table of opcode architectures.
The order is defined in opcode/sparc.h. */
-const struct sparc_opcode_arch sparc_opcode_archs[] = {
+const struct sparc_opcode_arch sparc_opcode_archs[] =
+{
{ "v6", MASK_V6 },
{ "v7", MASK_V6 | MASK_V7 },
{ "v8", MASK_V6 | MASK_V7 | MASK_V8 },
/* Given NAME, return it's architecture entry. */
enum sparc_opcode_arch_val
-sparc_opcode_lookup_arch (name)
- const char *name;
+sparc_opcode_lookup_arch (const char *name)
{
const struct sparc_opcode_arch *p;
for (p = &sparc_opcode_archs[0]; p->name; ++p)
- {
- if (strcmp (name, p->name) == 0)
- return (enum sparc_opcode_arch_val) (p - &sparc_opcode_archs[0]);
- }
+ if (strcmp (name, p->name) == 0)
+ return (enum sparc_opcode_arch_val) (p - &sparc_opcode_archs[0]);
return SPARC_OPCODE_ARCH_BAD;
}
\f
/* Branch condition field. */
-#define COND(x) (((x)&0xf)<<25)
+#define COND(x) (((x) & 0xf) << 25)
/* v9: Move (MOVcc and FMOVcc) condition field. */
-#define MCOND(x,i_or_f) ((((i_or_f)&1)<<18)|(((x)>>11)&(0xf<<14))) /* v9 */
+#define MCOND(x,i_or_f) ((((i_or_f) & 1) << 18) | (((x) >> 11) & (0xf << 14))) /* v9 */
/* v9: Move register (MOVRcc and FMOVRcc) condition field. */
-#define RCOND(x) (((x)&0x7)<<10) /* v9 */
-
-#define CONDA (COND(0x8))
-#define CONDCC (COND(0xd))
-#define CONDCS (COND(0x5))
-#define CONDE (COND(0x1))
-#define CONDG (COND(0xa))
-#define CONDGE (COND(0xb))
-#define CONDGU (COND(0xc))
-#define CONDL (COND(0x3))
-#define CONDLE (COND(0x2))
-#define CONDLEU (COND(0x4))
-#define CONDN (COND(0x0))
-#define CONDNE (COND(0x9))
-#define CONDNEG (COND(0x6))
-#define CONDPOS (COND(0xe))
-#define CONDVC (COND(0xf))
-#define CONDVS (COND(0x7))
+#define RCOND(x) (((x) & 0x7) << 10) /* v9 */
+
+#define CONDA (COND (0x8))
+#define CONDCC (COND (0xd))
+#define CONDCS (COND (0x5))
+#define CONDE (COND (0x1))
+#define CONDG (COND (0xa))
+#define CONDGE (COND (0xb))
+#define CONDGU (COND (0xc))
+#define CONDL (COND (0x3))
+#define CONDLE (COND (0x2))
+#define CONDLEU (COND (0x4))
+#define CONDN (COND (0x0))
+#define CONDNE (COND (0x9))
+#define CONDNEG (COND (0x6))
+#define CONDPOS (COND (0xe))
+#define CONDVC (COND (0xf))
+#define CONDVS (COND (0x7))
#define CONDNZ CONDNE
#define CONDZ CONDE
#define CONDGEU CONDCC
#define CONDLU CONDCS
-#define FCONDA (COND(0x8))
-#define FCONDE (COND(0x9))
-#define FCONDG (COND(0x6))
-#define FCONDGE (COND(0xb))
-#define FCONDL (COND(0x4))
-#define FCONDLE (COND(0xd))
-#define FCONDLG (COND(0x2))
-#define FCONDN (COND(0x0))
-#define FCONDNE (COND(0x1))
-#define FCONDO (COND(0xf))
-#define FCONDU (COND(0x7))
-#define FCONDUE (COND(0xa))
-#define FCONDUG (COND(0x5))
-#define FCONDUGE (COND(0xc))
-#define FCONDUL (COND(0x3))
-#define FCONDULE (COND(0xe))
+#define FCONDA (COND (0x8))
+#define FCONDE (COND (0x9))
+#define FCONDG (COND (0x6))
+#define FCONDGE (COND (0xb))
+#define FCONDL (COND (0x4))
+#define FCONDLE (COND (0xd))
+#define FCONDLG (COND (0x2))
+#define FCONDN (COND (0x0))
+#define FCONDNE (COND (0x1))
+#define FCONDO (COND (0xf))
+#define FCONDU (COND (0x7))
+#define FCONDUE (COND (0xa))
+#define FCONDUG (COND (0x5))
+#define FCONDUGE (COND (0xc))
+#define FCONDUL (COND (0x3))
+#define FCONDULE (COND (0xe))
#define FCONDNZ FCONDNE
#define FCONDZ FCONDE
-#define ICC (0) /* v9 */
-#define XCC (1<<12) /* v9 */
-#define FCC(x) (((x)&0x3)<<11) /* v9 */
-#define FBFCC(x) (((x)&0x3)<<20) /* v9 */
+#define ICC (0) /* v9 */
+#define XCC (1 << 12) /* v9 */
+#define FCC(x) (((x) & 0x3) << 11) /* v9 */
+#define FBFCC(x) (((x) & 0x3) << 20) /* v9 */
\f
/* The order of the opcodes in the table is significant:
-
+
* The assembler requires that all instances of the same mnemonic must
be consecutive. If they aren't, the assembler will bomb at runtime.
- * The disassembler should not care about the order of the opcodes.
-
-*/
+ * The disassembler should not care about the order of the opcodes. */
/* Entries for commutative arithmetic operations. */
/* ??? More entries can make use of this. */
{ "retry", F3(2, 0x3e, 0)|RD(1), F3(~2, ~0x3e, ~0)|RD(~1)|RS1_G0|SIMM13(~0), "", 0, v9 },
{ "saved", F3(2, 0x31, 0)|RD(0), F3(~2, ~0x31, ~0)|RD(~0)|RS1_G0|SIMM13(~0), "", 0, v9 },
{ "restored", F3(2, 0x31, 0)|RD(1), F3(~2, ~0x31, ~0)|RD(~1)|RS1_G0|SIMM13(~0), "", 0, v9 },
+{ "allclean", F3(2, 0x31, 0)|RD(2), F3(~2, ~0x31, ~0)|RD(~2)|RS1_G0|SIMM13(~0), "", 0, v9 },
+{ "otherw", F3(2, 0x31, 0)|RD(3), F3(~2, ~0x31, ~0)|RD(~3)|RS1_G0|SIMM13(~0), "", 0, v9 },
+{ "normalw", F3(2, 0x31, 0)|RD(4), F3(~2, ~0x31, ~0)|RD(~4)|RS1_G0|SIMM13(~0), "", 0, v9 },
+{ "invalw", F3(2, 0x31, 0)|RD(5), F3(~2, ~0x31, ~0)|RD(~5)|RS1_G0|SIMM13(~0), "", 0, v9 },
{ "sir", F3(2, 0x30, 1)|RD(0xf), F3(~2, ~0x30, ~1)|RD(~0xf)|RS1_G0, "i", 0, v9 },
{ "flush", F3(2, 0x3b, 0), F3(~2, ~0x3b, ~0)|ASI(~0), "1+2", 0, v8 },
{ "wrpr", F3(2, 0x32, 1), F3(~2, ~0x32, ~1), "i,1,!", F_ALIAS, v9 }, /* wrpr i,r1,%priv */
{ "wrpr", F3(2, 0x32, 1), F3(~2, ~0x32, ~1)|RS1(~0), "i,!", 0, v9 }, /* wrpr i,%priv */
+{ "rdhpr", F3(2, 0x29, 0), F3(~2, ~0x29, ~0)|SIMM13(~0), "$,d", 0, v9 }, /* rdhpr %hpriv,r */
+{ "wrhpr", F3(2, 0x33, 0), F3(~2, ~0x33, ~0), "1,2,%", 0, v9 }, /* wrhpr r1,r2,%hpriv */
+{ "wrhpr", F3(2, 0x33, 0), F3(~2, ~0x33, ~0)|SIMM13(~0), "1,%", 0, v9 }, /* wrhpr r1,%hpriv */
+{ "wrhpr", F3(2, 0x33, 1), F3(~2, ~0x33, ~1), "1,i,%", 0, v9 }, /* wrhpr r1,i,%hpriv */
+{ "wrhpr", F3(2, 0x33, 1), F3(~2, ~0x33, ~1), "i,1,%", F_ALIAS, v9 }, /* wrhpr i,r1,%hpriv */
+{ "wrhpr", F3(2, 0x33, 1), F3(~2, ~0x33, ~1)|RS1(~0), "i,%", 0, v9 }, /* wrhpr i,%hpriv */
+
/* ??? This group seems wrong. A three operand move? */
{ "mov", F3(2, 0x30, 0), F3(~2, ~0x30, ~0)|ASI(~0), "1,2,m", F_ALIAS, v8 }, /* wr r,r,%asrX */
{ "mov", F3(2, 0x30, 1), F3(~2, ~0x30, ~1), "1,i,m", F_ALIAS, v8 }, /* wr r,i,%asrX */
/* Coprocessor branches. */
#define CBR(opcode, mask, lose, flags, arch) \
- { opcode, (mask), ANNUL|(lose), "l", flags|F_DELAYED, arch }, \
- { opcode, (mask)|ANNUL, (lose), ",a l", flags|F_DELAYED, arch }
+ { opcode, (mask), ANNUL | (lose), "l", flags | F_DELAYED, arch }, \
+ { opcode, (mask) | ANNUL, (lose), ",a l", flags | F_DELAYED, arch }
/* Floating point branches. */
#define FBR(opcode, mask, lose, flags) \
- { opcode, (mask), ANNUL|(lose), "l", flags|F_DELAYED|F_FBR, v6 }, \
- { opcode, (mask)|ANNUL, (lose), ",a l", flags|F_DELAYED|F_FBR, v6 }
+ { opcode, (mask), ANNUL | (lose), "l", flags | F_DELAYED | F_FBR, v6 }, \
+ { opcode, (mask) | ANNUL, (lose), ",a l", flags | F_DELAYED | F_FBR, v6 }
/* V9 extended floating point branches. */
#define FBRX(opcode, mask, lose, flags) /* v9 */ \
/* Look up NAME in TABLE. */
-static int lookup_name PARAMS ((const arg *, const char *));
-static const char *lookup_value PARAMS ((const arg *, int));
-
static int
-lookup_name (table, name)
- const arg *table;
- const char *name;
+lookup_name (const arg *table, const char *name)
{
const arg *p;
/* Look up VALUE in TABLE. */
static const char *
-lookup_value (table, value)
- const arg *table;
- int value;
+lookup_value (const arg *table, int value)
{
const arg *p;
if (value == p->value)
return p->name;
- return (char *) 0;
+ return NULL;
}
\f
/* Handle ASI's. */
{ 0x89, "#ASI_SECONDARY_LITTLE" },
{ 0x8a, "#ASI_PRIMARY_NOFAULT_LITTLE" },
{ 0x8b, "#ASI_SECONDARY_NOFAULT_LITTLE" },
- /* These are UltraSPARC extensions. */
- /* FIXME: There are dozens of them. Not sure we want them all.
- Most are for kernel building but some are for vis type stuff. */
+ /* These are UltraSPARC and Niagara extensions. */
+ { 0x14, "#ASI_PHYS_USE_EC" },
+ { 0x15, "#ASI_PHYS_BYPASS_EC_E" },
+ { 0x16, "#ASI_BLK_AIUP_4V" },
+ { 0x17, "#ASI_BLK_AIUS_4V" },
+ { 0x1c, "#ASI_PHYS_USE_EC_L" },
+ { 0x1d, "#ASI_PHYS_BYPASS_EC_E_L" },
+ { 0x1e, "#ASI_BLK_AIUP_L_4V" },
+ { 0x1f, "#ASI_BLK_AIUS_L_4V" },
+ { 0x20, "#ASI_SCRATCHPAD" },
+ { 0x21, "#ASI_MMU" },
+ { 0x23, "#ASI_BLK_INIT_QUAD_LDD_AIUS" },
+ { 0x24, "#ASI_NUCLEUS_QUAD_LDD" },
+ { 0x25, "#ASI_QUEUE" },
+ { 0x26, "#ASI_QUAD_LDD_PHYS_4V" },
+ { 0x2c, "#ASI_NUCLEUS_QUAD_LDD_L" },
+ { 0x30, "#ASI_PCACHE_DATA_STATUS" },
+ { 0x31, "#ASI_PCACHE_DATA" },
+ { 0x32, "#ASI_PCACHE_TAG" },
+ { 0x33, "#ASI_PCACHE_SNOOP_TAG" },
+ { 0x34, "#ASI_QUAD_LDD_PHYS" },
+ { 0x38, "#ASI_WCACHE_VALID_BITS" },
+ { 0x39, "#ASI_WCACHE_DATA" },
+ { 0x3a, "#ASI_WCACHE_TAG" },
+ { 0x3b, "#ASI_WCACHE_SNOOP_TAG" },
+ { 0x3c, "#ASI_QUAD_LDD_PHYS_L" },
+ { 0x40, "#ASI_SRAM_FAST_INIT" },
+ { 0x41, "#ASI_CORE_AVAILABLE" },
+ { 0x41, "#ASI_CORE_ENABLE_STAT" },
+ { 0x41, "#ASI_CORE_ENABLE" },
+ { 0x41, "#ASI_XIR_STEERING" },
+ { 0x41, "#ASI_CORE_RUNNING_RW" },
+ { 0x41, "#ASI_CORE_RUNNING_W1S" },
+ { 0x41, "#ASI_CORE_RUNNING_W1C" },
+ { 0x41, "#ASI_CORE_RUNNING_STAT" },
+ { 0x41, "#ASI_CMT_ERROR_STEERING" },
+ { 0x41, "#ASI_DCACHE_INVALIDATE" },
+ { 0x41, "#ASI_DCACHE_UTAG" },
+ { 0x41, "#ASI_DCACHE_SNOOP_TAG" },
+ { 0x42, "#ASI_DCACHE_INVALIDATE" },
+ { 0x43, "#ASI_DCACHE_UTAG" },
+ { 0x44, "#ASI_DCACHE_SNOOP_TAG" },
+ { 0x45, "#ASI_LSU_CONTROL_REG" },
+ { 0x45, "#ASI_DCU_CONTROL_REG" },
+ { 0x46, "#ASI_DCACHE_DATA" },
+ { 0x47, "#ASI_DCACHE_TAG" },
+ { 0x48, "#ASI_INTR_DISPATCH_STAT" },
+ { 0x49, "#ASI_INTR_RECEIVE" },
+ { 0x4a, "#ASI_UPA_CONFIG" },
+ { 0x4a, "#ASI_JBUS_CONFIG" },
+ { 0x4a, "#ASI_SAFARI_CONFIG" },
+ { 0x4a, "#ASI_SAFARI_ADDRESS" },
+ { 0x4b, "#ASI_ESTATE_ERROR_EN" },
+ { 0x4c, "#ASI_AFSR" },
+ { 0x4d, "#ASI_AFAR" },
+ { 0x4e, "#ASI_EC_TAG_DATA" },
+ { 0x50, "#ASI_IMMU" },
+ { 0x51, "#ASI_IMMU_TSB_8KB_PTR" },
+ { 0x52, "#ASI_IMMU_TSB_16KB_PTR" },
+ { 0x54, "#ASI_ITLB_DATA_IN" },
+ { 0x55, "#ASI_ITLB_DATA_ACCESS" },
+ { 0x56, "#ASI_ITLB_TAG_READ" },
+ { 0x57, "#ASI_IMMU_DEMAP" },
+ { 0x58, "#ASI_DMMU" },
+ { 0x59, "#ASI_DMMU_TSB_8KB_PTR" },
+ { 0x5a, "#ASI_DMMU_TSB_64KB_PTR" },
+ { 0x5b, "#ASI_DMMU_TSB_DIRECT_PTR" },
+ { 0x5c, "#ASI_DTLB_DATA_IN" },
+ { 0x5d, "#ASI_DTLB_DATA_ACCESS" },
+ { 0x5e, "#ASI_DTLB_TAG_READ" },
+ { 0x5f, "#ASI_DMMU_DEMAP" },
+ { 0x60, "#ASI_IIU_INST_TRAP" },
+ { 0x63, "#ASI_INTR_ID" },
+ { 0x63, "#ASI_CORE_ID" },
+ { 0x63, "#ASI_CESR_ID" },
+ { 0x66, "#ASI_IC_INSTR" },
+ { 0x67, "#ASI_IC_TAG" },
+ { 0x68, "#ASI_IC_STAG" },
+ { 0x6e, "#ASI_IC_PRE_DECODE" },
+ { 0x6f, "#ASI_IC_NEXT_FIELD" },
+ { 0x6f, "#ASI_BRPRED_ARRAY" },
+ { 0x70, "#ASI_BLK_AIUP" },
+ { 0x71, "#ASI_BLK_AIUS" },
+ { 0x72, "#ASI_MCU_CTRL_REG" },
+ { 0x74, "#ASI_EC_DATA" },
+ { 0x75, "#ASI_EC_CTRL" },
+ { 0x76, "#ASI_EC_W" },
+ { 0x77, "#ASI_UDB_ERROR_W" },
+ { 0x77, "#ASI_UDB_CONTROL_W" },
+ { 0x77, "#ASI_INTR_W" },
+ { 0x77, "#ASI_INTR_DATAN_W" },
+ { 0x77, "#ASI_INTR_DISPATCH_W" },
+ { 0x78, "#ASI_BLK_AIUPL" },
+ { 0x79, "#ASI_BLK_AIUSL" },
+ { 0x7e, "#ASI_EC_R" },
+ { 0x7f, "#ASI_UDBH_ERROR_R" },
+ { 0x7f, "#ASI_UDBL_ERROR_R" },
+ { 0x7f, "#ASI_UDBH_CONTROL_R" },
+ { 0x7f, "#ASI_UDBL_CONTROL_R" },
+ { 0x7f, "#ASI_INTR_R" },
+ { 0x7f, "#ASI_INTR_DATAN_R" },
+ { 0xc0, "#ASI_PST8_P" },
+ { 0xc1, "#ASI_PST8_S" },
+ { 0xc2, "#ASI_PST16_P" },
+ { 0xc3, "#ASI_PST16_S" },
+ { 0xc4, "#ASI_PST32_P" },
+ { 0xc5, "#ASI_PST32_S" },
+ { 0xc8, "#ASI_PST8_PL" },
+ { 0xc9, "#ASI_PST8_SL" },
+ { 0xca, "#ASI_PST16_PL" },
+ { 0xcb, "#ASI_PST16_SL" },
+ { 0xcc, "#ASI_PST32_PL" },
+ { 0xcd, "#ASI_PST32_SL" },
+ { 0xd0, "#ASI_FL8_P" },
+ { 0xd1, "#ASI_FL8_S" },
+ { 0xd2, "#ASI_FL16_P" },
+ { 0xd3, "#ASI_FL16_S" },
+ { 0xd8, "#ASI_FL8_PL" },
+ { 0xd9, "#ASI_FL8_SL" },
+ { 0xda, "#ASI_FL16_PL" },
+ { 0xdb, "#ASI_FL16_SL" },
+ { 0xe0, "#ASI_BLK_COMMIT_P", },
+ { 0xe1, "#ASI_BLK_COMMIT_S", },
+ { 0xe2, "#ASI_BLK_INIT_QUAD_LDD_P" },
+ { 0xf0, "#ASI_BLK_P", },
+ { 0xf1, "#ASI_BLK_S", },
+ { 0xf8, "#ASI_BLK_PL", },
+ { 0xf9, "#ASI_BLK_SL", },
{ 0, 0 }
};
/* Return the value for ASI NAME, or -1 if not found. */
int
-sparc_encode_asi (name)
- const char *name;
+sparc_encode_asi (const char *name)
{
return lookup_name (asi_table, name);
}
/* Return the name for ASI value VALUE or NULL if not found. */
const char *
-sparc_decode_asi (value)
- int value;
+sparc_decode_asi (int value)
{
return lookup_value (asi_table, value);
}
/* Return the value for membar arg NAME, or -1 if not found. */
int
-sparc_encode_membar (name)
- const char *name;
+sparc_encode_membar (const char *name)
{
return lookup_name (membar_table, name);
}
/* Return the name for membar value VALUE or NULL if not found. */
const char *
-sparc_decode_membar (value)
- int value;
+sparc_decode_membar (int value)
{
return lookup_value (membar_table, value);
}
{ 3, "#one_write" },
{ 4, "#page" },
{ 16, "#invalidate" },
+ { 17, "#unified", },
+ { 20, "#n_reads_strong", },
+ { 21, "#one_read_strong", },
+ { 22, "#n_writes_strong", },
+ { 23, "#one_write_strong", },
{ 0, 0 }
};
/* Return the value for prefetch arg NAME, or -1 if not found. */
int
-sparc_encode_prefetch (name)
- const char *name;
+sparc_encode_prefetch (const char *name)
{
return lookup_name (prefetch_table, name);
}
/* Return the name for prefetch value VALUE or NULL if not found. */
const char *
-sparc_decode_prefetch (value)
- int value;
+sparc_decode_prefetch (int value)
{
return lookup_value (prefetch_table, value);
}
/* Return the value for sparclet cpreg arg NAME, or -1 if not found. */
int
-sparc_encode_sparclet_cpreg (name)
- const char *name;
+sparc_encode_sparclet_cpreg (const char *name)
{
return lookup_name (sparclet_cpreg_table, name);
}
/* Return the name for sparclet cpreg value VALUE or NULL if not found. */
const char *
-sparc_decode_sparclet_cpreg (value)
- int value;
+sparc_decode_sparclet_cpreg (int value)
{
return lookup_value (sparclet_cpreg_table, value);
}