Rizin
unix-like reverse engineering framework and cli tools
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "sysdep.h"
#include "opcode/sparc.h"
#include "disas-asm.h"
#include "libiberty.h"
#include "opintl.h"
Go to the source code of this file.
Classes | |
struct | sparc_opcode_hash |
Macros | |
#define | xmalloc malloc |
#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 | SIGN_EXT(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) SIGN_EXT (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)) |
Typedefs | |
typedef struct sparc_opcode_hash | sparc_opcode_hash |
Functions | |
static int | is_delayed_branch (unsigned long insn) |
static int | compute_arch_mask (unsigned long mach) |
static int | compare_opcodes (const void *a, const void *b) |
static void | build_hash_table (const sparc_opcode **opcode_table, sparc_opcode_hash **hash_table, int num_opcodes) |
int | print_insn_sparc (bfd_vma memaddr, disassemble_info *info) |
Variables | |
static const sparc_opcode ** | sorted_opcodes |
static int | opcode_bits [4] = { 0x01c00000, 0x0, 0x01f80000, 0x01f80000 } |
static sparc_opcode_hash * | opcode_hash_table [HASH_SIZE] |
static char * | reg_names [] |
static char * | v9_priv_reg_names [] |
static char * | v9_hpriv_reg_names [] |
static char * | v9a_asr_reg_names [] |
static unsigned int | current_arch_mask |
#define freg_names (®_names[4 * 8]) |
Definition at line 95 of file sparc-dis.c.
#define fregx | ( | n | ) | (*info->fprintf_func) (stream, "%%%s", freg_names[((n) & ~1) | (((n) & 1) << 5)]) |
#define HASH_INSN | ( | INSN | ) | ((((INSN) >> 24) & 0xc0) | (((INSN) & opcode_bits[((INSN) >> 30) & 3]) >> 19)) |
Definition at line 63 of file sparc-dis.c.
#define HASH_SIZE 256 |
Definition at line 58 of file sparc-dis.c.
#define MASK_V9 |
Definition at line 44 of file sparc-dis.c.
Definition at line 74 of file sparc-dis.c.
#define V9_ONLY_P | ( | insn | ) | (! ((insn)->architecture & ~MASK_V9)) |
Definition at line 48 of file sparc-dis.c.
#define V9_P | ( | insn | ) | (((insn)->architecture & MASK_V9) != 0) |
Definition at line 50 of file sparc-dis.c.
Definition at line 132 of file sparc-dis.c.
Definition at line 141 of file sparc-dis.c.
Definition at line 142 of file sparc-dis.c.
Definition at line 136 of file sparc-dis.c.
Definition at line 138 of file sparc-dis.c.
Definition at line 137 of file sparc-dis.c.
Definition at line 131 of file sparc-dis.c.
Definition at line 143 of file sparc-dis.c.
Definition at line 129 of file sparc-dis.c.
Definition at line 130 of file sparc-dis.c.
Definition at line 133 of file sparc-dis.c.
Definition at line 135 of file sparc-dis.c.
#define xmalloc malloc |
Definition at line 23 of file sparc-dis.c.
typedef struct sparc_opcode_hash sparc_opcode_hash |
|
static |
Definition at line 420 of file sparc-dis.c.
References calloc(), free(), h, HASH_INSN, HASH_SIZE, hash_table, i, max_count, memset(), NULL, and printf().
Referenced by print_insn_sparc().
Definition at line 262 of file sparc-dis.c.
References _, a, sparc_opcode::architecture, sparc_opcode::args, b, current_arch_mask, F_ALIAS, sparc_opcode::flags, i, i0, sparc_opcode::lose, sparc_opcode::match, sparc_opcode::name, x, x0, and x1.
Referenced by print_insn_sparc().
Definition at line 230 of file sparc-dis.c.
References 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().
Definition at line 206 of file sparc-dis.c.
References F_DELAYED, sparc_opcode::flags, HASH_INSN, sparc_opcode::lose, sparc_opcode::match, op, sparc_opcode_hash::opcode, and opcode_hash_table.
Referenced by print_insn_sparc().
int print_insn_sparc | ( | bfd_vma | memaddr, |
disassemble_info * | info | ||
) |
Definition at line 480 of file sparc-dis.c.
References _, sparc_opcode::architecture, sparc_opcode::args, BFD_ENDIAN_BIG, bfd_getb32(), bfd_getl32(), bfd_mach_sparc_sparclite, bit, build_hash_table(), compare_opcodes(), compute_arch_mask(), creg, current_arch_mask, dis_branch, dis_condbranch, dis_dref, dis_jsr, dis_nonbranch, dis_noninsn, F_CONDBR, F_DELAYED, F_JSR, F_UNBR, benchmark::FILE, sparc_opcode::flags, freg, fregx, HASH_INSN, i, imm, info(), is_delayed_branch(), sparc_opcode::lose, mask, sparc_opcode::match, name, sparc_opcode::name, op, sparc_opcode_hash::opcode, opcode_hash_table, qsort(), reg, s, SIGN_EXT, sorted_opcodes, sparc_decode_asi(), sparc_decode_membar(), sparc_decode_prefetch(), sparc_decode_sparclet_cpreg(), sparc_num_opcodes, sparc_opcodes, status, unsigned, v9_hpriv_reg_names, v9_priv_reg_names, v9a_asr_reg_names, 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 disassemble().
Definition at line 225 of file sparc-dis.c.
Referenced by compare_opcodes(), and print_insn_sparc().
|
static |
Definition at line 62 of file sparc-dis.c.
|
static |
Definition at line 71 of file sparc-dis.c.
Referenced by is_delayed_branch(), and print_insn_sparc().
|
static |
Definition at line 78 of file sparc-dis.c.
|
static |
Definition at line 53 of file sparc-dis.c.
Referenced by print_insn_sparc().
|
static |
Definition at line 109 of file sparc-dis.c.
Referenced by print_insn_sparc().
|
static |
Definition at line 99 of file sparc-dis.c.
Referenced by print_insn_sparc().
|
static |
Definition at line 120 of file sparc-dis.c.
Referenced by print_insn_sparc().