15 #define emit(frag) rz_strbuf_appendf(&op->esil, frag)
16 #define emitf(...) rz_strbuf_appendf(&op->esil, __VA_ARGS__)
18 #define setZ rz_strbuf_appendf(&op->esil, ",$z,Z,:=")
19 #define setN rz_strbuf_appendf(&op->esil, ",15,$s,N,=")
20 #define setV(val) rz_strbuf_appendf(&op->esil, ",%s,V,=", val)
21 #define setC_B rz_strbuf_appendf(&op->esil, ",7,$c,C,:=")
22 #define setC_W rz_strbuf_appendf(&op->esil, ",15,$c,C,:=")
23 #define setCb_B rz_strbuf_appendf(&op->esil, ",7,$b,C,:=")
24 #define setCb_W rz_strbuf_appendf(&op->esil, ",15,$b,C,:=")
25 #define setH_B rz_strbuf_appendf(&op->esil, ",3,$c,H,:=")
26 #define setH_W rz_strbuf_appendf(&op->esil, ",11,$c,H,:=")
27 #define setHb_B rz_strbuf_appendf(&op->esil, ",3,$b,H,:=")
28 #define setHb_W rz_strbuf_appendf(&op->esil, ",11,$b,H,:=")
31 #define rs() (buf[1] & 0x70) >> 4
32 #define rsB() (buf[1] & 0x70) >> 4, buf[1] & 0x80 ? 'l' : 'h'
33 #define rd() buf[1] & 0x07
35 #define rdB(a) buf[a] & 0x07, buf[a] & 0x8 ? 'l' : 'h'
39 #define mask() rz_strbuf_appendf(&op->esil, ",0xffff,r%u,&=", rd());
40 #define maskB(a) rz_strbuf_appendf(&op->esil, ",0xff,r%u%c,&=", rdB(a));
97 switch (opcode >> 4) {
225 ((
buf[1] & 0xf0) == 0x80) ? 2 : 1,
rd());
289 if ((
buf[1] & 0xf0) == 0x80) {
298 }
else if ((
buf[1] & 0xf0) == 0x00) {
336 ((
buf[1] & 0xf0) == 0x80) ? 2 : 1,
rd());
415 rz_strbuf_appendf(&
op->esil,
"Z,N,V,^,|,!,?{0x%02x,pc,+=}",
buf[1]);
447 rz_strbuf_appendf(&
op->esil,
"0x7,r%u%c,&,1,<<,!,r%u%c,&=",
rsB(),
rdB(1));
451 rz_strbuf_appendf(&
op->esil,
"0x7,r%u%c,&,0x7,r%u%c,&,1,<<,r%u%c,&,>>,!,Z,=",
455 if (!(
buf[1] & 0x80)) {
484 rz_strbuf_appendf(&
op->esil,
"%d,%d,1,<<,r%u%c,&,>>,!,Z,=",
488 if (!(
buf[1] & 0x80)) {
490 rz_strbuf_appendf(&
op->esil,
"%d,%d,1,<<,r%u%c,&,>>,C,|=",
494 rz_strbuf_appendf(&
op->esil,
"%d,%d,1,<<,r%u%c,&,>>,!,C,|=",
499 if (!(
buf[1] & 0x80)) {
501 rz_strbuf_appendf(&
op->esil,
"%d,%d,1,<<,r%u%c,&,>>,C,^=",
504 rz_strbuf_appendf(&
op->esil,
"%d,%d,1,<<,r%u%c,&,>>,!,C,^=",
511 if (!(
buf[1] & 0x80)) {
512 rz_strbuf_appendf(&
op->esil,
"%d,%d,1,<<,r%u%c,&,>>,C,&=",
515 rz_strbuf_appendf(&
op->esil,
"%d,%d,1,<<,r%u%c,&,>>,!,C,&=",
521 if (!(
buf[1] & 0x80)) {
522 rz_strbuf_appendf(&
op->esil,
"%d,%d,1,<<,r%u%c,&,>>,C,=",
525 rz_strbuf_appendf(&
op->esil,
"%d,%d,1,<<,r%u%c,&,>>,!,C,=",
558 switch (opcode >> 4) {
728 .desc =
"H8300 code analysis plugin",
737 #ifndef RZ_PLUGIN_INCORE
static char * get_reg_profile(RzAnalysis *analysis)
RzAnalysisPlugin rz_analysis_plugin_h8300
static void h8300_analysis_jmp(RzAnalysisOp *op, ut64 addr, const ut8 *buf)
static int h8300_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8 *buf, int len, RzAnalysisOpMask mask)
static void h8300_analysis_jsr(RzAnalysisOp *op, ut64 addr, const ut8 *buf)
struct rz_lib_struct_t rizin_plugin
static int analop_esil(RzAnalysis *a, RzAnalysisOp *op, ut64 addr, const ut8 *buf)
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags cmd
int h8300_decode_command(const ut8 *instr, struct h8300_cmd *cmd)
return strdup("=SP r13\n" "=LR r14\n" "=PC r15\n" "=A0 r0\n" "=A1 r1\n" "=A2 r2\n" "=A3 r3\n" "=ZF zf\n" "=SF nf\n" "=OF vf\n" "=CF cf\n" "=SN or0\n" "gpr lr .32 56 0\n" "gpr pc .32 60 0\n" "gpr cpsr .32 64 0 ____tfiae_________________qvczn\n" "gpr or0 .32 68 0\n" "gpr tf .1 64.5 0 thumb\n" "gpr ef .1 64.9 0 endian\n" "gpr jf .1 64.24 0 java\n" "gpr qf .1 64.27 0 sticky_overflow\n" "gpr vf .1 64.28 0 overflow\n" "gpr cf .1 64.29 0 carry\n" "gpr zf .1 64.30 0 zero\n" "gpr nf .1 64.31 0 negative\n" "gpr itc .4 64.10 0 if_then_count\n" "gpr gef .4 64.16 0 great_or_equal\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr r16 .32 64 0\n" "gpr r17 .32 68 0\n")
@ RZ_ANALYSIS_OP_MASK_ESIL
@ RZ_ANALYSIS_OP_TYPE_CMP
@ RZ_ANALYSIS_OP_TYPE_SUB
@ RZ_ANALYSIS_OP_TYPE_UNK
@ RZ_ANALYSIS_OP_TYPE_MUL
@ RZ_ANALYSIS_OP_TYPE_JMP
@ RZ_ANALYSIS_OP_TYPE_AND
@ RZ_ANALYSIS_OP_TYPE_UJMP
@ RZ_ANALYSIS_OP_TYPE_CALL
@ RZ_ANALYSIS_OP_TYPE_ADD
@ RZ_ANALYSIS_OP_TYPE_SHR
@ RZ_ANALYSIS_OP_TYPE_CJMP
@ RZ_ANALYSIS_OP_TYPE_MOV
@ RZ_ANALYSIS_OP_TYPE_SHL
@ RZ_ANALYSIS_OP_TYPE_UCALL
@ RZ_ANALYSIS_OP_TYPE_RET
@ RZ_ANALYSIS_OP_TYPE_NOP
@ RZ_ANALYSIS_OP_TYPE_XOR
RZ_API void rz_mem_swapendian(ut8 *dest, const ut8 *orig, int size)
RZ_API const char * rz_strbuf_set(RzStrBuf *sb, const char *s)
RZ_API bool rz_strbuf_appendf(RzStrBuf *sb, const char *fmt,...) RZ_PRINTF_CHECK(2
RZ_API void rz_strbuf_init(RzStrBuf *sb)
ut64(WINAPI *w32_GetEnabledXStateFeatures)()