Rizin
unix-like reverse engineering framework and cli tools
|
#include <rz_analysis.h>
#include <rz_lib.h>
#include <capstone/capstone.h>
#include <capstone/ppc.h>
#include "../../asm/arch/ppc/libvle/vle.h"
Go to the source code of this file.
Classes | |
struct | Getarg |
Macros | |
#define | SPR_HID0 0x3f0 /* Hardware Implementation Register 0 */ |
#define | SPR_HID1 0x3f1 /* Hardware Implementation Register 1 */ |
#define | SPR_HID2 0x3f3 /* Hardware Implementation Register 2 */ |
#define | SPR_HID4 0x3f4 /* Hardware Implementation Register 4 */ |
#define | SPR_HID5 0x3f6 /* Hardware Implementation Register 5 */ |
#define | SPR_HID6 0x3f9 /* Hardware Implementation Register 6 */ |
#define | INSOPS insn->detail->ppc.op_count |
#define | INSOP(n) insn->detail->ppc.operands[n] |
#define | IMM(x) (ut64)(insn->detail->ppc.operands[x].imm) |
#define | PFMT32x "lx" |
#define | PPCSPR(n) getspr(&gop, n) |
#define | ARG(n) getarg2(&gop, n, "") |
#define | ARG2(n, m) getarg2(&gop, n, m) |
#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 ut64 | mask64 (ut64 mb, ut64 me) |
static ut32 | mask32 (ut32 mb, ut32 me) |
static const char * | cmask64 (const char *mb_c, const char *me_c) |
static const char * | cmask32 (const char *mb_c, const char *me_c) |
static char * | getarg2 (struct Getarg *gop, int n, const char *setstr) |
static ut64 | getarg (struct Getarg *gop, int n) |
static const char * | getspr (struct Getarg *gop, int n) |
static void | opex (RzStrBuf *buf, csh handle, cs_insn *insn) |
static char * | get_reg_profile (RzAnalysis *analysis) |
static int | analop_vle (RzAnalysis *a, RzAnalysisOp *op, ut64 addr, const ut8 *buf, int len, RzAnalysisOpMask mask) |
static int | parse_reg_name (RzRegItem *reg, csh handle, cs_insn *insn, int reg_num) |
static void | create_src_dst (RzAnalysisOp *op) |
static void | set_src_dst (RzAnalysisValue *val, csh *handle, cs_insn *insn, int x) |
static void | op_fillval (RzAnalysisOp *op, csh handle, cs_insn *insn) |
static char * | shrink (char *op) |
static int | analop (RzAnalysis *a, RzAnalysisOp *op, ut64 addr, const ut8 *buf, int len, RzAnalysisOpMask mask) |
static int | archinfo (RzAnalysis *a, int q) |
static RzList * | analysis_preludes (RzAnalysis *analysis) |
Variables | |
static RzRegItem | base_regs [4] |
RzAnalysisPlugin | rz_analysis_plugin_ppc_cs |
RZ_API RzLibStruct | rizin_plugin |
Definition at line 207 of file analysis_ppc_cs.c.
Definition at line 208 of file analysis_ppc_cs.c.
#define IMM | ( | x | ) | (ut64)(insn->detail->ppc.operands[x].imm) |
Definition at line 25 of file analysis_ppc_cs.c.
#define INSOP | ( | n | ) | insn->detail->ppc.operands[n] |
Definition at line 24 of file analysis_ppc_cs.c.
#define INSOPS insn->detail->ppc.op_count |
Definition at line 23 of file analysis_ppc_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 PFMT32x "lx" |
Definition at line 28 of file analysis_ppc_cs.c.
Definition at line 206 of file analysis_ppc_cs.c.
#define SPR_HID0 0x3f0 /* Hardware Implementation Register 0 */ |
Definition at line 10 of file analysis_ppc_cs.c.
#define SPR_HID1 0x3f1 /* Hardware Implementation Register 1 */ |
Definition at line 11 of file analysis_ppc_cs.c.
#define SPR_HID2 0x3f3 /* Hardware Implementation Register 2 */ |
Definition at line 12 of file analysis_ppc_cs.c.
#define SPR_HID4 0x3f4 /* Hardware Implementation Register 4 */ |
Definition at line 13 of file analysis_ppc_cs.c.
#define SPR_HID5 0x3f6 /* Hardware Implementation Register 5 */ |
Definition at line 14 of file analysis_ppc_cs.c.
#define SPR_HID6 0x3f9 /* Hardware Implementation Register 6 */ |
Definition at line 15 of file analysis_ppc_cs.c.
|
static |
Definition at line 601 of file analysis_ppc_cs.c.
References a, addr, analop_vle(), ARG, ARG2, cmask32(), cmask64(), CS_ARCH_PPC, cs_close(), cs_disasm(), capstone::CS_ERR_OK, cs_free(), CS_MODE_32, CS_MODE_64, CS_MODE_BIG_ENDIAN, CS_MODE_LITTLE_ENDIAN, cs_open(), CS_OPT_DETAIL, CS_OPT_ON, cs_option(), esilprintf, Getarg::handle, handle, IMM, Getarg::insn, len, mask, n, op_fillval(), opex(), PPC_BC_EQ, PPC_BC_GE, PPC_BC_GT, PPC_BC_INVALID, PPC_BC_LE, PPC_BC_LT, PPC_BC_NE, PPC_BC_NS, PPC_BC_NU, PPC_BC_SO, PPC_BC_UN, PPC_INS_ADD, PPC_INS_ADDC, PPC_INS_ADDE, PPC_INS_ADDI, PPC_INS_ADDIC, PPC_INS_ADDIS, PPC_INS_ADDME, PPC_INS_ADDZE, PPC_INS_AND, PPC_INS_ANDI, PPC_INS_ANDIS, PPC_INS_B, PPC_INS_BA, PPC_INS_BC, PPC_INS_BCLR, PPC_INS_BCLRL, PPC_INS_BCTR, PPC_INS_BCTRL, PPC_INS_BDNZ, PPC_INS_BDNZA, PPC_INS_BDNZL, PPC_INS_BDNZLA, PPC_INS_BDNZLR, PPC_INS_BDNZLRL, PPC_INS_BDZ, PPC_INS_BDZA, PPC_INS_BDZL, PPC_INS_BDZLA, PPC_INS_BDZLR, PPC_INS_BDZLRL, PPC_INS_BF, PPC_INS_BL, PPC_INS_BLA, PPC_INS_BLR, PPC_INS_BLRL, PPC_INS_BT, PPC_INS_CLRLDI, PPC_INS_CLRLWI, PPC_INS_CMPB, PPC_INS_CMPD, PPC_INS_CMPDI, PPC_INS_CMPLD, PPC_INS_CMPLDI, PPC_INS_CMPLW, PPC_INS_CMPLWI, PPC_INS_CMPW, PPC_INS_CMPWI, PPC_INS_CRCLR, PPC_INS_CRMOVE, PPC_INS_CRNOR, PPC_INS_CRNOT, PPC_INS_CRSET, PPC_INS_CRXOR, PPC_INS_DCBZ, PPC_INS_DIVD, PPC_INS_DIVDU, PPC_INS_DIVW, PPC_INS_DIVWU, PPC_INS_EIEIO, PPC_INS_EXTSB, PPC_INS_EXTSH, PPC_INS_EXTSW, PPC_INS_ISYNC, PPC_INS_LBZ, PPC_INS_LBZCIX, PPC_INS_LBZU, PPC_INS_LBZUX, PPC_INS_LBZX, PPC_INS_LD, PPC_INS_LDARX, PPC_INS_LDBRX, PPC_INS_LDCIX, PPC_INS_LDU, PPC_INS_LDUX, PPC_INS_LDX, PPC_INS_LFD, PPC_INS_LFDU, PPC_INS_LFDUX, PPC_INS_LFDX, PPC_INS_LFIWAX, PPC_INS_LFIWZX, PPC_INS_LFS, PPC_INS_LFSU, PPC_INS_LFSUX, PPC_INS_LFSX, PPC_INS_LHA, PPC_INS_LHAU, PPC_INS_LHAUX, PPC_INS_LHAX, PPC_INS_LHBRX, PPC_INS_LHZ, PPC_INS_LHZU, PPC_INS_LI, PPC_INS_LIS, PPC_INS_LWA, PPC_INS_LWARX, PPC_INS_LWAUX, PPC_INS_LWAX, PPC_INS_LWBRX, PPC_INS_LWSYNC, PPC_INS_LWZ, PPC_INS_LWZCIX, PPC_INS_LWZU, PPC_INS_LWZUX, PPC_INS_LWZX, PPC_INS_MFCTR, PPC_INS_MFDCCR, PPC_INS_MFDEAR, PPC_INS_MFICCR, PPC_INS_MFLR, PPC_INS_MFMSR, PPC_INS_MFPVR, PPC_INS_MFSPR, PPC_INS_MR, PPC_INS_MSYNC, PPC_INS_MTCTR, PPC_INS_MTDCCR, PPC_INS_MTDEAR, PPC_INS_MTICCR, PPC_INS_MTLR, PPC_INS_MTMSR, PPC_INS_MTMSRD, PPC_INS_MTSPR, PPC_INS_MULLD, PPC_INS_MULLI, PPC_INS_MULLW, PPC_INS_NAND, PPC_INS_NOP, PPC_INS_NOR, PPC_INS_OR, PPC_INS_ORI, PPC_INS_ORIS, PPC_INS_PTESYNC, PPC_INS_RLDCL, PPC_INS_RLDCR, PPC_INS_RLDICL, PPC_INS_RLDICR, PPC_INS_RLWINM, PPC_INS_ROTLDI, PPC_INS_SC, PPC_INS_SLBIA, PPC_INS_SLBIE, PPC_INS_SLBMFEE, PPC_INS_SLBMTE, PPC_INS_SLW, PPC_INS_SLWI, PPC_INS_SRW, PPC_INS_SRWI, PPC_INS_STB, PPC_INS_STBU, PPC_INS_STD, PPC_INS_STDU, PPC_INS_STH, PPC_INS_STHU, PPC_INS_STW, PPC_INS_STWBRX, PPC_INS_STWCX, PPC_INS_STWU, PPC_INS_STWUX, PPC_INS_STWX, PPC_INS_SUB, PPC_INS_SUBC, PPC_INS_SUBF, PPC_INS_SUBFIC, PPC_INS_SUBFZE, PPC_INS_SYNC, PPC_INS_TLBSYNC, PPC_INS_TRAP, PPC_INS_XOR, PPC_INS_XORI, PPC_INS_XORIS, PPC_OP_CRX, PPC_OP_REG, PPCSPR, 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_CRET, 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_NOR, RZ_ANALYSIS_OP_TYPE_OR, RZ_ANALYSIS_OP_TYPE_RET, RZ_ANALYSIS_OP_TYPE_ROL, 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_UCJMP, RZ_ANALYSIS_OP_TYPE_UJMP, RZ_ANALYSIS_OP_TYPE_XOR, RZ_ANALYSIS_STACK_INC, rz_strbuf_fini(), shrink(), st16, and strdup().
|
static |
Definition at line 417 of file analysis_ppc_cs.c.
References addr, vle_t::analysis_op, vle_t::cond, vle_t::fields, handle, len, mask, vle_t::n, vle_t::name, NULL, RZ_ANALYSIS_OP_MASK_DISASM, RZ_ANALYSIS_OP_TYPE_ADD, RZ_ANALYSIS_OP_TYPE_AND, RZ_ANALYSIS_OP_TYPE_CALL, RZ_ANALYSIS_OP_TYPE_CCALL, RZ_ANALYSIS_OP_TYPE_CJMP, RZ_ANALYSIS_OP_TYPE_CMP, 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_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_ROL, RZ_ANALYSIS_OP_TYPE_ROR, 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_SYNC, RZ_ANALYSIS_OP_TYPE_TRAP, RZ_ANALYSIS_OP_TYPE_XOR, vle_t::size, strdup(), vle_field_t::value, vle_free(), vle_init(), and vle_next().
Referenced by analop().
|
static |
Definition at line 1310 of file analysis_ppc_cs.c.
References KW, NULL, rz_list_newf(), and rz_search_keyword_free().
|
static |
Definition at line 1303 of file analysis_ppc_cs.c.
References a.
|
static |
Definition at line 525 of file analysis_ppc_cs.c.
References base_regs, rz_analysis_value_new(), and ZERO_FILL.
Referenced by op_fillval().
|
static |
Definition at line 210 of file analysis_ppc_cs.c.
References rz_analysis_t::bits, NULL, p, and strdup().
Definition at line 108 of file analysis_ppc_cs.c.
References Getarg::insn, INSOP, n, op, PPC_OP_CRX, PPC_OP_IMM, PPC_OP_INVALID, PPC_OP_MEM, PPC_OP_REG, ut64(), and value.
Referenced by getspr().
Definition at line 71 of file analysis_ppc_cs.c.
References cs_reg_name(), Getarg::handle, handle, Getarg::insn, INSOP, n, NULL, op, PFMT64d, PFMT64x, PPC_OP_CRX, PPC_OP_IMM, PPC_OP_INVALID, PPC_OP_MEM, PPC_OP_REG, snprintf, and ut64().
Definition at line 31 of file analysis_ppc_cs.c.
References ut64(), and UT64_MAX.
Referenced by cmask64().
|
static |
Definition at line 554 of file analysis_ppc_cs.c.
References create_src_dst(), handle, RZ_ANALYSIS_OP_TYPE_ADD, RZ_ANALYSIS_OP_TYPE_AND, RZ_ANALYSIS_OP_TYPE_CAST, RZ_ANALYSIS_OP_TYPE_CMP, RZ_ANALYSIS_OP_TYPE_DIV, RZ_ANALYSIS_OP_TYPE_LEA, RZ_ANALYSIS_OP_TYPE_LOAD, RZ_ANALYSIS_OP_TYPE_MASK, RZ_ANALYSIS_OP_TYPE_MOV, RZ_ANALYSIS_OP_TYPE_MUL, RZ_ANALYSIS_OP_TYPE_NOR, RZ_ANALYSIS_OP_TYPE_NOT, RZ_ANALYSIS_OP_TYPE_OR, RZ_ANALYSIS_OP_TYPE_ROL, RZ_ANALYSIS_OP_TYPE_ROR, RZ_ANALYSIS_OP_TYPE_SAL, 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, and set_src_dst().
Referenced by analop().
Definition at line 164 of file analysis_ppc_cs.c.
References cs_reg_name(), handle, i, pj_end(), pj_free(), pj_ka(), pj_ki(), pj_kN(), pj_ks(), pj_new(), pj_o(), pj_string(), PPC_OP_IMM, PPC_OP_MEM, PPC_OP_REG, PPC_REG_INVALID, rz_strbuf_append(), rz_strbuf_init(), and x.
Referenced by analop().
Definition at line 504 of file analysis_ppc_cs.c.
References cs_reg_name(), handle, INSOP, PPC_OP_MEM, PPC_OP_REG, PPC_REG_INVALID, reg, and type.
Referenced by set_src_dst().
|
static |
Definition at line 536 of file analysis_ppc_cs.c.
References base_regs, ppc_op_mem::disp, handle, cs_ppc_op::imm, INSOP, cs_ppc_op::mem, parse_reg_name(), PPC_OP_IMM, PPC_OP_MEM, PPC_OP_REG, cs_ppc_op::type, val, and x.
Referenced by op_fillval().
|
static |
|
static |
Definition at line 523 of file analysis_ppc_cs.c.
Referenced by create_src_dst(), and set_src_dst().
RZ_API RzLibStruct rizin_plugin |
Definition at line 1331 of file analysis_ppc_cs.c.
RzAnalysisPlugin rz_analysis_plugin_ppc_cs |
Definition at line 1317 of file analysis_ppc_cs.c.