13 #include "../../bin/format/wasm/wasm.h"
14 #include "../../asm/arch/wasm/wasm.c"
16 #define WASM_STACK_SIZE 256
59 op->type = expected_type;
60 op->jump = address + 1;
66 op->type = expected_type;
97 if (!wop.
txt || !strncmp(wop.
txt,
"invalid", 7)) {
158 if (hint->
opcode && !strncmp(
"loop", hint->
opcode, 4)) {
169 RZ_LOG_ERROR(
"wasm: cannot find jump type for br (using block type)\n");
186 if (hint->
opcode && !strncmp(
"loop", hint->
opcode, 4)) {
198 RZ_LOG_ERROR(
"wasm: cannot find jump type for br_if (using block type)\n");
211 if (hint && !strncmp(
"loop", hint->
opcode, 4)) {
214 }
else if (hint && !strncmp(
"block", hint->
opcode, 5)) {
341 rz_strbuf_setf(&
op->esil,
"4,sp,-=,0x%" PFMT64x ",sp,=[4],0x%" PFMT64x ",pc,=",
op->fail,
op->jump);
456 .desc =
"WebAssembly analysis plugin",
466 #ifndef RZ_PLUGIN_INCORE
static char * get_reg_profile(RzAnalysis *analysis)
static int archinfo(RzAnalysis *a, int q)
static int wasm_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8 *data, int len, RzAnalysisOpMask mask)
RZ_API RzLibStruct rizin_plugin
RzAnalysisPlugin rz_analysis_plugin_wasm
static ut64 get_cf_offset(RzAnalysis *analysis, const ut8 *data, int len)
static bool advance_till_scope_end(RzAnalysis *analysis, RzAnalysisOp *op, ut64 address, ut32 expected_type, ut32 depth, bool use_else)
RZ_IPI int wasm_dis(WasmOp *op, const unsigned char *buf, int buf_len)
@ WASM_OP_I32ATOMICRMWSUB
@ WASM_OP_I32ATOMICRMW16UOR
@ WASM_OP_I64ATOMICLOAD16U
@ WASM_OP_I32ATOMICRMW16USUB
@ WASM_OP_I64ATOMICLOAD32U
@ WASM_OP_I32ATOMICRMW8UAND
@ WASM_OP_I64ATOMICLOAD8U
@ WASM_OP_I32ATOMICRMW8UXOR
@ WASM_OP_I64ATOMICRMW32UOR
@ WASM_OP_I32ATOMICRMW8UOR
@ WASM_OP_I64ATOMICRMW8UAND
@ WASM_OP_I64ATOMICRMW8UOR
@ WASM_OP_I64ATOMICRMW16UADD
@ WASM_OP_I64ATOMICRMW32UADD
@ WASM_OP_I32ATOMICSTORE16
@ WASM_OP_I32ATOMICRMW8UADD
@ WASM_OP_I64ATOMICSTORE32
@ WASM_OP_I64ATOMICRMW8UXCHG
@ WASM_OP_I32ATOMICRMW8USUB
@ WASM_OP_I32ATOMICRMWXOR
@ WASM_OP_I32ATOMICRMW16UADD
@ WASM_OP_I64ATOMICSTORE8
@ WASM_OP_I64ATOMICRMW32UXOR
@ WASM_OP_I32ATOMICLOAD16U
@ WASM_OP_I64ATOMICRMWXCHG
@ WASM_OP_I32ATOMICLOAD8U
@ WASM_OP_I64ATOMICRMW16UAND
@ WASM_OP_I64ATOMICRMW32UAND
@ WASM_OP_I64ATOMICRMW16UXOR
@ WASM_OP_I32ATOMICRMWXCHG
@ WASM_OP_I64ATOMICRMWAND
@ WASM_OP_I32ATOMICSTORE8
@ WASM_OP_I64ATOMICSTORE16
@ WASM_OP_I32ATOMICRMW16UAND
@ WASM_OP_I64ATOMICRMW8UADD
@ WASM_OP_I32ATOMICRMWAND
@ WASM_OP_I32ATOMICRMW16UXCHG
@ WASM_OP_I64ATOMICRMW16UOR
@ WASM_OP_I64ATOMICRMW16UXCHG
@ WASM_OP_I32ATOMICRMW8UXCHG
@ WASM_OP_I64ATOMICRMW32USUB
@ WASM_OP_I64ATOMICRMW32UXCHG
@ WASM_OP_I64ATOMICRMW8USUB
@ WASM_OP_I32ATOMICRMW16UXOR
@ WASM_OP_I64ATOMICRMW8UXOR
@ WASM_OP_I32ATOMICRMWADD
@ WASM_OP_I64ATOMICRMWSUB
@ WASM_OP_I64ATOMICRMWADD
@ WASM_OP_I64ATOMICRMWXOR
@ WASM_OP_I64ATOMICRMW16USUB
RZ_API void rz_cons_pop(void)
RZ_API void rz_cons_push(void)
RZ_API RzAnalysisHint * rz_analysis_hint_get(RzAnalysis *a, ut64 addr)
RZ_API void rz_analysis_hint_set_jump(RzAnalysis *a, ut64 addr, ut64 jump)
RZ_API void rz_analysis_hint_set_opcode(RzAnalysis *a, ut64 addr, const char *opcode)
RZ_API void rz_analysis_hint_free(RzAnalysisHint *h)
RZ_API void rz_analysis_hint_del(RzAnalysis *a, ut64 addr, ut64 size)
RZ_API void Ht_() free(HtName_(Ht) *ht)
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_TYPE_CMP
@ RZ_ANALYSIS_OP_TYPE_SUB
@ RZ_ANALYSIS_OP_TYPE_LOAD
@ RZ_ANALYSIS_OP_TYPE_UNK
@ RZ_ANALYSIS_OP_TYPE_JMP
@ RZ_ANALYSIS_OP_TYPE_AND
@ RZ_ANALYSIS_OP_TYPE_MOD
@ RZ_ANALYSIS_OP_TYPE_XCHG
@ RZ_ANALYSIS_OP_TYPE_CALL
@ RZ_ANALYSIS_OP_TYPE_ADD
@ RZ_ANALYSIS_OP_TYPE_STORE
@ RZ_ANALYSIS_OP_TYPE_CRET
@ RZ_ANALYSIS_OP_TYPE_CJMP
@ RZ_ANALYSIS_OP_TYPE_MOV
@ RZ_ANALYSIS_OP_TYPE_ILL
@ RZ_ANALYSIS_OP_TYPE_RET
@ RZ_ANALYSIS_OP_TYPE_NOP
@ RZ_ANALYSIS_OP_TYPE_XOR
#define RZ_LOG_ERROR(fmtstr,...)
RZ_API ut64 rz_num_get(RzNum *num, const char *str)
RZ_API const char * rz_strbuf_setf(RzStrBuf *sb, const char *fmt,...) RZ_PRINTF_CHECK(2
RZ_API size_t read_u32_leb128(const ut8 *p, const ut8 *max, ut32 *out_val)
ut64(WINAPI *w32_GetEnabledXStateFeatures)()