Rizin
unix-like reverse engineering framework and cli tools
|
Go to the source code of this file.
Classes | |
struct | _cpu_const_tag |
struct | _cpu_model_tag |
struct | _opcodes_tag_ |
Macros | |
#define | CPU_CONST_NONE 0 |
#define | CPU_CONST_PARAM 1 |
#define | CPU_CONST_REG 2 |
#define | CPU_MODEL_DECL(model, pc, consts) |
#define | MASK(bits) ((bits) == 32 ? 0xffffffff : (~((~((ut32)0)) << (bits)))) |
#define | CPU_PC_MASK(cpu) MASK((cpu)->pc) |
#define | CPU_PC_SIZE(cpu) ((((cpu)->pc) >> 3) + ((((cpu)->pc) & 0x07) ? 1 : 0)) |
#define | INST_HANDLER(OPCODE_NAME) static void _inst__##OPCODE_NAME(RzAnalysis *analysis, RzAnalysisOp *op, const ut8 *buf, int len, int *fail, CPU_MODEL *cpu) |
#define | INST_DECL(OP, M, SL, C, SZ, T) { #OP, (M), (SL), _inst__##OP, (C), (SZ), RZ_ANALYSIS_OP_TYPE_##T } |
#define | INST_LAST { "unknown", 0, 0, (void *)0, 2, 1, RZ_ANALYSIS_OP_TYPE_UNK } |
#define | INST_CALL(OPCODE_NAME) _inst__##OPCODE_NAME(analysis, op, buf, len, fail, cpu) |
#define | INST_INVALID |
#define | INST_ASSERT(x) |
#define | ESIL_A(e, ...) rz_strbuf_appendf(&op->esil, e, ##__VA_ARGS__) |
#define | STR_BEGINS(in, s) rz_str_ncasecmp(in, s, strlen(s)) |
Typedefs | |
typedef struct _cpu_const_tag | CPU_CONST |
typedef struct _cpu_model_tag | CPU_MODEL |
typedef void(* | inst_handler_t) (RzAnalysis *analysis, RzAnalysisOp *op, const ut8 *buf, int len, int *fail, CPU_MODEL *cpu) |
typedef struct _opcodes_tag_ | OPCODE_DESC |
Converts AVR instructions into ESIL statements
references:
Definition in file avr_esil.c.
#define CPU_CONST_NONE 0 |
Definition at line 26 of file avr_esil.c.
#define CPU_CONST_PARAM 1 |
Definition at line 27 of file avr_esil.c.
#define CPU_CONST_REG 2 |
Definition at line 28 of file avr_esil.c.
#define CPU_MODEL_DECL | ( | model, | |
pc, | |||
consts | |||
) |
Definition at line 52 of file avr_esil.c.
Definition at line 60 of file avr_esil.c.
#define ESIL_A | ( | e, | |
... | |||
) | rz_strbuf_appendf(&op->esil, e, ##__VA_ARGS__) |
Definition at line 81 of file avr_esil.c.
#define INST_ASSERT | ( | x | ) |
Definition at line 74 of file avr_esil.c.
Definition at line 68 of file avr_esil.c.
#define INST_DECL | ( | OP, | |
M, | |||
SL, | |||
C, | |||
SZ, | |||
T | |||
) | { #OP, (M), (SL), _inst__##OP, (C), (SZ), RZ_ANALYSIS_OP_TYPE_##T } |
Definition at line 63 of file avr_esil.c.
#define INST_HANDLER | ( | OPCODE_NAME | ) | static void _inst__##OPCODE_NAME(RzAnalysis *analysis, RzAnalysisOp *op, const ut8 *buf, int len, int *fail, CPU_MODEL *cpu) |
Definition at line 62 of file avr_esil.c.
#define INST_INVALID |
Definition at line 69 of file avr_esil.c.
#define INST_LAST { "unknown", 0, 0, (void *)0, 2, 1, RZ_ANALYSIS_OP_TYPE_UNK } |
Definition at line 65 of file avr_esil.c.
Definition at line 58 of file avr_esil.c.
Definition at line 83 of file avr_esil.c.
typedef struct _cpu_const_tag CPU_CONST |
typedef struct _cpu_model_tag CPU_MODEL |
typedef void(* inst_handler_t) (RzAnalysis *analysis, RzAnalysisOp *op, const ut8 *buf, int len, int *fail, CPU_MODEL *cpu) |
Definition at line 38 of file avr_esil.c.
typedef struct _opcodes_tag_ OPCODE_DESC |
|
static |
Definition at line 211 of file avr_esil.c.
References free(), rz_analysis_esil_get_parm(), rz_analysis_esil_pop(), and v.
Referenced by avr_custom_des(), avr_custom_spm_page_erase(), avr_custom_spm_page_fill(), and avr_custom_spm_page_write().
Definition at line 237 of file avr_esil.c.
References c, const_by_value(), cpu, CPU_CONST_REG, NULL, r, rz_strbuf_append(), rz_strbuf_new(), rz_strbuf_set(), rz_strbuf_setf(), and write.
Referenced by INST_HANDLER().
|
static |
|
static |
|
static |
|
static |
Definition at line 153 of file avr_esil.c.
References cpu, cpu_models, get_cpu_model(), NULL, RZ_LOG_ERROR, and rz_str_casecmp().
Referenced by get_cpu_model().
|
static |
Definition at line 1405 of file avr_esil.c.
References __esil_pop_argument(), rz_analysis_esil_t::analysis, arg(), i, NULL, rz_analysis_t::reg, reg_names, regs, rz_analysis_esil_reg_read(), rz_analysis_esil_reg_write(), rz_des_pc2(), rz_des_permute_block0(), rz_des_permute_block1(), rz_des_permute_key(), rz_des_permute_key_inv(), rz_des_round(), rz_des_shift_key(), rz_read_at_le32(), rz_write_at_le32(), ut64(), and v.
Referenced by rz_avr_esil_init().
|
static |
Definition at line 1482 of file avr_esil.c.
References __esil_pop_argument(), addr, rz_analysis_esil_t::analysis, c, const_by_name(), const_get_value(), cpu, rz_analysis_t::cpu, CPU_CONST_PARAM, CPU_PC_MASK, get_cpu_model(), i, MASK, rz_analysis_t::reg, rz_analysis_esil_mem_write(), and ut64().
Referenced by rz_avr_esil_init().
|
static |
Definition at line 1516 of file avr_esil.c.
References __esil_pop_argument(), addr, rz_analysis_esil_t::analysis, const_by_name(), const_get_value(), cpu, rz_analysis_t::cpu, CPU_CONST_PARAM, get_cpu_model(), i, MASK, r0, r1, rz_analysis_t::reg, rz_analysis_esil_mem_write(), and ut64().
Referenced by rz_avr_esil_init().
|
static |
Definition at line 1557 of file avr_esil.c.
References __esil_pop_argument(), addr, rz_analysis_esil_t::analysis, const_by_name(), const_get_value(), cpu, rz_analysis_t::cpu, CPU_CONST_PARAM, CPU_PC_MASK, get_cpu_model(), malloc(), MASK, NULL, rz_analysis_t::reg, rz_analysis_esil_mem_read(), rz_analysis_esil_mem_write(), rz_analysis_esil_reg_read(), RZ_LOG_ERROR, and ut64().
Referenced by rz_avr_esil_init().
|
static |
Definition at line 1364 of file avr_esil.c.
References cpu, _opcodes_tag_::cycles, fail, _opcodes_tag_::handler, len, _opcodes_tag_::mask, NULL, opcodes, rz_strbuf_get(), rz_strbuf_set(), and _opcodes_tag_::selector.
Referenced by rz_avr_esil_opcode().
Definition at line 194 of file avr_esil.c.
References c, cpu, CPU_CONST_NONE, _cpu_const_tag::key, NULL, RZ_LOG_ERROR, _cpu_const_tag::type, and type.
Referenced by avr_custom_spm_page_erase(), avr_custom_spm_page_fill(), and avr_custom_spm_page_write().
Definition at line 221 of file avr_esil.c.
References cpu, CPU_CONST_NONE, _cpu_const_tag::key, MASK, NULL, _cpu_const_tag::size, _cpu_const_tag::type, type, v, and _cpu_const_tag::value.
Referenced by __generic_io_dest().
Definition at line 190 of file avr_esil.c.
Referenced by avr_custom_spm_page_erase(), avr_custom_spm_page_fill(), and avr_custom_spm_page_write().
|
static |
Definition at line 1593 of file avr_esil.c.
References rz_analysis_esil_t::analysis, cpu, rz_analysis_t::cpu, CPU_PC_MASK, get_cpu_model(), MASK, and val.
Referenced by rz_avr_esil_init().
|
static |
Definition at line 176 of file avr_esil.c.
References __get_cpu_model_recursive(), cpu, cpu_models, NULL, and rz_str_casecmp().
Referenced by __get_cpu_model_recursive(), avr_custom_spm_page_erase(), avr_custom_spm_page_fill(), avr_custom_spm_page_write(), esil_avr_hook_reg_write(), and rz_avr_esil_opcode().
INST_HANDLER | ( | adc | ) |
Definition at line 300 of file avr_esil.c.
INST_HANDLER | ( | add | ) |
Definition at line 315 of file avr_esil.c.
INST_HANDLER | ( | adiw | ) |
Definition at line 330 of file avr_esil.c.
INST_HANDLER | ( | and | ) |
Definition at line 346 of file avr_esil.c.
INST_HANDLER | ( | andi | ) |
Definition at line 356 of file avr_esil.c.
INST_HANDLER | ( | asr | ) |
Definition at line 366 of file avr_esil.c.
INST_HANDLER | ( | bclr | ) |
Definition at line 379 of file avr_esil.c.
INST_HANDLER | ( | bld | ) |
Definition at line 396 of file avr_esil.c.
INST_HANDLER | ( | brbx | ) |
INST_HANDLER | ( | break | ) |
Definition at line 429 of file avr_esil.c.
References ESIL_A.
INST_HANDLER | ( | bset | ) |
INST_HANDLER | ( | bst | ) |
INST_HANDLER | ( | call | ) |
INST_HANDLER | ( | cbi | ) |
Definition at line 470 of file avr_esil.c.
References __generic_io_dest(), a, b, cpu, ESIL_A, len, rz_strbuf_free(), and rz_strbuf_get().
INST_HANDLER | ( | com | ) |
INST_HANDLER | ( | cp | ) |
Definition at line 499 of file avr_esil.c.
INST_HANDLER | ( | cpc | ) |
Definition at line 514 of file avr_esil.c.
INST_HANDLER | ( | cpi | ) |
Definition at line 530 of file avr_esil.c.
INST_HANDLER | ( | cpse | ) |
Definition at line 545 of file avr_esil.c.
INST_HANDLER | ( | dec | ) |
Definition at line 555 of file avr_esil.c.
INST_HANDLER | ( | des | ) |
Definition at line 568 of file avr_esil.c.
References ESIL_A.
INST_HANDLER | ( | eicall | ) |
Definition at line 577 of file avr_esil.c.
References __generic_push(), cpu, CPU_PC_SIZE, ESIL_A, and INST_CALL.
INST_HANDLER | ( | eijmp | ) |
Definition at line 573 of file avr_esil.c.
References ESIL_A.
INST_HANDLER | ( | elpm | ) |
Definition at line 586 of file avr_esil.c.
INST_HANDLER | ( | eor | ) |
Definition at line 602 of file avr_esil.c.
INST_HANDLER | ( | fmul | ) |
Definition at line 613 of file avr_esil.c.
INST_HANDLER | ( | fmuls | ) |
Definition at line 626 of file avr_esil.c.
INST_HANDLER | ( | fmulsu | ) |
Definition at line 642 of file avr_esil.c.
INST_HANDLER | ( | icall | ) |
Definition at line 662 of file avr_esil.c.
References __generic_push(), cpu, CPU_PC_SIZE, ESIL_A, and INST_CALL.
INST_HANDLER | ( | ijmp | ) |
INST_HANDLER | ( | in | ) |
Definition at line 671 of file avr_esil.c.
References __generic_io_dest(), a, cpu, ESIL_A, len, r, rz_strbuf_free(), and rz_strbuf_get().
INST_HANDLER | ( | inc | ) |
Definition at line 682 of file avr_esil.c.
INST_HANDLER | ( | jmp | ) |
INST_HANDLER | ( | lac | ) |
Definition at line 703 of file avr_esil.c.
References __generic_ld_st(), d, ESIL_A, and len.
INST_HANDLER | ( | las | ) |
INST_HANDLER | ( | lat | ) |
INST_HANDLER | ( | ld | ) |
INST_HANDLER | ( | ldd | ) |
INST_HANDLER | ( | ldi | ) |
INST_HANDLER | ( | lds | ) |
INST_HANDLER | ( | lpm | ) |
INST_HANDLER | ( | lsr | ) |
Definition at line 847 of file avr_esil.c.
INST_HANDLER | ( | mov | ) |
Definition at line 860 of file avr_esil.c.
INST_HANDLER | ( | movw | ) |
INST_HANDLER | ( | mul | ) |
Definition at line 878 of file avr_esil.c.
INST_HANDLER | ( | muls | ) |
Definition at line 890 of file avr_esil.c.
INST_HANDLER | ( | mulsu | ) |
Definition at line 906 of file avr_esil.c.
INST_HANDLER | ( | neg | ) |
Definition at line 921 of file avr_esil.c.
INST_HANDLER | ( | nop | ) |
INST_HANDLER | ( | or | ) |
Definition at line 940 of file avr_esil.c.
INST_HANDLER | ( | ori | ) |
Definition at line 953 of file avr_esil.c.
INST_HANDLER | ( | out | ) |
Definition at line 967 of file avr_esil.c.
References __generic_io_dest(), a, cpu, ESIL_A, len, r, rz_strbuf_free(), and rz_strbuf_get().
INST_HANDLER | ( | pop | ) |
INST_HANDLER | ( | push | ) |
INST_HANDLER | ( | rcall | ) |
INST_HANDLER | ( | ret | ) |
Definition at line 1009 of file avr_esil.c.
References __generic_pop(), cpu, CPU_PC_SIZE, and ESIL_A.
INST_HANDLER | ( | reti | ) |
Definition at line 1015 of file avr_esil.c.
INST_HANDLER | ( | rjmp | ) |
Definition at line 1025 of file avr_esil.c.
INST_HANDLER | ( | ror | ) |
Definition at line 1031 of file avr_esil.c.
INST_HANDLER | ( | sbc | ) |
Definition at line 1041 of file avr_esil.c.
INST_HANDLER | ( | sbci | ) |
Definition at line 1057 of file avr_esil.c.
INST_HANDLER | ( | sbi | ) |
Definition at line 1105 of file avr_esil.c.
References __generic_io_dest(), a, b, cpu, ESIL_A, len, rz_strbuf_free(), and rz_strbuf_get().
INST_HANDLER | ( | sbiw | ) |
Definition at line 1143 of file avr_esil.c.
INST_HANDLER | ( | sbix | ) |
Definition at line 1124 of file avr_esil.c.
References __generic_io_dest(), a, b, cpu, ESIL_A, len, PFMT64d, rz_strbuf_free(), and rz_strbuf_get().
INST_HANDLER | ( | sbrx | ) |
Definition at line 1158 of file avr_esil.c.
INST_HANDLER | ( | sleep | ) |
Definition at line 1172 of file avr_esil.c.
References ESIL_A.
INST_HANDLER | ( | spm | ) |
Definition at line 1176 of file avr_esil.c.
References ESIL_A, NULL, PFMT64x, rz_analysis_esil_reg_read(), RZ_LOG_DEBUG, and ut64().
INST_HANDLER | ( | st | ) |
INST_HANDLER | ( | std | ) |
INST_HANDLER | ( | sts | ) |
INST_HANDLER | ( | sub | ) |
Definition at line 1073 of file avr_esil.c.
INST_HANDLER | ( | subi | ) |
Definition at line 1089 of file avr_esil.c.
INST_HANDLER | ( | swap | ) |
Definition at line 1259 of file avr_esil.c.
RZ_IPI int rz_avr_esil_fini | ( | RzAnalysisEsil * | esil | ) |
Definition at line 1632 of file avr_esil.c.
RZ_IPI int rz_avr_esil_init | ( | RzAnalysisEsil * | esil | ) |
Definition at line 1619 of file avr_esil.c.
References avr_custom_des(), avr_custom_spm_page_erase(), avr_custom_spm_page_fill(), avr_custom_spm_page_write(), rz_analysis_esil_t::cb, esil_avr_hook_reg_write(), rz_analysis_esil_callbacks_t::hook_reg_write, RZ_ANALYSIS_ESIL_OP_TYPE_CUSTOM, and rz_analysis_esil_set_op().
RZ_IPI void rz_avr_esil_opcode | ( | RzAnalysis * | analysis, |
RzAnalysisOp * | op, | ||
ut64 | addr, | ||
const ut8 * | buf, | ||
int | len | ||
) |
Definition at line 1636 of file avr_esil.c.
References addr, avr_op_analyze(), cpu, rz_analysis_t::cpu, get_cpu_model(), and len.
Referenced by avr_op().
CPU_CONST cpu_memsize_common[] |
Definition at line 96 of file avr_esil.c.
CPU_CONST cpu_memsize_m640_m1280m_m1281_m2560_m2561[] |
Definition at line 104 of file avr_esil.c.
CPU_CONST cpu_memsize_xmega128a4u[] |
Definition at line 112 of file avr_esil.c.
CPU_MODEL cpu_models[] |
Definition at line 130 of file avr_esil.c.
Referenced by __get_cpu_model_recursive(), and get_cpu_model().
CPU_CONST cpu_pagesize_5_bits[] |
Definition at line 120 of file avr_esil.c.
CPU_CONST cpu_pagesize_7_bits[] |
Definition at line 125 of file avr_esil.c.
CPU_CONST cpu_reg_common[] |
Definition at line 88 of file avr_esil.c.
OPCODE_DESC opcodes[] |
Definition at line 1270 of file avr_esil.c.
Referenced by avr_op_analyze(), diff_unified_append_ranges(), diff_unified_json_ranges(), free_opcode(), get_relocs(), reconstruct_chained_fixup(), rz_diff_opcodes_grouped_new(), rz_diff_opcodes_new(), rz_diff_unified_json(), and rz_diff_unified_text().