Rizin
unix-like reverse engineering framework and cli tools
|
#include "ansidecl.h"
#include "libiberty.h"
#include "disas-asm.h"
#include "elf-bfd.h"
#include "arc.h"
#include <string.h>
#include "opintl.h"
#include <stdarg.h>
#include "arc-dis.h"
#include "arc-ext.h"
#include "arcompact-dis.h"
#include <stdlib.h>
Go to the source code of this file.
Macros | |
#define | BIT(word, n) ((word) & (1 << (n))) |
#define | BITS(word, s, e) (((word) << (sizeof(word) * 8 - 1 - (e))) >> ((s) + (sizeof(word) * 8 - 1 - (e)))) |
#define | OPCODE(word) (BITS((word), 27, 31)) |
#define | FIELDA(word) (BITS((word), 21, 26)) |
#define | FIELDB(word) (BITS((word), 15, 20)) |
#define | FIELDC(word) (BITS((word), 9, 14)) |
#define | FIELDD(word) (BITS(((signed int)(word)), 0, 8)) |
#define | PUT_NEXT_WORD_IN(a) |
#define | CHECK_FLAG_COND_NULLIFY() |
#define | CHECK_COND() |
#define | CHECK_FIELD(field) |
#define | CHECK_FIELD_A() |
#define | CHECK_FIELD_B() |
#define | CHECK_FIELD_C() |
#define | IS_SMALL(x) (((field##x) < 10) && ((field##x) >= 0)) |
#define | IS_REG(x) (field##x##isReg) |
#define | WRITE_FORMAT_LB_Rx_RB(x) WRITE_FORMAT(x, "[", "]", "", "") |
#define | WRITE_FORMAT_x_COMMA_LB(x) WRITE_FORMAT(x, "", ", [", "", ", [") |
#define | WRITE_FORMAT_COMMA_x_RB(x) WRITE_FORMAT(x, ", ", "]", ", ", "]") |
#define | WRITE_FORMAT_x_RB(x) WRITE_FORMAT(x, "", "]", "", "]") |
#define | WRITE_FORMAT_COMMA_x(x) WRITE_FORMAT(x, ", ", "", ", ", "") |
#define | WRITE_FORMAT_x_COMMA(x) WRITE_FORMAT(x, "", ", ", "", ", ") |
#define | WRITE_FORMAT_x(x) WRITE_FORMAT(x, "", "", "", "") |
#define | WRITE_FORMAT(x, cb1, ca1, cb, ca) |
#define | WRITE_FORMAT_RB() strcat(formatString, "]") |
#define | WRITE_COMMENT(str) (state->comm[state->commNum++] = (str)) |
#define | WRITE_NOP_COMMENT() |
#define | NEXT_WORD(x) (offset += 4, state->words[x]) |
#define | add_target(x) (state->targets[state->tcnt++] = (x)) |
#define | inc_bp() bp = bp + strlen(bp) |
#define | REG2NAME(num, name) |
#define | AUXREG2NAME(num, name) case num: sprintf(bp, "" name); break; |
#define | write_instr_name() |
Enumerations | |
enum | a4_decoding_class { CLASS_A4_ARITH , CLASS_A4_OP3_GENERAL , CLASS_A4_FLAG , CLASS_A4_BRANCH , CLASS_A4_JC , CLASS_A4_LD0 , CLASS_A4_LD1 , CLASS_A4_ST , CLASS_A4_SR , CLASS_A4_OP3_SUBOPC3F , CLASS_A4_LR } |
enum | { op_LD0 = 0 , op_LD1 = 1 , op_ST = 2 , op_3 = 3 , op_BC = 4 , op_BLC = 5 , op_LPC = 6 , op_JC = 7 , op_ADD = 8 , op_ADC = 9 , op_SUB = 10 , op_SBC = 11 , op_AND = 12 , op_OR = 13 , op_BIC = 14 , op_XOR = 15 } |
Functions | |
static const char * | core_reg_name (struct arcDisState *state, int val) |
static const char * | aux_reg_name (struct arcDisState *state, int val) |
static const char * | cond_code_name (struct arcDisState *state, int val) |
static const char * | instruction_name (struct arcDisState *state, int op1, int op2, int *flags) |
static void | mwerror (struct arcDisState *state, const char *msg) |
static const char * | post_address (struct arcDisState *state, int addr) |
static void | arc_sprintf (struct arcDisState *state, char *buf, const char *format,...) |
static void | write_instr_name_ (struct arcDisState *state, const char *instrName, int cond, int condCodeIsPartOfName, int flag, int signExtend, int addrWriteBack, int directMem) |
static int | dsmOneArcInst (bfd_vma addr, struct arcDisState *state) |
static const char * | _coreRegName (void *cpp_this ATTRIBUTE_UNUSED, int regnum) |
static const char * | _auxRegName (void *cpp_this ATTRIBUTE_UNUSED, int regnum) |
static const char * | _condCodeName (void *cpp_this ATTRIBUTE_UNUSED, int num) |
static const char * | _instName (void *_this ATTRIBUTE_UNUSED, int majop, int minop, int *flags) |
int | ARCTangent_decodeInstr (bfd_vma address, disassemble_info *info) |
Variables | |
static const char * | condName [] |
disassemble_info | tm_print_insn_info |
#define CHECK_COND | ( | ) |
#define CHECK_FIELD | ( | field | ) |
#define CHECK_FIELD_A | ( | ) |
#define CHECK_FIELD_B | ( | ) |
#define CHECK_FIELD_C | ( | ) |
#define CHECK_FLAG_COND_NULLIFY | ( | ) |
#define inc_bp | ( | ) | bp = bp + strlen(bp) |
#define WRITE_FORMAT_COMMA_x | ( | x | ) | WRITE_FORMAT(x, ", ", "", ", ", "") |
#define WRITE_FORMAT_COMMA_x_RB | ( | x | ) | WRITE_FORMAT(x, ", ", "]", ", ", "]") |
#define WRITE_FORMAT_LB_Rx_RB | ( | x | ) | WRITE_FORMAT(x, "[", "]", "", "") |
#define WRITE_FORMAT_x | ( | x | ) | WRITE_FORMAT(x, "", "", "", "") |
#define WRITE_FORMAT_x_COMMA | ( | x | ) | WRITE_FORMAT(x, "", ", ", "", ", ") |
#define WRITE_FORMAT_x_COMMA_LB | ( | x | ) | WRITE_FORMAT(x, "", ", [", "", ", [") |
#define WRITE_FORMAT_x_RB | ( | x | ) | WRITE_FORMAT(x, "", "]", "", "]") |
#define write_instr_name | ( | ) |
#define WRITE_NOP_COMMENT | ( | ) |
anonymous enum |
enum a4_decoding_class |
Definition at line 999 of file arc-dis.c.
References arcExtMap_auxRegName().
Referenced by ARCTangent_decodeInstr().
Definition at line 1007 of file arc-dis.c.
References arcExtMap_condCodeName(), and num.
Referenced by ARCTangent_decodeInstr().
Definition at line 991 of file arc-dis.c.
References arcExtMap_coreRegName().
Referenced by ARCTangent_decodeInstr().
|
static |
Definition at line 1017 of file arc-dis.c.
References arcExtMap_instName(), and flags.
Referenced by ARCTangent_decodeInstr().
|
static |
Definition at line 217 of file arc-dis.c.
References aux_reg_name(), AUXREG2NAME, core_reg_name(), ext, inc_bp, p, REG2NAME, sprintf, and val.
Referenced by dsmOneArcInst().
int ARCTangent_decodeInstr | ( | bfd_vma | address, |
disassemble_info * | info | ||
) |
Definition at line 1025 of file arc-dis.c.
References __TRANSLATION_REQUIRED, _auxRegName(), _condCodeName(), _coreRegName(), _instName(), addr, BFD_ENDIAN_LITTLE, bfd_getb32(), bfd_getl32(), dsmOneArcInst(), info(), memset(), s, and status.
Referenced by disassemble().
|
static |
|
static |
|
static |
Definition at line 157 of file arc-dis.c.
References val.
Referenced by arc_sprintf(), and my_sprintf().
|
static |
Definition at line 459 of file arc-dis.c.
References A, add_target, addr, arc_sprintf(), B, BIT, BITS, BR_exec_when_jump, BR_exec_when_no_jump, C, CHECK_FIELD_A, CHECK_FIELD_B, CHECK_FIELD_C, CHECK_FLAG_COND_NULLIFY, CLASS_A4_ARITH, CLASS_A4_BRANCH, CLASS_A4_FLAG, CLASS_A4_JC, CLASS_A4_LD0, CLASS_A4_LD1, CLASS_A4_LR, CLASS_A4_OP3_GENERAL, CLASS_A4_OP3_SUBOPC3F, CLASS_A4_SR, CLASS_A4_ST, cond, direct_call, direct_jump, E_ARC_MACH_A4, FIELDB, FIELDC, FIELDD, flags, IGNORE_FIRST_OPD, indirect_call, indirect_jump, instruction_name(), invalid_instr, IS_REG, mwerror(), NEXT_WORD, no_reg, noflow, op_3, op_ADC, op_ADD, op_AND, op_BC, op_BIC, op_BLC, op_JC, op_LD0, op_LD1, op_LPC, op_OR, op_SBC, op_ST, op_SUB, op_XOR, OPCODE, post_address(), WRITE_FORMAT_COMMA_x, WRITE_FORMAT_COMMA_x_RB, WRITE_FORMAT_RB, WRITE_FORMAT_x, WRITE_FORMAT_x_COMMA, WRITE_FORMAT_x_COMMA_LB, WRITE_FORMAT_x_RB, write_instr_name, and WRITE_NOP_COMMENT.
Referenced by ARCTangent_decodeInstr().
|
static |
|
static |
Definition at line 192 of file arc-dis.c.
References msg.
Referenced by dsmOneArcInst().
|
static |
Definition at line 199 of file arc-dis.c.
References addr, ARRAY_SIZE, and i.
Referenced by dsmOneArcInst().
|
static |
Definition at line 381 of file arc-dis.c.
References BR_exec_always, BR_exec_when_jump, BR_exec_when_no_jump, cond, cond_code_name(), and condName.
|
static |
Definition at line 374 of file arc-dis.c.
Referenced by write_instr_name_().
|
extern |