Rizin
unix-like reverse engineering framework and cli tools
|
#include <rz_types.h>
#include <rz_analysis.h>
#include <rz_lib.h>
#include "../../asm/arch/pic/pic_midrange.h"
Go to the source code of this file.
Classes | |
struct | _pic_midrange_op_args_val |
struct | _pic_midrange_op_analysis_info |
Macros | |
#define | INST_HANDLER(OPCODE_NAME) |
#define | INST_DECL(NAME, ARGS) |
#define | e(frag) rz_strbuf_append(&op->esil, frag) |
#define | ef(frag, ...) rz_strbuf_appendf(&op->esil, frag, __VA_ARGS__) |
#define | PIC_MIDRANGE_ESIL_SRAM_START (1 << 16) |
#define | PIC_MIDRANGE_ESIL_CSTACK_TOP ((1 << 16) + (1 << 12)) |
#define | PIC_MIDRANGE_ESIL_BSR_ADDR "bsr,0x80,*,0x%x,+,_sram,+" |
#define | PIC_MIDRANGE_ESIL_OPTION_ADDR "0x95,_sram,+" |
#define | PIC_MIDRANGE_ESIL_UPDATE_FLAGS |
#define | PIC_MIDRANGE_ESIL_LW_OP(O) "0x%x,wreg," #O "=," PIC_MIDRANGE_ESIL_UPDATE_FLAGS |
#define | PIC_MIDRANGE_ESIL_FWF_OP(O) |
#define | PIC_MIDRANGE_ESIL_WWF_OP(O) |
#define | PIC_MIDRANGE_ESIL_FWF_OP_C(O) |
#define | PIC_MIDRANGE_ESIL_WWF_OP_C(O) |
#define | PIC_MIDRANGE_OPINFO_LEN 52 |
Typedefs | |
typedef struct _pic_midrange_op_args_val | PicMidrangeOpArgsVal |
typedef void(* | pic_midrange_inst_handler_t) (RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, PicMidrangeOpArgsVal *args) |
typedef struct _pic_midrange_op_analysis_info | PicMidrangeOpAnalInfo |
Variables | |
static const PicMidrangeOpAnalInfo | pic_midrange_op_analysis_info [PIC_MIDRANGE_OPINFO_LEN] |
static RzIODesc * | mem_sram = 0 |
static RzIODesc * | mem_stack = 0 |
RzAnalysisPlugin | rz_analysis_plugin_pic |
RZ_API RzLibStruct | rizin_plugin |
#define e | ( | frag | ) | rz_strbuf_append(&op->esil, frag) |
Definition at line 41 of file analysis_pic.c.
#define ef | ( | frag, | |
... | |||
) | rz_strbuf_appendf(&op->esil, frag, __VA_ARGS__) |
Definition at line 42 of file analysis_pic.c.
#define INST_DECL | ( | NAME, | |
ARGS | |||
) |
Definition at line 35 of file analysis_pic.c.
#define INST_HANDLER | ( | OPCODE_NAME | ) |
Definition at line 31 of file analysis_pic.c.
#define PIC_MIDRANGE_ESIL_BSR_ADDR "bsr,0x80,*,0x%x,+,_sram,+" |
Definition at line 47 of file analysis_pic.c.
#define PIC_MIDRANGE_ESIL_CSTACK_TOP ((1 << 16) + (1 << 12)) |
Definition at line 45 of file analysis_pic.c.
#define PIC_MIDRANGE_ESIL_FWF_OP | ( | O | ) |
Definition at line 59 of file analysis_pic.c.
#define PIC_MIDRANGE_ESIL_FWF_OP_C | ( | O | ) |
Definition at line 68 of file analysis_pic.c.
#define PIC_MIDRANGE_ESIL_LW_OP | ( | O | ) | "0x%x,wreg," #O "=," PIC_MIDRANGE_ESIL_UPDATE_FLAGS |
Definition at line 56 of file analysis_pic.c.
#define PIC_MIDRANGE_ESIL_OPTION_ADDR "0x95,_sram,+" |
Definition at line 49 of file analysis_pic.c.
#define PIC_MIDRANGE_ESIL_SRAM_START (1 << 16) |
Definition at line 44 of file analysis_pic.c.
#define PIC_MIDRANGE_ESIL_UPDATE_FLAGS |
Definition at line 51 of file analysis_pic.c.
#define PIC_MIDRANGE_ESIL_WWF_OP | ( | O | ) |
Definition at line 63 of file analysis_pic.c.
#define PIC_MIDRANGE_ESIL_WWF_OP_C | ( | O | ) |
Definition at line 73 of file analysis_pic.c.
#define PIC_MIDRANGE_OPINFO_LEN 52 |
Definition at line 557 of file analysis_pic.c.
typedef void(* pic_midrange_inst_handler_t) (RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, PicMidrangeOpArgsVal *args) |
Definition at line 21 of file analysis_pic.c.
typedef struct _pic_midrange_op_analysis_info PicMidrangeOpAnalInfo |
typedef struct _pic_midrange_op_args_val PicMidrangeOpArgsVal |
|
static |
Definition at line 1173 of file analysis_pic.c.
References analysis_pic_midrange_get_reg_profile(), analysis_pic_pic18_get_reg_profile(), rz_analysis_t::cpu, and NULL.
|
static |
Definition at line 587 of file analysis_pic.c.
References args, _pic_midrange_op_args_val::b, _pic_midrange_op_args_val::d, _pic_midrange_op_args_val::f, _pic_midrange_op_args_val::k, _pic_midrange_op_args_val::m, memset(), _pic_midrange_op_args_val::n, PIC_MIDRANGE_OP_ARGS_11K, PIC_MIDRANGE_OP_ARGS_11K_MASK_K, PIC_MIDRANGE_OP_ARGS_1D_7F, PIC_MIDRANGE_OP_ARGS_1D_7F_MASK_D, PIC_MIDRANGE_OP_ARGS_1D_7F_MASK_F, PIC_MIDRANGE_OP_ARGS_1N_2M, PIC_MIDRANGE_OP_ARGS_1N_2M_MASK_M, PIC_MIDRANGE_OP_ARGS_1N_2M_MASK_N, PIC_MIDRANGE_OP_ARGS_1N_6K, PIC_MIDRANGE_OP_ARGS_1N_6K_MASK_K, PIC_MIDRANGE_OP_ARGS_1N_6K_MASK_N, PIC_MIDRANGE_OP_ARGS_2F, PIC_MIDRANGE_OP_ARGS_2F_MASK_F, PIC_MIDRANGE_OP_ARGS_3B_7F, PIC_MIDRANGE_OP_ARGS_3B_7F_MASK_B, PIC_MIDRANGE_OP_ARGS_3B_7F_MASK_F, PIC_MIDRANGE_OP_ARGS_4K, PIC_MIDRANGE_OP_ARGS_4K_MASK_K, PIC_MIDRANGE_OP_ARGS_7F, PIC_MIDRANGE_OP_ARGS_7F_MASK_F, PIC_MIDRANGE_OP_ARGS_8K, PIC_MIDRANGE_OP_ARGS_8K_MASK_K, PIC_MIDRANGE_OP_ARGS_9K, PIC_MIDRANGE_OP_ARGS_9K_MASK_K, and PIC_MIDRANGE_OP_ARGS_NONE.
Referenced by analysis_pic_midrange_op().
|
static |
Definition at line 1010 of file analysis_pic.c.
Referenced by analysis_pic_get_reg_profile().
|
static |
Definition at line 662 of file analysis_pic.c.
References cpu_memory_map(), rz_analysis_t::iob, mem_sram, mem_stack, PIC_MIDRANGE_ESIL_CSTACK_TOP, PIC_MIDRANGE_ESIL_SRAM_START, pic_midrange_reg_write(), and rz_analysis_t::reg.
Referenced by analysis_pic_midrange_op().
|
static |
Definition at line 686 of file analysis_pic.c.
References addr, analysis_pic_midrange_extract_args(), analysis_pic_midrange_malloc(), args, _pic_midrange_op_analysis_info::handler, i, len, pic_midrange_get_opcode(), pic_midrange_op_analysis_info, PIC_MIDRANGE_OPINFO_LEN, RZ_ANALYSIS_OP_TYPE_ILL, RZ_ANALYSIS_OP_TYPE_NOP, and rz_read_le16().
Referenced by analysis_pic_op().
|
static |
Definition at line 1159 of file analysis_pic.c.
References addr, analysis_pic_midrange_op(), analysis_pic_pic18_op(), rz_analysis_t::cpu, and len.
|
static |
|
static |
Definition at line 731 of file analysis_pic.c.
References addr, b, len, memcpy(), PFMT64x, pic18_cond_branch(), 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_CPL, 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_OR, RZ_ANALYSIS_OP_TYPE_POP, RZ_ANALYSIS_OP_TYPE_PUSH, RZ_ANALYSIS_OP_TYPE_RET, RZ_ANALYSIS_OP_TYPE_ROL, RZ_ANALYSIS_OP_TYPE_ROR, RZ_ANALYSIS_OP_TYPE_STORE, RZ_ANALYSIS_OP_TYPE_SUB, RZ_ANALYSIS_OP_TYPE_UNK, RZ_ANALYSIS_OP_TYPE_XOR, RZ_MIN, and rz_strbuf_setf().
Referenced by analysis_pic_op().
Definition at line 639 of file analysis_pic.c.
References addr, desc, rz_io_bind_t::fd_get_name, rz_io_bind_t::fd_remap, free(), rz_io_bind_t::io, NULL, rz_io_bind_t::open_at, RZ_PERM_RW, and rz_str_newf().
Referenced by analysis_pic_midrange_malloc().
INST_HANDLER | ( | ADDFSR | ) |
INST_HANDLER | ( | ADDLW | ) |
Definition at line 278 of file analysis_pic.c.
References args, ef, PIC_MIDRANGE_ESIL_LW_OP, and RZ_ANALYSIS_OP_TYPE_ADD.
INST_HANDLER | ( | ADDWF | ) |
Definition at line 264 of file analysis_pic.c.
References args, ef, PIC_MIDRANGE_ESIL_FWF_OP, PIC_MIDRANGE_ESIL_WWF_OP, and RZ_ANALYSIS_OP_TYPE_ADD.
INST_HANDLER | ( | ADDWFC | ) |
Definition at line 470 of file analysis_pic.c.
References args, ef, PIC_MIDRANGE_ESIL_FWF_OP_C, PIC_MIDRANGE_ESIL_WWF_OP_C, and RZ_ANALYSIS_OP_TYPE_ADD.
INST_HANDLER | ( | ANDLW | ) |
Definition at line 288 of file analysis_pic.c.
References args, ef, PIC_MIDRANGE_ESIL_LW_OP, and RZ_ANALYSIS_OP_TYPE_AND.
INST_HANDLER | ( | ANDWF | ) |
Definition at line 246 of file analysis_pic.c.
References args, ef, PIC_MIDRANGE_ESIL_FWF_OP, PIC_MIDRANGE_ESIL_WWF_OP, and RZ_ANALYSIS_OP_TYPE_AND.
INST_HANDLER | ( | ASRF | ) |
Definition at line 379 of file analysis_pic.c.
References args, e, ef, PIC_MIDRANGE_ESIL_BSR_ADDR, and RZ_ANALYSIS_OP_TYPE_SHR.
INST_HANDLER | ( | BCF | ) |
Definition at line 119 of file analysis_pic.c.
References args, ef, mask, and PIC_MIDRANGE_ESIL_BSR_ADDR.
INST_HANDLER | ( | BRA | ) |
Definition at line 151 of file analysis_pic.c.
References addr, args, test-lz4-speed::branch, ef, RZ_ANALYSIS_OP_TYPE_JMP, and st16.
INST_HANDLER | ( | BRW | ) |
Definition at line 160 of file analysis_pic.c.
References addr, e, NULL, rz_analysis_esil_reg_read(), RZ_ANALYSIS_OP_TYPE_UJMP, and ut64().
INST_HANDLER | ( | BSF | ) |
Definition at line 126 of file analysis_pic.c.
References args, ef, mask, and PIC_MIDRANGE_ESIL_BSR_ADDR.
INST_HANDLER | ( | BTFSC | ) |
Definition at line 133 of file analysis_pic.c.
References addr, args, ef, mask, PFMT64x, PIC_MIDRANGE_ESIL_BSR_ADDR, and RZ_ANALYSIS_OP_TYPE_CJMP.
INST_HANDLER | ( | BTFSS | ) |
Definition at line 142 of file analysis_pic.c.
References addr, args, ef, mask, PFMT64x, PIC_MIDRANGE_ESIL_BSR_ADDR, and RZ_ANALYSIS_OP_TYPE_CJMP.
INST_HANDLER | ( | CALL | ) |
Definition at line 99 of file analysis_pic.c.
References addr, args, e, ef, NULL, PFMT64x, rz_analysis_esil_reg_read(), RZ_ANALYSIS_OP_TYPE_CALL, and ut64().
INST_HANDLER | ( | CALLW | ) |
Definition at line 322 of file analysis_pic.c.
References addr, e, ef, PFMT64x, and RZ_ANALYSIS_OP_TYPE_UCALL.
INST_HANDLER | ( | CLR | ) |
Definition at line 168 of file analysis_pic.c.
References args, e, ef, and PIC_MIDRANGE_ESIL_BSR_ADDR.
INST_HANDLER | ( | CLRWDT | ) |
Definition at line 449 of file analysis_pic.c.
References e.
INST_HANDLER | ( | COMF | ) |
Definition at line 422 of file analysis_pic.c.
References args, e, ef, and PIC_MIDRANGE_ESIL_BSR_ADDR.
INST_HANDLER | ( | DECF | ) |
Definition at line 226 of file analysis_pic.c.
References args, e, ef, PIC_MIDRANGE_ESIL_BSR_ADDR, and RZ_ANALYSIS_OP_TYPE_SUB.
INST_HANDLER | ( | DECFSZ | ) |
Definition at line 187 of file analysis_pic.c.
References addr, args, ef, PFMT64x, PIC_MIDRANGE_ESIL_BSR_ADDR, and RZ_ANALYSIS_OP_TYPE_CJMP.
INST_HANDLER | ( | GOTO | ) |
Definition at line 111 of file analysis_pic.c.
References args, ef, NULL, rz_analysis_esil_reg_read(), RZ_ANALYSIS_OP_TYPE_JMP, and ut64().
INST_HANDLER | ( | INCF | ) |
Definition at line 215 of file analysis_pic.c.
References args, e, ef, PIC_MIDRANGE_ESIL_BSR_ADDR, and RZ_ANALYSIS_OP_TYPE_ADD.
INST_HANDLER | ( | INCFSZ | ) |
Definition at line 201 of file analysis_pic.c.
References addr, args, ef, PFMT64x, PIC_MIDRANGE_ESIL_BSR_ADDR, and RZ_ANALYSIS_OP_TYPE_CJMP.
INST_HANDLER | ( | IORLW | ) |
Definition at line 283 of file analysis_pic.c.
References args, ef, PIC_MIDRANGE_ESIL_LW_OP, and RZ_ANALYSIS_OP_TYPE_OR.
INST_HANDLER | ( | IORWF | ) |
Definition at line 237 of file analysis_pic.c.
References args, ef, PIC_MIDRANGE_ESIL_FWF_OP, PIC_MIDRANGE_ESIL_WWF_OP, and RZ_ANALYSIS_OP_TYPE_OR.
INST_HANDLER | ( | LSLF | ) |
Definition at line 355 of file analysis_pic.c.
References args, e, ef, PIC_MIDRANGE_ESIL_BSR_ADDR, and RZ_ANALYSIS_OP_TYPE_SHL.
INST_HANDLER | ( | LSRF | ) |
Definition at line 367 of file analysis_pic.c.
References args, e, ef, PIC_MIDRANGE_ESIL_BSR_ADDR, and RZ_ANALYSIS_OP_TYPE_SHR.
INST_HANDLER | ( | MOVF | ) |
Definition at line 336 of file analysis_pic.c.
References args, e, ef, PIC_MIDRANGE_ESIL_BSR_ADDR, and RZ_ANALYSIS_OP_TYPE_LOAD.
INST_HANDLER | ( | MOVIW_1 | ) |
Definition at line 479 of file analysis_pic.c.
INST_HANDLER | ( | MOVIW_2 | ) |
INST_HANDLER | ( | MOVLB | ) |
Definition at line 317 of file analysis_pic.c.
References args, ef, and RZ_ANALYSIS_OP_TYPE_LOAD.
INST_HANDLER | ( | MOVLP | ) |
Definition at line 312 of file analysis_pic.c.
References args, ef, and RZ_ANALYSIS_OP_TYPE_LOAD.
INST_HANDLER | ( | MOVLW | ) |
Definition at line 298 of file analysis_pic.c.
References args, ef, and RZ_ANALYSIS_OP_TYPE_LOAD.
INST_HANDLER | ( | MOVWF | ) |
Definition at line 331 of file analysis_pic.c.
References args, ef, PIC_MIDRANGE_ESIL_BSR_ADDR, and RZ_ANALYSIS_OP_TYPE_STORE.
INST_HANDLER | ( | MOVWI_1 | ) |
Definition at line 509 of file analysis_pic.c.
INST_HANDLER | ( | MOVWI_2 | ) |
INST_HANDLER | ( | NOP | ) |
Definition at line 77 of file analysis_pic.c.
INST_HANDLER | ( | OPTION | ) |
Definition at line 83 of file analysis_pic.c.
References RZ_ANALYSIS_OP_TYPE_STORE.
INST_HANDLER | ( | RESET | ) |
INST_HANDLER | ( | RETFIE | ) |
Definition at line 79 of file analysis_pic.c.
References RZ_ANALYSIS_OP_TYPE_RET.
INST_HANDLER | ( | RETLW | ) |
INST_HANDLER | ( | RETURN | ) |
INST_HANDLER | ( | RLF | ) |
Definition at line 407 of file analysis_pic.c.
References args, e, ef, PIC_MIDRANGE_ESIL_BSR_ADDR, and RZ_ANALYSIS_OP_TYPE_ROL.
INST_HANDLER | ( | RRF | ) |
Definition at line 392 of file analysis_pic.c.
References args, e, ef, PIC_MIDRANGE_ESIL_BSR_ADDR, and RZ_ANALYSIS_OP_TYPE_ROR.
INST_HANDLER | ( | SLEEP | ) |
Definition at line 454 of file analysis_pic.c.
References e.
INST_HANDLER | ( | SUBLW | ) |
Definition at line 273 of file analysis_pic.c.
References args, ef, PIC_MIDRANGE_ESIL_LW_OP, and RZ_ANALYSIS_OP_TYPE_SUB.
INST_HANDLER | ( | SUBWF | ) |
Definition at line 177 of file analysis_pic.c.
References args, e, ef, PIC_MIDRANGE_ESIL_FWF_OP, PIC_MIDRANGE_ESIL_WWF_OP, and RZ_ANALYSIS_OP_TYPE_SUB.
INST_HANDLER | ( | SUBWFB | ) |
Definition at line 459 of file analysis_pic.c.
References args, e, ef, PIC_MIDRANGE_ESIL_FWF_OP_C, PIC_MIDRANGE_ESIL_WWF_OP_C, and RZ_ANALYSIS_OP_TYPE_SUB.
INST_HANDLER | ( | SWAPF | ) |
Definition at line 348 of file analysis_pic.c.
References args, e, ef, and PIC_MIDRANGE_ESIL_BSR_ADDR.
INST_HANDLER | ( | TRIS | ) |
Definition at line 87 of file analysis_pic.c.
References RZ_ANALYSIS_OP_TYPE_STORE.
INST_HANDLER | ( | XORLW | ) |
Definition at line 293 of file analysis_pic.c.
References args, ef, PIC_MIDRANGE_ESIL_LW_OP, and RZ_ANALYSIS_OP_TYPE_XOR.
INST_HANDLER | ( | XORWF | ) |
Definition at line 255 of file analysis_pic.c.
References args, ef, PIC_MIDRANGE_ESIL_FWF_OP, PIC_MIDRANGE_ESIL_WWF_OP, and RZ_ANALYSIS_OP_TYPE_XOR.
|
static |
Definition at line 723 of file analysis_pic.c.
References addr, PFMT64x, RZ_ANALYSIS_OP_TYPE_CJMP, and rz_strbuf_setf().
Referenced by analysis_pic_pic18_op().
Definition at line 651 of file analysis_pic.c.
References num, reg, regname(), rz_reg_get(), rz_reg_set_value(), and RZ_REG_TYPE_GPR.
Referenced by analysis_pic_midrange_malloc().
|
static |
Definition at line 636 of file analysis_pic.c.
Referenced by analysis_pic_midrange_malloc().
|
static |
Definition at line 637 of file analysis_pic.c.
Referenced by analysis_pic_midrange_malloc().
|
static |
Definition at line 558 of file analysis_pic.c.
Referenced by analysis_pic_midrange_op().
RZ_API RzLibStruct rizin_plugin |
Definition at line 1199 of file analysis_pic.c.
RzAnalysisPlugin rz_analysis_plugin_pic |
Definition at line 1187 of file analysis_pic.c.