Rizin
unix-like reverse engineering framework and cli tools
analysis_wasm.c
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2017-2021 xvilka <anton.kochkov@gmail.com>
2 // SPDX-FileCopyrightText: 2017-2021 deroad <wargio@libero.it>
3 // SPDX-License-Identifier: LGPL-3.0-only
4 
5 #include <string.h>
6 #include <rz_types.h>
7 #include <rz_lib.h>
8 #include <rz_asm.h>
9 #include <rz_analysis.h>
10 #undef RZ_IPI
11 #define RZ_IPI static
12 #define WASM_NO_ASM // to get rid of a warning
13 #include "../../bin/format/wasm/wasm.h"
14 #include "../../asm/arch/wasm/wasm.c"
15 
16 #define WASM_STACK_SIZE 256
17 
20 
21 // finds the address of the call function (essentially where to jump to).
22 static ut64 get_cf_offset(RzAnalysis *analysis, const ut8 *data, int len) {
23  ut32 fcn_id;
24 
25  if (!read_u32_leb128(&data[1], &data[len - 1], &fcn_id)) {
26  return UT64_MAX;
27  }
28  rz_cons_push();
29  // 0xfff.. are bad addresses for wasm
30  // cgvwzq: 0xfff... can be external imported JS funcs
31  char *s = analysis->coreb.cmdstrf(analysis->coreb.core, "is~FUNC[2:%u]", fcn_id);
32  rz_cons_pop();
33  if (s) {
34  ut64 n = rz_num_get(NULL, s);
35  free(s);
36  return n;
37  }
38  return UT64_MAX;
39 }
40 
41 static bool advance_till_scope_end(RzAnalysis *analysis, RzAnalysisOp *op, ut64 address, ut32 expected_type, ut32 depth, bool use_else) {
42  ut8 buffer[16];
43  ut8 *ptr = buffer;
44  ut8 *end = ptr + sizeof(buffer);
45  WasmOp wop = { { 0 } };
46  int size = 0;
47  while (analysis->iob.read_at(analysis->iob.io, address, buffer, sizeof(buffer))) {
48  size = wasm_dis(&wop, ptr, end - ptr);
49  if (!wop.txt || (wop.type == WASM_TYPE_OP_CORE && wop.op.core == WASM_OP_TRAP)) {
50  // if invalid stop here.
51  break;
52  }
53  if (wop.type == WASM_TYPE_OP_CORE) {
54  WasmOpCodes wopop = wop.op.core;
55  if (wopop == WASM_OP_LOOP || wopop == WASM_OP_BLOCK || wopop == WASM_OP_IF) {
56  depth++;
57  }
58  if (use_else && wopop == WASM_OP_ELSE && !depth) {
59  op->type = expected_type;
60  op->jump = address + 1; // else size == 1
61  return true;
62  } else if (wopop == WASM_OP_END && depth > 0) {
63  // let's wait till i get the final depth
64  depth--;
65  } else if (wopop == WASM_OP_END && !depth) {
66  op->type = expected_type;
67  op->jump = address;
68  return true;
69  }
70  }
71  address += size;
72  }
73  return false;
74 }
75 
76 // analyzes the wasm opcode.
77 static int wasm_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8 *data, int len, RzAnalysisOpMask mask) {
78  WasmOp wop = { { 0 } };
79  RzAnalysisHint *hint = NULL;
80  int ret = wasm_dis(&wop, data, len);
81  op->size = ret;
82  op->addr = addr;
83  op->sign = true;
85  switch (wop.type) {
86  case WASM_TYPE_OP_CORE:
87  op->id = wop.op.core;
88  break;
90  op->id = (0xfe << 8) | wop.op.atomic;
91  break;
92  case WASM_TYPE_OP_SIMD:
93  op->id = 0xfd;
94  break;
95  }
96 
97  if (!wop.txt || !strncmp(wop.txt, "invalid", 7)) {
99  free(wop.txt);
100  return -1;
101  }
102 
103  if (addr_old == addr && (wop.type != WASM_TYPE_OP_CORE || wop.op.core != WASM_OP_END)) {
104  goto analysis_end;
105  }
106 
107  switch (wop.type) {
108  case WASM_TYPE_OP_CORE:
109  switch (wop.op.core) {
110  /* Calls here are using index instead of address */
111  case WASM_OP_LOOP:
112  op->type = RZ_ANALYSIS_OP_TYPE_NOP;
113  if (!(hint = rz_analysis_hint_get(analysis, addr))) {
114  scope_hint--;
115  rz_analysis_hint_set_opcode(analysis, scope_hint, "loop");
117  }
118  break;
119  case WASM_OP_BLOCK:
120  op->type = RZ_ANALYSIS_OP_TYPE_NOP;
121  if (!(hint = rz_analysis_hint_get(analysis, addr))) {
122  scope_hint--;
123  rz_analysis_hint_set_opcode(analysis, scope_hint, "block");
125  }
126  break;
127  case WASM_OP_IF:
128  if (!(hint = rz_analysis_hint_get(analysis, addr))) {
129  scope_hint--;
130  rz_analysis_hint_set_opcode(analysis, scope_hint, "if");
132  if (advance_till_scope_end(analysis, op, addr + op->size, RZ_ANALYSIS_OP_TYPE_CJMP, 0, true)) {
133  op->fail = addr + op->size;
134  }
135  } else {
137  op->jump = hint->jump;
138  op->fail = addr + op->size;
139  }
140  break;
141  case WASM_OP_ELSE:
142  // get if and set hint.
143  if (!(hint = rz_analysis_hint_get(analysis, addr))) {
144  advance_till_scope_end(analysis, op, addr + op->size, RZ_ANALYSIS_OP_TYPE_JMP, 0, true);
145  } else {
146  op->type = RZ_ANALYSIS_OP_TYPE_JMP;
147  op->jump = hint->jump;
148  }
149  break;
150  case WASM_OP_BR: {
151  RzAnalysisHint *hint2 = NULL;
152  ut32 val;
153  read_u32_leb128(data + 1, data + len, &val);
154  if ((hint2 = rz_analysis_hint_get(analysis, addr)) && hint2->jump != UT64_MAX) {
155  op->type = RZ_ANALYSIS_OP_TYPE_JMP;
156  op->jump = hint2->jump;
157  } else if ((hint = rz_analysis_hint_get(analysis, scope_hint))) {
158  if (hint->opcode && !strncmp("loop", hint->opcode, 4)) {
159  op->type = RZ_ANALYSIS_OP_TYPE_JMP;
160  op->jump = hint->jump;
161  rz_analysis_hint_set_jump(analysis, addr, op->jump);
162  } else {
163  if (advance_till_scope_end(analysis, op, addr + op->size, RZ_ANALYSIS_OP_TYPE_JMP, val, false)) {
164  rz_analysis_hint_set_jump(analysis, addr, op->jump);
165  }
166  }
167  } else {
168  if (advance_till_scope_end(analysis, op, addr + op->size, RZ_ANALYSIS_OP_TYPE_JMP, val, false)) {
169  RZ_LOG_ERROR("wasm: cannot find jump type for br (using block type)\n");
170  rz_analysis_hint_set_jump(analysis, addr, op->jump);
171  } else {
172  RZ_LOG_ERROR("wasm: cannot find jump for br\n");
173  }
174  }
175  rz_analysis_hint_free(hint2);
176  } break;
177  case WASM_OP_BRIF: {
178  RzAnalysisHint *hint2 = NULL;
179  ut32 val;
180  read_u32_leb128(data + 1, data + len, &val);
181  if ((hint2 = rz_analysis_hint_get(analysis, addr)) && hint2->jump != UT64_MAX) {
183  op->jump = hint2->jump;
184  op->fail = addr + op->size;
185  } else if ((hint = rz_analysis_hint_get(analysis, scope_hint))) {
186  if (hint->opcode && !strncmp("loop", hint->opcode, 4)) {
187  op->fail = addr + op->size;
188  op->jump = hint->jump;
189  rz_analysis_hint_set_jump(analysis, addr, op->jump);
190  } else {
191  if (advance_till_scope_end(analysis, op, addr + op->size, RZ_ANALYSIS_OP_TYPE_CJMP, val, false)) {
192  op->fail = addr + op->size;
193  rz_analysis_hint_set_jump(analysis, addr, op->jump);
194  }
195  }
196  } else {
197  if (advance_till_scope_end(analysis, op, addr + op->size, RZ_ANALYSIS_OP_TYPE_CJMP, val, false)) {
198  RZ_LOG_ERROR("wasm: cannot find jump type for br_if (using block type)\n");
199  op->fail = addr + op->size;
200  rz_analysis_hint_set_jump(analysis, addr, op->jump);
201  } else {
202  RZ_LOG_ERROR("wasm: cannot find jump for br_if\n");
203  }
204  }
205  rz_analysis_hint_free(hint2);
206  } break;
207  case WASM_OP_END: {
208  op->type = RZ_ANALYSIS_OP_TYPE_NOP;
209  if (scope_hint < UT64_MAX) {
210  hint = rz_analysis_hint_get(analysis, scope_hint);
211  if (hint && !strncmp("loop", hint->opcode, 4)) {
212  rz_analysis_hint_set_jump(analysis, addr, op->jump);
213  rz_analysis_hint_set_jump(analysis, op->jump, addr);
214  } else if (hint && !strncmp("block", hint->opcode, 5)) {
215  // if/else/block
216  rz_analysis_hint_set_jump(analysis, hint->jump, addr);
218  }
219  if (hint) {
220  rz_analysis_hint_set_opcode(analysis, scope_hint, "invalid");
222  rz_analysis_hint_del(analysis, scope_hint, 1);
223  scope_hint++;
224  } else {
225  // all wasm routines ends with an end.
226  op->eob = true;
227  op->type = RZ_ANALYSIS_OP_TYPE_RET;
229  }
230  } else {
231  if (!(hint = rz_analysis_hint_get(analysis, addr))) {
232  // all wasm routines ends with an end.
233  op->eob = true;
234  op->type = RZ_ANALYSIS_OP_TYPE_RET;
235  }
236  }
237  } break;
238  case WASM_OP_I32REMS:
239  case WASM_OP_I32REMU:
240  op->type = RZ_ANALYSIS_OP_TYPE_MOD;
241  break;
242  case WASM_OP_GETLOCAL:
243  case WASM_OP_I32LOAD:
244  case WASM_OP_I64LOAD:
245  case WASM_OP_F32LOAD:
246  case WASM_OP_F64LOAD:
247  case WASM_OP_I32LOAD8S:
248  case WASM_OP_I32LOAD8U:
249  case WASM_OP_I32LOAD16S:
250  case WASM_OP_I32LOAD16U:
251  case WASM_OP_I64LOAD8S:
252  case WASM_OP_I64LOAD8U:
253  case WASM_OP_I64LOAD16S:
254  case WASM_OP_I64LOAD16U:
255  case WASM_OP_I64LOAD32S:
256  case WASM_OP_I64LOAD32U:
258  break;
259  case WASM_OP_SETLOCAL:
260  case WASM_OP_TEELOCAL:
262  break;
263  case WASM_OP_I32EQZ:
264  case WASM_OP_I32EQ:
265  case WASM_OP_I32NE:
266  case WASM_OP_I32LTS:
267  case WASM_OP_I32LTU:
268  case WASM_OP_I32GTS:
269  case WASM_OP_I32GTU:
270  case WASM_OP_I32LES:
271  case WASM_OP_I32LEU:
272  case WASM_OP_I32GES:
273  case WASM_OP_I32GEU:
274  case WASM_OP_I64EQZ:
275  case WASM_OP_I64EQ:
276  case WASM_OP_I64NE:
277  case WASM_OP_I64LTS:
278  case WASM_OP_I64LTU:
279  case WASM_OP_I64GTS:
280  case WASM_OP_I64GTU:
281  case WASM_OP_I64LES:
282  case WASM_OP_I64LEU:
283  case WASM_OP_I64GES:
284  case WASM_OP_I64GEU:
285  case WASM_OP_F32EQ:
286  case WASM_OP_F32NE:
287  case WASM_OP_F32LT:
288  case WASM_OP_F32GT:
289  case WASM_OP_F32LE:
290  case WASM_OP_F32GE:
291  case WASM_OP_F64EQ:
292  case WASM_OP_F64NE:
293  case WASM_OP_F64LT:
294  case WASM_OP_F64GT:
295  case WASM_OP_F64LE:
296  case WASM_OP_F64GE:
297  op->type = RZ_ANALYSIS_OP_TYPE_CMP;
298  break;
299  case WASM_OP_I64OR:
300  case WASM_OP_I32OR:
301  op->type = RZ_ANALYSIS_OP_TYPE_OR;
302  break;
303  case WASM_OP_I64XOR:
304  case WASM_OP_I32XOR:
305  op->type = RZ_ANALYSIS_OP_TYPE_XOR;
306  break;
307  case WASM_OP_I32CONST:
308  case WASM_OP_I64CONST:
309  case WASM_OP_F32CONST:
310  case WASM_OP_F64CONST:
311  op->type = RZ_ANALYSIS_OP_TYPE_MOV;
312  {
313  ut8 arg = data[1];
314  rz_strbuf_setf(&op->esil, "4,sp,-=,%d,sp,=[4]", arg);
315  }
316  break;
317  case WASM_OP_I64ADD:
318  case WASM_OP_I32ADD:
319  case WASM_OP_F32ADD:
320  case WASM_OP_F64ADD:
321  op->type = RZ_ANALYSIS_OP_TYPE_ADD;
322  break;
323  case WASM_OP_I64SUB:
324  case WASM_OP_I32SUB:
325  case WASM_OP_F32SUB:
326  case WASM_OP_F64SUB:
327  op->type = RZ_ANALYSIS_OP_TYPE_SUB;
328  break;
329  case WASM_OP_NOP:
330  op->type = RZ_ANALYSIS_OP_TYPE_NOP;
331  rz_strbuf_setf(&op->esil, "%s", "");
332  break;
333  case WASM_OP_CALL:
336  op->jump = get_cf_offset(analysis, data, len);
337  op->fail = addr + op->size;
338  if (op->jump != UT64_MAX) {
339  op->ptr = op->jump;
340  }
341  rz_strbuf_setf(&op->esil, "4,sp,-=,0x%" PFMT64x ",sp,=[4],0x%" PFMT64x ",pc,=", op->fail, op->jump);
342  break;
343  case WASM_OP_RETURN:
344  // should be ret, but if there the analisys is stopped.
346  default:
347  break;
348  }
349  break;
350  case WASM_TYPE_OP_ATOMIC:
351  switch (wop.op.atomic) {
360  break;
369  break;
377  op->type = RZ_ANALYSIS_OP_TYPE_ADD;
378  break;
386  op->type = RZ_ANALYSIS_OP_TYPE_SUB;
387  break;
395  op->type = RZ_ANALYSIS_OP_TYPE_AND;
396  break;
404  op->type = RZ_ANALYSIS_OP_TYPE_OR;
405  break;
413  op->type = RZ_ANALYSIS_OP_TYPE_XOR;
414  break;
423  break;
424  default:
425  break;
426  }
427  default:
428  break;
429  }
430 
431 analysis_end:
432  addr_old = addr;
433  free(wop.txt);
434  rz_analysis_hint_free(hint);
435  return op->size;
436 }
437 
438 static int archinfo(RzAnalysis *a, int q) {
439  return 1;
440 }
441 
442 static char *get_reg_profile(RzAnalysis *analysis) {
443  return strdup(
444  "=PC pc\n"
445  "=BP bp\n"
446  "=SP sp\n"
447  "=A0 r0\n"
448  "gpr sp .32 0 0\n" // stack pointer
449  "gpr pc .32 4 0\n" // program counter
450  "gpr bp .32 8 0\n" // base pointer // unused
451  );
452 }
453 
455  .name = "wasm",
456  .desc = "WebAssembly analysis plugin",
457  .license = "LGPL3",
458  .arch = "wasm",
459  .bits = 64,
460  .archinfo = archinfo,
461  .get_reg_profile = get_reg_profile,
462  .op = &wasm_op,
463  .esil = true
464 };
465 
466 #ifndef RZ_PLUGIN_INCORE
469  .data = &rz_analysis_plugin_wasm,
471 };
472 #endif
size_t len
Definition: 6502dis.c:15
#define mask()
static char * get_reg_profile(RzAnalysis *analysis)
static int archinfo(RzAnalysis *a, int q)
static ut64 addr_old
Definition: analysis_wasm.c:19
static int wasm_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8 *data, int len, RzAnalysisOpMask mask)
Definition: analysis_wasm.c:77
RZ_API RzLibStruct rizin_plugin
static ut64 scope_hint
Definition: analysis_wasm.c:18
RzAnalysisPlugin rz_analysis_plugin_wasm
static ut64 get_cf_offset(RzAnalysis *analysis, const ut8 *data, int len)
Definition: analysis_wasm.c:22
static bool advance_till_scope_end(RzAnalysis *analysis, RzAnalysisOp *op, ut64 address, ut32 expected_type, ut32 depth, bool use_else)
Definition: analysis_wasm.c:41
ut16 val
Definition: armass64_const.h:6
RZ_IPI int wasm_dis(WasmOp *op, const unsigned char *buf, int buf_len)
Definition: wasm.c:479
WasmOpCodes
Definition: wasm.h:11
@ WASM_OP_CALL
Definition: wasm.h:27
@ WASM_OP_F32LOAD
Definition: wasm.h:44
@ WASM_OP_I64LES
Definition: wasm.h:93
@ WASM_OP_LOOP
Definition: wasm.h:17
@ WASM_OP_I32REMU
Definition: wasm.h:120
@ WASM_OP_I64EQ
Definition: wasm.h:87
@ WASM_OP_F32SUB
Definition: wasm.h:155
@ WASM_OP_I64LOAD
Definition: wasm.h:43
@ WASM_OP_I32LOAD16S
Definition: wasm.h:48
@ WASM_OP_I64GTU
Definition: wasm.h:92
@ WASM_OP_I64LTS
Definition: wasm.h:89
@ WASM_OP_I64LOAD8S
Definition: wasm.h:50
@ WASM_OP_I32GTS
Definition: wasm.h:80
@ WASM_OP_F32EQ
Definition: wasm.h:97
@ WASM_OP_I64LOAD32U
Definition: wasm.h:55
@ WASM_OP_BLOCK
Definition: wasm.h:16
@ WASM_OP_TRAP
Definition: wasm.h:14
@ WASM_OP_F64LOAD
Definition: wasm.h:45
@ WASM_OP_F64GT
Definition: wasm.h:106
@ WASM_OP_I32SUB
Definition: wasm.h:115
@ WASM_OP_BRIF
Definition: wasm.h:22
@ WASM_OP_I32LTS
Definition: wasm.h:78
@ WASM_OP_F32ADD
Definition: wasm.h:154
@ WASM_OP_I32LOAD16U
Definition: wasm.h:49
@ WASM_OP_F64SUB
Definition: wasm.h:169
@ WASM_OP_I32EQ
Definition: wasm.h:76
@ WASM_OP_I32CONST
Definition: wasm.h:69
@ WASM_OP_I32GES
Definition: wasm.h:84
@ WASM_OP_ELSE
Definition: wasm.h:19
@ WASM_OP_I32GTU
Definition: wasm.h:81
@ WASM_OP_I64LOAD16U
Definition: wasm.h:53
@ WASM_OP_I32LOAD8S
Definition: wasm.h:46
@ WASM_OP_I32EQZ
Definition: wasm.h:75
@ WASM_OP_END
Definition: wasm.h:20
@ WASM_OP_I64SUB
Definition: wasm.h:133
@ WASM_OP_I32LOAD8U
Definition: wasm.h:47
@ WASM_OP_GETLOCAL
Definition: wasm.h:35
@ WASM_OP_I64CONST
Definition: wasm.h:70
@ WASM_OP_CALLINDIRECT
Definition: wasm.h:28
@ WASM_OP_I64LOAD32S
Definition: wasm.h:54
@ WASM_OP_I32NE
Definition: wasm.h:77
@ WASM_OP_I32LEU
Definition: wasm.h:83
@ WASM_OP_F32LE
Definition: wasm.h:101
@ WASM_OP_F32GT
Definition: wasm.h:100
@ WASM_OP_I64NE
Definition: wasm.h:88
@ WASM_OP_I64GES
Definition: wasm.h:95
@ WASM_OP_I32LOAD
Definition: wasm.h:42
@ WASM_OP_NOP
Definition: wasm.h:15
@ WASM_OP_F64CONST
Definition: wasm.h:72
@ WASM_OP_F64LE
Definition: wasm.h:107
@ WASM_OP_I64GEU
Definition: wasm.h:96
@ WASM_OP_I32OR
Definition: wasm.h:122
@ WASM_OP_I32ADD
Definition: wasm.h:114
@ WASM_OP_F32CONST
Definition: wasm.h:71
@ WASM_OP_F32GE
Definition: wasm.h:102
@ WASM_OP_F64NE
Definition: wasm.h:104
@ WASM_OP_I32REMS
Definition: wasm.h:119
@ WASM_OP_F64EQ
Definition: wasm.h:103
@ WASM_OP_I32XOR
Definition: wasm.h:123
@ WASM_OP_SETLOCAL
Definition: wasm.h:36
@ WASM_OP_F64ADD
Definition: wasm.h:168
@ WASM_OP_F64LT
Definition: wasm.h:105
@ WASM_OP_BR
Definition: wasm.h:21
@ WASM_OP_F32LT
Definition: wasm.h:99
@ WASM_OP_I64ADD
Definition: wasm.h:132
@ WASM_OP_I64LEU
Definition: wasm.h:94
@ WASM_OP_I32LTU
Definition: wasm.h:79
@ WASM_OP_F32NE
Definition: wasm.h:98
@ WASM_OP_I64GTS
Definition: wasm.h:91
@ WASM_OP_I32LES
Definition: wasm.h:82
@ WASM_OP_F64GE
Definition: wasm.h:108
@ WASM_OP_I32GEU
Definition: wasm.h:85
@ WASM_OP_I64LOAD16S
Definition: wasm.h:52
@ WASM_OP_I64OR
Definition: wasm.h:140
@ WASM_OP_I64LTU
Definition: wasm.h:90
@ WASM_OP_I64XOR
Definition: wasm.h:141
@ WASM_OP_TEELOCAL
Definition: wasm.h:37
@ WASM_OP_I64EQZ
Definition: wasm.h:86
@ WASM_OP_I64LOAD8U
Definition: wasm.h:51
@ WASM_OP_IF
Definition: wasm.h:18
@ WASM_OP_RETURN
Definition: wasm.h:24
@ WASM_OP_I32ATOMICRMWSUB
Definition: wasm.h:243
@ WASM_OP_I32ATOMICRMW16UOR
Definition: wasm.h:258
@ WASM_OP_I64ATOMICLOAD16U
Definition: wasm.h:223
@ WASM_OP_I32ATOMICRMW16USUB
Definition: wasm.h:242
@ WASM_OP_I64ATOMICLOAD32U
Definition: wasm.h:224
@ WASM_OP_I32ATOMICRMW8UAND
Definition: wasm.h:250
@ WASM_OP_I64ATOMICLOAD8U
Definition: wasm.h:222
@ WASM_OP_I32ATOMICRMW8UXOR
Definition: wasm.h:264
@ WASM_OP_I64ATOMICRMW32UOR
Definition: wasm.h:261
@ WASM_OP_I32ATOMICRMW8UOR
Definition: wasm.h:257
@ WASM_OP_I64ATOMICRMW8UAND
Definition: wasm.h:252
@ WASM_OP_I64ATOMICRMW8UOR
Definition: wasm.h:259
@ WASM_OP_I64ATOMICRMW16UADD
Definition: wasm.h:239
@ WASM_OP_I32ATOMICRMWOR
Definition: wasm.h:255
@ WASM_OP_I64ATOMICRMW32UADD
Definition: wasm.h:240
@ WASM_OP_I32ATOMICSTORE16
Definition: wasm.h:228
@ WASM_OP_I32ATOMICRMW8UADD
Definition: wasm.h:236
@ WASM_OP_I64ATOMICLOAD
Definition: wasm.h:219
@ WASM_OP_I64ATOMICSTORE32
Definition: wasm.h:231
@ WASM_OP_I64ATOMICRMW8UXCHG
Definition: wasm.h:273
@ WASM_OP_I32ATOMICRMW8USUB
Definition: wasm.h:241
@ WASM_OP_I32ATOMICSTORE
Definition: wasm.h:225
@ WASM_OP_I32ATOMICRMWXOR
Definition: wasm.h:262
@ WASM_OP_I32ATOMICRMW16UADD
Definition: wasm.h:237
@ WASM_OP_I64ATOMICSTORE8
Definition: wasm.h:229
@ WASM_OP_I64ATOMICRMW32UXOR
Definition: wasm.h:268
@ WASM_OP_I32ATOMICLOAD16U
Definition: wasm.h:221
@ WASM_OP_I64ATOMICRMWXCHG
Definition: wasm.h:270
@ WASM_OP_I32ATOMICLOAD8U
Definition: wasm.h:220
@ WASM_OP_I64ATOMICRMW16UAND
Definition: wasm.h:253
@ WASM_OP_I64ATOMICRMW32UAND
Definition: wasm.h:254
@ WASM_OP_I64ATOMICRMW16UXOR
Definition: wasm.h:267
@ WASM_OP_I32ATOMICRMWXCHG
Definition: wasm.h:269
@ WASM_OP_I64ATOMICRMWOR
Definition: wasm.h:256
@ WASM_OP_I64ATOMICRMWAND
Definition: wasm.h:249
@ WASM_OP_I32ATOMICSTORE8
Definition: wasm.h:227
@ WASM_OP_I64ATOMICSTORE16
Definition: wasm.h:230
@ WASM_OP_I32ATOMICRMW16UAND
Definition: wasm.h:251
@ WASM_OP_I64ATOMICRMW8UADD
Definition: wasm.h:238
@ WASM_OP_I32ATOMICRMWAND
Definition: wasm.h:248
@ WASM_OP_I64ATOMICSTORE
Definition: wasm.h:226
@ WASM_OP_I32ATOMICRMW16UXCHG
Definition: wasm.h:272
@ WASM_OP_I64ATOMICRMW16UOR
Definition: wasm.h:260
@ WASM_OP_I32ATOMICLOAD
Definition: wasm.h:218
@ WASM_OP_I64ATOMICRMW16UXCHG
Definition: wasm.h:274
@ WASM_OP_I32ATOMICRMW8UXCHG
Definition: wasm.h:271
@ WASM_OP_I64ATOMICRMW32USUB
Definition: wasm.h:246
@ WASM_OP_I64ATOMICRMW32UXCHG
Definition: wasm.h:275
@ WASM_OP_I64ATOMICRMW8USUB
Definition: wasm.h:244
@ WASM_OP_I32ATOMICRMW16UXOR
Definition: wasm.h:265
@ WASM_OP_I64ATOMICRMW8UXOR
Definition: wasm.h:266
@ WASM_OP_I32ATOMICRMWADD
Definition: wasm.h:234
@ WASM_OP_I64ATOMICRMWSUB
Definition: wasm.h:247
@ WASM_OP_I64ATOMICRMWADD
Definition: wasm.h:235
@ WASM_OP_I64ATOMICRMWXOR
Definition: wasm.h:263
@ WASM_OP_I64ATOMICRMW16USUB
Definition: wasm.h:245
@ WASM_TYPE_OP_ATOMIC
Definition: wasm.h:482
@ WASM_TYPE_OP_SIMD
Definition: wasm.h:483
@ WASM_TYPE_OP_CORE
Definition: wasm.h:481
struct buffer buffer
RZ_API void rz_cons_pop(void)
Definition: cons.c:876
RZ_API void rz_cons_push(void)
Definition: cons.c:860
#define RZ_API
#define NULL
Definition: cris-opc.c:27
uint32_t ut32
RZ_API RzAnalysisHint * rz_analysis_hint_get(RzAnalysis *a, ut64 addr)
Definition: hint.c:506
RZ_API void rz_analysis_hint_set_jump(RzAnalysis *a, ut64 addr, ut64 jump)
Definition: hint.c:213
RZ_API void rz_analysis_hint_set_opcode(RzAnalysis *a, ut64 addr, const char *opcode)
Definition: hint.c:251
RZ_API void rz_analysis_hint_free(RzAnalysisHint *h)
Definition: hint.c:371
RZ_API void rz_analysis_hint_del(RzAnalysis *a, ut64 addr, ut64 size)
Definition: hint.c:105
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130
voidpf void uLong size
Definition: ioapi.h:138
uint8_t ut8
Definition: lh5801.h:11
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")
int n
Definition: mipsasm.c:19
static RzSocket * s
Definition: rtr.c:28
RzAnalysisOpMask
Definition: rz_analysis.h:439
@ RZ_ANALYSIS_OP_TYPE_CMP
Definition: rz_analysis.h:399
@ RZ_ANALYSIS_OP_TYPE_SUB
Definition: rz_analysis.h:402
@ RZ_ANALYSIS_OP_TYPE_LOAD
Definition: rz_analysis.h:416
@ RZ_ANALYSIS_OP_TYPE_UNK
Definition: rz_analysis.h:388
@ RZ_ANALYSIS_OP_TYPE_JMP
Definition: rz_analysis.h:368
@ RZ_ANALYSIS_OP_TYPE_AND
Definition: rz_analysis.h:411
@ RZ_ANALYSIS_OP_TYPE_MOD
Definition: rz_analysis.h:422
@ RZ_ANALYSIS_OP_TYPE_XCHG
Definition: rz_analysis.h:421
@ RZ_ANALYSIS_OP_TYPE_CALL
Definition: rz_analysis.h:378
@ RZ_ANALYSIS_OP_TYPE_ADD
Definition: rz_analysis.h:401
@ RZ_ANALYSIS_OP_TYPE_OR
Definition: rz_analysis.h:410
@ RZ_ANALYSIS_OP_TYPE_STORE
Definition: rz_analysis.h:415
@ RZ_ANALYSIS_OP_TYPE_CRET
Definition: rz_analysis.h:386
@ RZ_ANALYSIS_OP_TYPE_CJMP
Definition: rz_analysis.h:373
@ RZ_ANALYSIS_OP_TYPE_MOV
Definition: rz_analysis.h:390
@ RZ_ANALYSIS_OP_TYPE_ILL
Definition: rz_analysis.h:387
@ RZ_ANALYSIS_OP_TYPE_RET
Definition: rz_analysis.h:385
@ RZ_ANALYSIS_OP_TYPE_NOP
Definition: rz_analysis.h:389
@ RZ_ANALYSIS_OP_TYPE_XOR
Definition: rz_analysis.h:412
@ RZ_LIB_TYPE_ANALYSIS
Definition: rz_lib.h:73
#define RZ_LOG_ERROR(fmtstr,...)
Definition: rz_log.h:58
RZ_API ut64 rz_num_get(RzNum *num, const char *str)
Definition: unum.c:172
RZ_API const char * rz_strbuf_setf(RzStrBuf *sb, const char *fmt,...) RZ_PRINTF_CHECK(2
#define PFMT64x
Definition: rz_types.h:393
#define UT64_MAX
Definition: rz_types_base.h:86
RZ_API size_t read_u32_leb128(const ut8 *p, const ut8 *max, ut32 *out_val)
Definition: uleb128.c:186
#define RZ_VERSION
Definition: rz_version.h:8
#define a(i)
Definition: sha256.c:41
Definition: wasm.h:486
WasmTypeOp type
Definition: wasm.h:492
WasmOpAtomicCodes atomic
Definition: wasm.h:489
WasmOpCodes core
Definition: wasm.h:488
char * txt
Definition: wasm.h:494
union WasmOp::@116 op
Definition: buffer.h:15
const char * version
Definition: rz_analysis.h:1239
RzIOBind iob
Definition: rz_analysis.h:574
RzCoreBind coreb
Definition: rz_analysis.h:580
RzCoreCmdStrF cmdstrf
Definition: rz_bind.h:35
void * core
Definition: rz_bind.h:31
RzIOReadAt read_at
Definition: rz_io.h:240
RzIO * io
Definition: rz_io.h:232
Definition: dis.c:32
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
static int addr
Definition: z80asm.c:58