#include <stdio.h>#include "sysdep.h"#include "opcode/sparc.h"#include "dis-asm.h"#include "libiberty.h"#include "opintl.h"

Go to the source code of this file.
Data Types | |
| type | opcode_hash |
Defines | |
| #define | MASK_V9 |
| #define | V9_ONLY_P(insn) (! ((insn)->architecture & ~MASK_V9)) |
| #define | V9_P(insn) (((insn)->architecture & MASK_V9) != 0) |
| #define | HASH_SIZE 256 |
| #define | HASH_INSN(INSN) ((((INSN) >> 24) & 0xc0) | (((INSN) & opcode_bits[((INSN) >> 30) & 3]) >> 19)) |
| #define | SEX(value, bits) |
| #define | freg_names (®_names[4 * 8]) |
| #define | X_RD(i) (((i) >> 25) & 0x1f) |
| #define | X_RS1(i) (((i) >> 14) & 0x1f) |
| #define | X_LDST_I(i) (((i) >> 13) & 1) |
| #define | X_ASI(i) (((i) >> 5) & 0xff) |
| #define | X_RS2(i) (((i) >> 0) & 0x1f) |
| #define | X_IMM(i, n) (((i) >> 0) & ((1 << (n)) - 1)) |
| #define | X_SIMM(i, n) SEX (X_IMM ((i), (n)), (n)) |
| #define | X_DISP22(i) (((i) >> 0) & 0x3fffff) |
| #define | X_IMM22(i) X_DISP22 (i) |
| #define | X_DISP30(i) (((i) >> 0) & 0x3fffffff) |
| #define | X_DISP16(i) (((((i) >> 20) & 3) << 14) | (((i) >> 0) & 0x3fff)) |
| #define | X_DISP19(i) (((i) >> 0) & 0x7ffff) |
| #define | X_MEMBAR(i) ((i) & 0x7f) |
| #define | reg(n) (*info->fprintf_func) (stream, "%%%s", reg_names[n]) |
| #define | freg(n) (*info->fprintf_func) (stream, "%%%s", freg_names[n]) |
| #define | fregx(n) (*info->fprintf_func) (stream, "%%%s", freg_names[((n) & ~1) | (((n) & 1) << 5)]) |
| #define | creg(n) (*info->fprintf_func) (stream, "%%c%u", (unsigned int) (n)) |
Functions/Subroutines | |
| static void build_hash_table | PARAMS ((const struct sparc_opcode **, struct opcode_hash **, int)) |
| static int is_delayed_branch | PARAMS ((unsigned long)) |
| static int compare_opcodes | PARAMS ((const PTR, const PTR)) |
| static int | is_delayed_branch (unsigned long insn) |
| int | print_insn_sparc (bfd_vma memaddr, disassemble_info *info) |
| static int | compute_arch_mask (unsigned long mach) |
| static int | compare_opcodes (PTR a, const PTR b) const |
| static void | build_hash_table (struct sparc_opcode **opcode_table, struct opcode_hash **hash_table, int num_opcodes) const |
Variables | |
| static struct sparc_opcode ** | sorted_opcodes |
| static int | opcode_bits [4] = { 0x01c00000, 0x0, 0x01f80000, 0x01f80000 } |
| static struct opcode_hash * | opcode_hash_table [HASH_SIZE] |
| static char * | reg_names [] |
| static char * | v9_priv_reg_names [] |
| static char * | v9a_asr_reg_names [] |
| static unsigned int | current_arch_mask |
Referenced by main(), and print_insn_sparc().
Referenced by print_insn_sparc().
| #define freg_names (®_names[4 * 8]) |
Definition at line 88 of file sparc-dis.c.
| #define fregx | ( | n | ) | (*info->fprintf_func) (stream, "%%%s", freg_names[((n) & ~1) | (((n) & 1) << 5)]) |
Referenced by print_insn_sparc().
| #define HASH_INSN | ( | INSN | ) | ((((INSN) >> 24) & 0xc0) | (((INSN) & opcode_bits[((INSN) >> 30) & 3]) >> 19)) |
Definition at line 51 of file sparc-dis.c.
Referenced by build_hash_table(), is_delayed_branch(), and print_insn_sparc().
| #define HASH_SIZE 256 |
Definition at line 46 of file sparc-dis.c.
| #define MASK_V9 |
Value:
((1 << SPARC_OPCODE_ARCH_V9) \ | (1 << SPARC_OPCODE_ARCH_V9A) \ | (1 << SPARC_OPCODE_ARCH_V9B))
Definition at line 32 of file sparc-dis.c.
Referenced by sparc_override_options().
| #define SEX | ( | value, | |||
| bits | ) |
Definition at line 36 of file sparc-dis.c.
Definition at line 38 of file sparc-dis.c.
| static void build_hash_table | ( | struct sparc_opcode ** | opcode_table, | |
| struct opcode_hash ** | hash_table, | |||
| int | num_opcodes | |||
| ) | const [static] |
Definition at line 952 of file sparc-dis.c.
References free(), h, HASH_INSN, HASH_SIZE, i, max_count, memset, opcode_hash::next, NULL, opcode_hash::opcode, printf(), and xmalloc().
Referenced by print_insn_sparc().
Definition at line 804 of file sparc-dis.c.
References _, sparc_opcode::architecture, sparc_opcode::args, F_ALIAS, sparc_opcode::flags, fprintf(), i, i1, sparc_opcode::lose, sparc_opcode::match, sparc_opcode::name, p0, p1, strchr, strcmp(), strlen(), strncmp(), x, x0, and x1.
Referenced by print_insn_sparc().
| static int compute_arch_mask | ( | unsigned long | mach | ) | [static] |
Definition at line 771 of file sparc-dis.c.
References abort, bfd_mach_sparc, bfd_mach_sparc_sparclet, bfd_mach_sparc_sparclite, bfd_mach_sparc_sparclite_le, bfd_mach_sparc_v8plus, bfd_mach_sparc_v8plusa, bfd_mach_sparc_v8plusb, bfd_mach_sparc_v9, bfd_mach_sparc_v9a, bfd_mach_sparc_v9b, SPARC_OPCODE_ARCH_MASK, SPARC_OPCODE_ARCH_SPARCLET, SPARC_OPCODE_ARCH_SPARCLITE, SPARC_OPCODE_ARCH_V8, SPARC_OPCODE_ARCH_V9, SPARC_OPCODE_ARCH_V9A, and SPARC_OPCODE_ARCH_V9B.
Referenced by print_insn_sparc().
| static int is_delayed_branch | ( | unsigned long | insn | ) | [static] |
Definition at line 189 of file sparc-dis.c.
References F_DELAYED, sparc_opcode::flags, HASH_INSN, sparc_opcode::lose, sparc_opcode::match, opcode_hash::next, opcode, and opcode_hash::opcode.
| static int is_delayed_branch PARAMS | ( | (unsigned long) | ) | [static] |
| static void build_hash_table PARAMS | ( | (const struct sparc_opcode **, struct opcode_hash **, int) | ) | [static] |
| int print_insn_sparc | ( | bfd_vma | memaddr, | |
| disassemble_info * | info | |||
| ) |
Definition at line 219 of file sparc-dis.c.
References _, sparc_opcode::architecture, sparc_opcode::args, BFD_ENDIAN_BIG, bfd_getb32(), bfd_getl32(), bfd_mach_sparc_sparclite, disassemble_info::branch_delay_insns, build_hash_table(), compare_opcodes(), compute_arch_mask(), creg, disassemble_info::data_size, dis_branch, dis_condbranch, dis_dref, dis_jsr, dis_nonbranch, dis_noninsn, disassemble_info::endian, F_CONDBR, F_DELAYED, F_JSR, F_UNBR, sparc_opcode::flags, disassemble_info::fprintf_func, freg, fregx, getword(), HASH_INSN, i, insn, disassemble_info::insn_info_valid, disassemble_info::insn_type, is_delayed_branch(), sparc_opcode::lose, disassemble_info::mach, sparc_opcode::match, disassemble_info::memory_error_func, sparc_opcode::name, opcode_hash::next, opcode, opcode_hash::opcode, prev_insn, disassemble_info::print_address_func, qsort(), disassemble_info::read_memory_func, s, SEX, sparc_decode_asi(), sparc_decode_membar(), sparc_decode_prefetch(), sparc_decode_sparclet_cpreg(), sparc_num_opcodes, sparc_opcodes, strchr, stream, disassemble_info::stream, disassemble_info::target, unsigned, val, X_ASI, X_DISP16, X_DISP19, X_DISP22, X_DISP30, X_IMM, X_IMM22, X_LDST_I, X_MEMBAR, X_RD, X_RS1, X_RS2, X_SIMM, and xmalloc().
Referenced by disassembler().
unsigned int current_arch_mask [static] |
Definition at line 208 of file sparc-dis.c.
int opcode_bits[4] = { 0x01c00000, 0x0, 0x01f80000, 0x01f80000 } [static] |
Definition at line 50 of file sparc-dis.c.
struct opcode_hash* opcode_hash_table[HASH_SIZE] [static] |
Definition at line 58 of file sparc-dis.c.
char* reg_names[] [static] |
Initial value:
{ "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7",
"o0", "o1", "o2", "o3", "o4", "o5", "sp", "o7",
"l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7",
"i0", "i1", "i2", "i3", "i4", "i5", "fp", "i7",
"f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
"f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
"f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
"f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31",
"f32", "f33", "f34", "f35", "f36", "f37", "f38", "f39",
"f40", "f41", "f42", "f43", "f44", "f45", "f46", "f47",
"f48", "f49", "f50", "f51", "f52", "f53", "f54", "f55",
"f56", "f57", "f58", "f59", "f60", "f61", "f62", "f63",
"y", "psr", "wim", "tbr", "pc", "npc", "fpsr", "cpsr"
}
Definition at line 71 of file sparc-dis.c.
struct sparc_opcode** sorted_opcodes [static] |
Definition at line 41 of file sparc-dis.c.
char* v9_priv_reg_names[] [static] |
Initial value:
{
"tpc", "tnpc", "tstate", "tt", "tick", "tba", "pstate", "tl",
"pil", "cwp", "cansave", "canrestore", "cleanwin", "otherwin",
"wstate", "fq"
}
Definition at line 92 of file sparc-dis.c.
char* v9a_asr_reg_names[] [static] |
Initial value:
{
"pcr", "pic", "dcr", "gsr", "set_softint", "clear_softint",
"softint", "tick_cmpr", "sys_tick", "sys_tick_cmpr"
}
Definition at line 102 of file sparc-dis.c.
1.5.6