Rizin
unix-like reverse engineering framework and cli tools
|
Go to the source code of this file.
Macros | |
#define | OPERAND(x) insn->detail->mips.operands[x] |
#define | REGID(x) insn->detail->mips.operands[x].reg |
#define | REG(x) cs_reg_name(*handle, insn->detail->mips.operands[x].reg) |
#define | IMM(x) insn->detail->mips.operands[x].imm |
#define | MEMBASE(x) cs_reg_name(*handle, insn->detail->mips.operands[x].mem.base) |
#define | MEMINDEX(x) insn->detail->mips.operands[x].mem.index |
#define | MEMDISP(x) insn->detail->mips.operands[x].mem.disp |
#define | OPCOUNT() insn->detail->mips.op_count |
#define | SET_VAL(op, i) |
#define | CREATE_SRC_DST_3(op) |
#define | CREATE_SRC_DST_2(op) |
#define | SET_SRC_DST_3_REGS(op) |
#define | SET_SRC_DST_3_IMM(op) |
#define | SET_SRC_DST_2_REGS(op) |
#define | SET_SRC_DST_3_REG_OR_IMM(op) |
#define | ES_IS_NEGATIVE(arg) "1," arg ",<<<,1,&" |
#define | ES_CALL_DR(ra, addr) "pc,4,+," ra ",=," ES_J(addr) |
#define | ES_CALL_D(addr) ES_CALL_DR("ra", addr) |
#define | ES_CALL_NDR(ra, addr) "pc," ra ",=," ES_J(addr) |
#define | ES_CALL_ND(addr) ES_CALL_NDR("ra", addr) |
#define | USE_DS 0 |
#define | ES_TRAP_DS() "" |
#define | ES_J(addr) addr ",pc,=" |
#define | ES_B(x) "0xff," x ",&" |
#define | ES_H(x) "0xffff," x ",&" |
#define | ES_W(x) "0xffffffff," x ",&" |
#define | ES_SIGN32_64(arg) es_sign_n_64(a, op, arg, 32) |
#define | ES_SIGN16_64(arg) es_sign_n_64(a, op, arg, 16) |
#define | ES_ADD_CK32_OVERF(x, y, z) es_add_ck(op, x, y, z, 32) |
#define | ES_ADD_CK64_OVERF(x, y, z) es_add_ck(op, x, y, z, 64) |
#define | PROTECT_ZERO() |
#define | ESIL_LOAD(size) |
#define | ARG(x) (*str[x] != 0) ? str[x] : arg(handle, insn, str[x], x) |
#define | KW(d, ds, m, ms) rz_list_append(l, rz_search_keyword_new((const ut8 *)d, ds, (const ut8 *)m, ms, NULL)) |
Functions | |
static void | es_sign_n_64 (RzAnalysis *a, RzAnalysisOp *op, const char *arg, int bit) |
static void | es_add_ck (RzAnalysisOp *op, const char *a1, const char *a2, const char *re, int bit) |
static void | opex (RzStrBuf *buf, csh handle, cs_insn *insn) |
static const char * | arg (csh *handle, cs_insn *insn, char *buf, int n) |
static int | analop_esil (RzAnalysis *a, RzAnalysisOp *op, ut64 addr, const ut8 *buf, int len, csh *handle, cs_insn *insn) |
static int | parse_reg_name (RzRegItem *reg, csh handle, cs_insn *insn, int reg_num) |
static void | op_fillval (RzAnalysis *analysis, RzAnalysisOp *op, csh *handle, cs_insn *insn) |
static void | set_opdir (RzAnalysisOp *op) |
static int | analop (RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8 *buf, int len, RzAnalysisOpMask mask) |
static char * | get_reg_profile (RzAnalysis *analysis) |
static int | archinfo (RzAnalysis *analysis, int q) |
static RzList * | analysis_preludes (RzAnalysis *analysis) |
Variables | |
static ut64 | t9_pre = UT64_MAX |
RzAnalysisPlugin | rz_analysis_plugin_mips_cs |
RZ_API RzLibStruct | rizin_plugin |
Definition at line 201 of file analysis_mips_cs.c.
#define CREATE_SRC_DST_2 | ( | op | ) |
Definition at line 32 of file analysis_mips_cs.c.
#define CREATE_SRC_DST_3 | ( | op | ) |
Definition at line 27 of file analysis_mips_cs.c.
Definition at line 98 of file analysis_mips_cs.c.
Definition at line 99 of file analysis_mips_cs.c.
#define ES_B | ( | x | ) | "0xff," x ",&" |
Definition at line 90 of file analysis_mips_cs.c.
#define ES_CALL_D | ( | addr | ) | ES_CALL_DR("ra", addr) |
Definition at line 73 of file analysis_mips_cs.c.
Definition at line 72 of file analysis_mips_cs.c.
#define ES_CALL_ND | ( | addr | ) | ES_CALL_NDR("ra", addr) |
Definition at line 77 of file analysis_mips_cs.c.
Definition at line 76 of file analysis_mips_cs.c.
#define ES_H | ( | x | ) | "0xffff," x ",&" |
Definition at line 91 of file analysis_mips_cs.c.
Definition at line 69 of file analysis_mips_cs.c.
Definition at line 87 of file analysis_mips_cs.c.
#define ES_SIGN16_64 | ( | arg | ) | es_sign_n_64(a, op, arg, 16) |
Definition at line 96 of file analysis_mips_cs.c.
#define ES_SIGN32_64 | ( | arg | ) | es_sign_n_64(a, op, arg, 32) |
Definition at line 95 of file analysis_mips_cs.c.
#define ES_TRAP_DS | ( | ) | "" |
Definition at line 86 of file analysis_mips_cs.c.
#define ES_W | ( | x | ) | "0xffffffff," x ",&" |
Definition at line 92 of file analysis_mips_cs.c.
#define ESIL_LOAD | ( | size | ) |
Definition at line 121 of file analysis_mips_cs.c.
#define IMM | ( | x | ) | insn->detail->mips.operands[x].imm |
Definition at line 15 of file analysis_mips_cs.c.
#define KW | ( | d, | |
ds, | |||
m, | |||
ms | |||
) | rz_list_append(l, rz_search_keyword_new((const ut8 *)d, ds, (const ut8 *)m, ms, NULL)) |
#define MEMBASE | ( | x | ) | cs_reg_name(*handle, insn->detail->mips.operands[x].mem.base) |
Definition at line 16 of file analysis_mips_cs.c.
#define MEMDISP | ( | x | ) | insn->detail->mips.operands[x].mem.disp |
Definition at line 18 of file analysis_mips_cs.c.
#define MEMINDEX | ( | x | ) | insn->detail->mips.operands[x].mem.index |
Definition at line 17 of file analysis_mips_cs.c.
#define OPCOUNT | ( | ) | insn->detail->mips.op_count |
Definition at line 19 of file analysis_mips_cs.c.
#define OPERAND | ( | x | ) | insn->detail->mips.operands[x] |
Definition at line 12 of file analysis_mips_cs.c.
#define PROTECT_ZERO | ( | ) |
Definition at line 116 of file analysis_mips_cs.c.
#define REG | ( | x | ) | cs_reg_name(*handle, insn->detail->mips.operands[x].reg) |
Definition at line 14 of file analysis_mips_cs.c.
#define REGID | ( | x | ) | insn->detail->mips.operands[x].reg |
Definition at line 13 of file analysis_mips_cs.c.
#define SET_SRC_DST_2_REGS | ( | op | ) |
Definition at line 54 of file analysis_mips_cs.c.
#define SET_SRC_DST_3_IMM | ( | op | ) |
Definition at line 45 of file analysis_mips_cs.c.
#define SET_SRC_DST_3_REG_OR_IMM | ( | op | ) |
Definition at line 59 of file analysis_mips_cs.c.
#define SET_SRC_DST_3_REGS | ( | op | ) |
Definition at line 36 of file analysis_mips_cs.c.
Definition at line 22 of file analysis_mips_cs.c.
#define USE_DS 0 |
Definition at line 79 of file analysis_mips_cs.c.
|
static |
Definition at line 718 of file analysis_mips_cs.c.
References addr, analop_esil(), rz_analysis_t::big_endian, rz_analysis_t::bits, rz_analysis_t::cpu, CS_ARCH_MIPS, cs_close(), cs_disasm(), capstone::CS_ERR_OK, cs_free(), CS_MODE_BIG_ENDIAN, CS_MODE_LITTLE_ENDIAN, CS_MODE_MICRO, CS_MODE_MIPS2, CS_MODE_MIPS3, CS_MODE_MIPS32, CS_MODE_MIPS32R6, CS_MODE_MIPS64, cs_open(), CS_OPT_DETAIL, CS_OPT_ON, cs_option(), rz_analysis_t::gp, IMM, len, mask, mem, MIPS_INS_ADD, MIPS_INS_ADDI, MIPS_INS_ADDIU, MIPS_INS_ADDU, MIPS_INS_AND, MIPS_INS_ANDI, MIPS_INS_B, MIPS_INS_BAL, MIPS_INS_BEQ, MIPS_INS_BEQL, MIPS_INS_BEQZ, MIPS_INS_BGEZ, MIPS_INS_BGEZAL, MIPS_INS_BGEZALC, MIPS_INS_BGEZALL, MIPS_INS_BGEZC, MIPS_INS_BGEZL, MIPS_INS_BGTZ, MIPS_INS_BGTZALC, MIPS_INS_BGTZC, MIPS_INS_BGTZL, MIPS_INS_BLEZ, MIPS_INS_BLEZALC, MIPS_INS_BLEZC, MIPS_INS_BLEZL, MIPS_INS_BLTZ, MIPS_INS_BLTZAL, MIPS_INS_BLTZALC, MIPS_INS_BLTZALL, MIPS_INS_BLTZC, MIPS_INS_BLTZL, MIPS_INS_BNE, MIPS_INS_BNEG, MIPS_INS_BNEGI, MIPS_INS_BNEL, MIPS_INS_BNEZ, MIPS_INS_BNZ, MIPS_INS_BREAK, MIPS_INS_BTEQZ, MIPS_INS_BTNEZ, MIPS_INS_BZ, MIPS_INS_CMPGDU, MIPS_INS_CMPGU, MIPS_INS_CMPI, MIPS_INS_CMPU, MIPS_INS_DADD, MIPS_INS_DADDI, MIPS_INS_DADDIU, MIPS_INS_DDIV, MIPS_INS_DDIVU, MIPS_INS_DIV, MIPS_INS_DIV_S, MIPS_INS_DIV_U, MIPS_INS_DIVU, MIPS_INS_DMULT, MIPS_INS_DMULTU, MIPS_INS_DSUB, MIPS_INS_DSUBU, MIPS_INS_FDIV, MIPS_INS_FMSUB, MIPS_INS_FMUL, MIPS_INS_FSUB, MIPS_INS_INVALID, MIPS_INS_J, MIPS_INS_JAL, MIPS_INS_JALR, MIPS_INS_JALS, MIPS_INS_JALX, MIPS_INS_JIALC, MIPS_INS_JIC, MIPS_INS_JR, MIPS_INS_JRADDIUSP, MIPS_INS_JRC, MIPS_INS_LB, MIPS_INS_LBU, MIPS_INS_LBUX, MIPS_INS_LD, MIPS_INS_LDC1, MIPS_INS_LDC2, MIPS_INS_LDL, MIPS_INS_LDR, MIPS_INS_LDXC1, MIPS_INS_LI, MIPS_INS_LUI, MIPS_INS_LW, MIPS_INS_LWC1, MIPS_INS_LWC2, MIPS_INS_LWL, MIPS_INS_LWR, MIPS_INS_LWXC1, MIPS_INS_MOVE, MIPS_INS_MUL, MIPS_INS_MULSA, MIPS_INS_MULT, MIPS_INS_MULV, MIPS_INS_NOP, MIPS_INS_NOT, MIPS_INS_OR, MIPS_INS_ORI, MIPS_INS_SB, MIPS_INS_SD, MIPS_INS_SH, MIPS_INS_SHRA, MIPS_INS_SHRA_R, MIPS_INS_SHRAV, MIPS_INS_SHRAV_R, MIPS_INS_SHRL, MIPS_INS_SLL, MIPS_INS_SLLV, MIPS_INS_SLT, MIPS_INS_SLTI, MIPS_INS_SLTIU, MIPS_INS_SRA, MIPS_INS_SRL, MIPS_INS_SRLV, MIPS_INS_SUB, MIPS_INS_SUBS_S, MIPS_INS_SUBS_U, MIPS_INS_SUBU, MIPS_INS_SUBUH, MIPS_INS_SUBUH_R, MIPS_INS_SUBV, MIPS_INS_SUBVI, MIPS_INS_SW, MIPS_INS_SWC1, MIPS_INS_SWC2, MIPS_INS_SWL, MIPS_INS_SWR, MIPS_INS_SWXC1, MIPS_INS_SYSCALL, MIPS_INS_XOR, MIPS_INS_XORI, MIPS_OP_IMM, MIPS_OP_MEM, MIPS_OP_REG, MIPS_REG_25, MIPS_REG_GP, MIPS_REG_RA, MIPS_REG_SP, MIPS_REG_T9, n, op_fillval(), OPERAND, opex(), REGID, RZ_ANALYSIS_OP_MASK_DISASM, RZ_ANALYSIS_OP_MASK_ESIL, RZ_ANALYSIS_OP_MASK_OPEX, RZ_ANALYSIS_OP_MASK_VAL, RZ_ANALYSIS_OP_TYPE_ADD, RZ_ANALYSIS_OP_TYPE_AND, RZ_ANALYSIS_OP_TYPE_CALL, RZ_ANALYSIS_OP_TYPE_CJMP, RZ_ANALYSIS_OP_TYPE_CMP, RZ_ANALYSIS_OP_TYPE_DIV, RZ_ANALYSIS_OP_TYPE_ILL, RZ_ANALYSIS_OP_TYPE_JMP, RZ_ANALYSIS_OP_TYPE_LOAD, RZ_ANALYSIS_OP_TYPE_MOV, RZ_ANALYSIS_OP_TYPE_MUL, RZ_ANALYSIS_OP_TYPE_NOP, RZ_ANALYSIS_OP_TYPE_NOT, RZ_ANALYSIS_OP_TYPE_OR, RZ_ANALYSIS_OP_TYPE_RCALL, RZ_ANALYSIS_OP_TYPE_RET, RZ_ANALYSIS_OP_TYPE_RJMP, RZ_ANALYSIS_OP_TYPE_SAR, RZ_ANALYSIS_OP_TYPE_SHL, RZ_ANALYSIS_OP_TYPE_SHR, RZ_ANALYSIS_OP_TYPE_STORE, RZ_ANALYSIS_OP_TYPE_SUB, RZ_ANALYSIS_OP_TYPE_SWI, RZ_ANALYSIS_OP_TYPE_TRAP, RZ_ANALYSIS_OP_TYPE_UCALL, RZ_ANALYSIS_OP_TYPE_XOR, RZ_ANALYSIS_STACK_ALIGN, RZ_ANALYSIS_STACK_INC, rz_str_newf(), rz_strbuf_fini(), set_opdir(), SET_VAL, strdup(), t9_pre, type, and UT64_MAX.
|
static |
signed – sets overflow flag
unsigned
Definition at line 203 of file analysis_mips_cs.c.
References ARG, ES_ADD_CK32_OVERF, ES_ADD_CK64_OVERF, ES_CALL_D, ES_CALL_DR, ES_CALL_ND, ES_CALL_NDR, ES_IS_NEGATIVE, ES_J, ES_SIGN32_64, ES_TRAP_DS, ES_W, ESIL_LOAD, i, IMM, MIPS_INS_ADD, MIPS_INS_ADDI, MIPS_INS_ADDIU, MIPS_INS_ADDU, MIPS_INS_AND, MIPS_INS_ANDI, MIPS_INS_B, MIPS_INS_BAL, MIPS_INS_BEQ, MIPS_INS_BEQL, MIPS_INS_BEQZ, MIPS_INS_BEQZALC, MIPS_INS_BEQZC, MIPS_INS_BGEZ, MIPS_INS_BGEZAL, MIPS_INS_BGEZALC, MIPS_INS_BGEZC, MIPS_INS_BGEZL, MIPS_INS_BGTZ, MIPS_INS_BGTZALC, MIPS_INS_BGTZC, MIPS_INS_BGTZL, MIPS_INS_BLEZ, MIPS_INS_BLEZC, MIPS_INS_BLEZL, MIPS_INS_BLTZ, MIPS_INS_BLTZAL, MIPS_INS_BLTZC, MIPS_INS_BLTZL, MIPS_INS_BNE, MIPS_INS_BNEL, MIPS_INS_BNEZ, MIPS_INS_BREAK, MIPS_INS_BTEQZ, MIPS_INS_BTNEZ, MIPS_INS_BZ, MIPS_INS_CMP, MIPS_INS_CMPGDU, MIPS_INS_CMPGU, MIPS_INS_CMPI, MIPS_INS_CMPU, MIPS_INS_DADD, MIPS_INS_DADDI, MIPS_INS_DADDIU, MIPS_INS_DADDU, MIPS_INS_DDIV, MIPS_INS_DDIVU, MIPS_INS_DIV, MIPS_INS_DIVU, MIPS_INS_DSRA, MIPS_INS_DSUB, MIPS_INS_DSUBU, MIPS_INS_FSUB, MIPS_INS_J, MIPS_INS_JAL, MIPS_INS_JALR, MIPS_INS_JALRC, MIPS_INS_JALRS, MIPS_INS_JR, MIPS_INS_JRADDIUSP, MIPS_INS_JRC, MIPS_INS_LB, MIPS_INS_LBU, MIPS_INS_LD, MIPS_INS_LDC1, MIPS_INS_LDC2, MIPS_INS_LDI, MIPS_INS_LDL, MIPS_INS_LH, MIPS_INS_LHU, MIPS_INS_LHX, MIPS_INS_LI, MIPS_INS_LL, MIPS_INS_LLD, MIPS_INS_LUI, MIPS_INS_LW, MIPS_INS_LWC1, MIPS_INS_LWC2, MIPS_INS_LWL, MIPS_INS_LWR, MIPS_INS_LWU, MIPS_INS_LWX, MIPS_INS_MFHI, MIPS_INS_MFLO, MIPS_INS_MOV, MIPS_INS_MOVE, MIPS_INS_MOVF, MIPS_INS_MOVT, MIPS_INS_MOVZ, MIPS_INS_MTHI, MIPS_INS_MTLO, MIPS_INS_MUL, MIPS_INS_MULT, MIPS_INS_MULTU, MIPS_INS_NEG, MIPS_INS_NEGU, MIPS_INS_NOP, MIPS_INS_NOR, MIPS_INS_OR, MIPS_INS_ORI, MIPS_INS_SB, MIPS_INS_SD, MIPS_INS_SH, MIPS_INS_SHRA, MIPS_INS_SHRA_R, MIPS_INS_SHRAV, MIPS_INS_SHRAV_R, MIPS_INS_SHRL, MIPS_INS_SLL, MIPS_INS_SLLV, MIPS_INS_SLT, MIPS_INS_SLTI, MIPS_INS_SLTIU, MIPS_INS_SLTU, MIPS_INS_SRA, MIPS_INS_SRL, MIPS_INS_SRLV, MIPS_INS_SUB, MIPS_INS_SUBU, MIPS_INS_SW, MIPS_INS_SWC1, MIPS_INS_SWC2, MIPS_INS_SWL, MIPS_INS_SWR, MIPS_INS_XOR, MIPS_INS_XORI, OPCOUNT, PFMT64d, PFMT64x, PROTECT_ZERO, REG, rz_strbuf_appendf(), rz_strbuf_init(), rz_strbuf_set(), rz_strbuf_setf(), st64, cmd_descs_generate::str, and ut64().
Referenced by analop().
|
static |
Definition at line 1205 of file analysis_mips_cs.c.
References KW, NULL, rz_list_newf(), and rz_search_keyword_free().
|
static |
Definition at line 1201 of file analysis_mips_cs.c.
Definition at line 169 of file analysis_mips_cs.c.
References cs_reg_name(), handle, MIPS_OP_IMM, MIPS_OP_INVALID, MIPS_OP_MEM, MIPS_OP_REG, n, PFMT64d, PFMT64x, sprintf, st64, ut64(), and x.
|
inlinestatic |
Definition at line 109 of file analysis_mips_cs.c.
References bit, mask, PFMT64x, rz_strbuf_appendf(), and ut64().
|
inlinestatic |
Definition at line 101 of file analysis_mips_cs.c.
References a, bit, rz_strbuf_append(), and rz_strbuf_appendf().
|
static |
Definition at line 1095 of file analysis_mips_cs.c.
References rz_analysis_t::bits, NULL, p, and strdup().
|
static |
Definition at line 618 of file analysis_mips_cs.c.
References a, c, e, handle, MIPS_INS_SLTI, MIPS_INS_SLTIU, MIPS_OP_MEM, MIPS_OP_REG, OPERAND, parse_reg_name(), PFMT64x, r2, reg, RZ_ANALYSIS_OP_TYPE_ADD, RZ_ANALYSIS_OP_TYPE_AND, RZ_ANALYSIS_OP_TYPE_DIV, RZ_ANALYSIS_OP_TYPE_LOAD, RZ_ANALYSIS_OP_TYPE_MASK, RZ_ANALYSIS_OP_TYPE_MOV, RZ_ANALYSIS_OP_TYPE_OR, RZ_ANALYSIS_OP_TYPE_SAR, RZ_ANALYSIS_OP_TYPE_SHL, RZ_ANALYSIS_OP_TYPE_SHR, RZ_ANALYSIS_OP_TYPE_STORE, RZ_ANALYSIS_OP_TYPE_SUB, RZ_ANALYSIS_OP_TYPE_XOR, RZ_ANALYSIS_VAL_MEM, rz_analysis_value_new(), RZ_LOG_ERROR, SET_SRC_DST_2_REGS, SET_SRC_DST_3_IMM, SET_SRC_DST_3_REG_OR_IMM, SET_SRC_DST_3_REGS, type, and ZERO_FILL.
Referenced by analop().
Definition at line 127 of file analysis_mips_cs.c.
References cs_reg_name(), handle, i, MIPS_OP_IMM, MIPS_OP_MEM, MIPS_OP_REG, MIPS_REG_INVALID, pj_end(), pj_free(), pj_ka(), pj_kN(), pj_ks(), pj_new(), pj_o(), pj_string(), rz_strbuf_append(), rz_strbuf_init(), and x.
Referenced by analop().
Definition at line 600 of file analysis_mips_cs.c.
References cs_reg_name(), handle, MIPS_OP_MEM, MIPS_OP_REG, MIPS_REG_INVALID, OPERAND, reg, and type.
Referenced by op_fillval().
|
static |
Definition at line 696 of file analysis_mips_cs.c.
References RZ_ANALYSIS_OP_DIR_EXEC, RZ_ANALYSIS_OP_DIR_READ, RZ_ANALYSIS_OP_DIR_REF, RZ_ANALYSIS_OP_DIR_WRITE, RZ_ANALYSIS_OP_TYPE_CALL, RZ_ANALYSIS_OP_TYPE_JMP, RZ_ANALYSIS_OP_TYPE_LEA, RZ_ANALYSIS_OP_TYPE_LOAD, RZ_ANALYSIS_OP_TYPE_MASK, RZ_ANALYSIS_OP_TYPE_STORE, RZ_ANALYSIS_OP_TYPE_UCALL, and RZ_ANALYSIS_OP_TYPE_UJMP.
Referenced by analop().
RZ_API RzLibStruct rizin_plugin |
Definition at line 1226 of file analysis_mips_cs.c.
RzAnalysisPlugin rz_analysis_plugin_mips_cs |
Definition at line 1212 of file analysis_mips_cs.c.
Definition at line 9 of file analysis_mips_cs.c.
Referenced by analop().