Rizin
unix-like reverse engineering framework and cli tools
il_export.c
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2021 RizinOrg <info@rizin.re>
2 // SPDX-FileCopyrightText: 2021 deroad <wargio@libero.it>
3 // SPDX-License-Identifier: LGPL-3.0-only
4 
60 #include <rz_il/rz_il_vm.h>
61 
62 static void il_op_pure_resolve(RzILOpPure *op, RzStrBuf *sb, PJ *pj);
63 static void il_op_effect_resolve(RzILOpEffect *op, RzStrBuf *sb, PJ *pj);
64 
65 #define il_op_unimplemented(name) \
66  do { \
67  if (sb) { \
68  rz_strbuf_append(sb, name "(unimplemented)"); \
69  } else { \
70  pj_o(pj); \
71  pj_ks(pj, "opcode", name); \
72  pj_kb(pj, "unimplemented", true); \
73  pj_end(pj); \
74  } \
75  } while (0)
76 
77 #define il_op_param_0(name) \
78  do { \
79  if (sb) { \
80  rz_strbuf_append(sb, name); \
81  } else { \
82  pj_o(pj); \
83  pj_ks(pj, "opcode", name); \
84  pj_end(pj); \
85  } \
86  } while (0)
87 
88 #define il_op_param_1(name, opx, v0) \
89  do { \
90  if (sb) { \
91  rz_strbuf_append(sb, "(" name " "); \
92  il_op_pure_resolve(opx.v0, sb, pj); \
93  rz_strbuf_append(sb, ")"); \
94  } else { \
95  pj_o(pj); \
96  pj_ks(pj, "opcode", name); \
97  pj_k(pj, #v0); \
98  il_op_pure_resolve(opx.v0, sb, pj); \
99  pj_end(pj); \
100  } \
101  } while (0)
102 
103 #define il_op_param_2(name, opx, sort0, v0, sort1, v1) \
104  do { \
105  if (sb) { \
106  rz_strbuf_append(sb, "(" name " "); \
107  il_op_##sort0##_resolve(opx.v0, sb, pj); \
108  rz_strbuf_append(sb, " "); \
109  il_op_##sort1##_resolve(opx.v1, sb, pj); \
110  rz_strbuf_append(sb, ")"); \
111  } else { \
112  pj_o(pj); \
113  pj_ks(pj, "opcode", name); \
114  pj_k(pj, #v0); \
115  il_op_##sort0##_resolve(opx.v0, sb, pj); \
116  pj_k(pj, #v1); \
117  il_op_##sort1##_resolve(opx.v1, sb, pj); \
118  pj_end(pj); \
119  } \
120  } while (0)
121 
122 #define il_op_param_3(name, opx, sort0, v0, sort1, v1, sort2, v2) \
123  do { \
124  if (sb) { \
125  rz_strbuf_append(sb, "(" name " "); \
126  il_op_##sort0##_resolve(opx.v0, sb, pj); \
127  rz_strbuf_append(sb, " "); \
128  il_op_##sort1##_resolve(opx.v1, sb, pj); \
129  rz_strbuf_append(sb, " "); \
130  il_op_##sort2##_resolve(opx.v2, sb, pj); \
131  rz_strbuf_append(sb, ")"); \
132  } else { \
133  pj_o(pj); \
134  pj_ks(pj, "opcode", name); \
135  pj_k(pj, #v0); \
136  il_op_##sort0##_resolve(opx.v0, sb, pj); \
137  pj_k(pj, #v1); \
138  il_op_##sort1##_resolve(opx.v1, sb, pj); \
139  pj_k(pj, #v2); \
140  il_op_##sort2##_resolve(opx.v2, sb, pj); \
141  pj_end(pj); \
142  } \
143  } while (0)
144 
145 static void il_opdmp_var(RzILOpPure *op, RzStrBuf *sb, PJ *pj) {
146  RzILOpArgsVar *opx = &op->op.var;
147  if (sb) {
148  rz_strbuf_appendf(sb, "(var %s)", opx->v);
149  } else {
150  pj_o(pj);
151  pj_ks(pj, "opcode", "var");
152  pj_ks(pj, "value", opx->v);
153  pj_end(pj);
154  }
155 }
156 
157 static void il_opdmp_ite(RzILOpPure *op, RzStrBuf *sb, PJ *pj) {
158  il_op_param_3("ite", op->op.ite, pure, condition, pure, x, pure, y);
159 }
160 
161 static void il_opdmp_let(RzILOpPure *op, RzStrBuf *sb, PJ *pj) {
162  RzILOpArgsLet *opx = &op->op.let;
163  if (sb) {
164  rz_strbuf_appendf(sb, "(let %s ", opx->name);
165  il_op_pure_resolve(opx->exp, sb, pj);
166  rz_strbuf_append(sb, " ");
167  il_op_pure_resolve(opx->body, sb, pj);
168  rz_strbuf_append(sb, ")");
169  } else {
170  pj_o(pj);
171  pj_ks(pj, "opcode", "let");
172  pj_ks(pj, "dst", opx->name);
173  pj_k(pj, "exp");
174  il_op_pure_resolve(opx->exp, sb, pj);
175  pj_k(pj, "body");
176  il_op_pure_resolve(opx->body, sb, pj);
177  pj_end(pj);
178  }
179 }
180 
182  if (sb) {
183  rz_strbuf_append(sb, "false");
184  } else {
185  pj_o(pj);
186  pj_ks(pj, "opcode", "bool");
187  pj_kb(pj, "value", false);
188  pj_end(pj);
189  }
190 }
191 
193  if (sb) {
194  rz_strbuf_append(sb, "true");
195  } else {
196  pj_o(pj);
197  pj_ks(pj, "opcode", "bool");
198  pj_kb(pj, "value", true);
199  pj_end(pj);
200  }
201 }
202 
203 static void il_opdmp_bool_inv(RzILOpPure *op, RzStrBuf *sb, PJ *pj) {
204  il_op_param_1("!", op->op.boolinv, x);
205 }
206 
207 static void il_opdmp_bool_and(RzILOpPure *op, RzStrBuf *sb, PJ *pj) {
208  il_op_param_2("&&", op->op.booland, pure, x, pure, y);
209 }
210 
211 static void il_opdmp_bool_or(RzILOpPure *op, RzStrBuf *sb, PJ *pj) {
212  il_op_param_2("||", op->op.boolor, pure, x, pure, y);
213 }
214 
215 static void il_opdmp_bool_xor(RzILOpPure *op, RzStrBuf *sb, PJ *pj) {
216  il_op_param_2("^^", op->op.boolxor, pure, x, pure, y);
217 }
218 
219 static void il_opdmp_bitv(RzILOpPure *op, RzStrBuf *sb, PJ *pj) {
220  RzILOpArgsBv *opx = &op->op.bitv;
221  char *num = rz_bv_as_hex_string(opx->value, false);
222  if (sb) {
223  rz_strbuf_appendf(sb, "(bv %u %s)", opx->value->len, num);
224  } else {
225  pj_o(pj);
226  pj_ks(pj, "opcode", "bitv");
227  pj_ks(pj, "bits", num);
228  pj_kn(pj, "len", opx->value->len);
229  pj_end(pj);
230  }
231  free(num);
232 }
233 
234 static void il_opdmp_msb(RzILOpPure *op, RzStrBuf *sb, PJ *pj) {
235  il_op_param_1("msb", op->op.msb, bv);
236 }
237 
238 static void il_opdmp_lsb(RzILOpPure *op, RzStrBuf *sb, PJ *pj) {
239  il_op_param_1("lsb", op->op.lsb, bv);
240 }
241 
242 static void il_opdmp_is_zero(RzILOpPure *op, RzStrBuf *sb, PJ *pj) {
243  il_op_param_1("is_zero", op->op.lsb, bv);
244 }
245 
246 static void il_opdmp_neg(RzILOpPure *op, RzStrBuf *sb, PJ *pj) {
247  il_op_param_1("~-", op->op.neg, bv);
248 }
249 
250 static void il_opdmp_lognot(RzILOpPure *op, RzStrBuf *sb, PJ *pj) {
251  il_op_param_1("~", op->op.lognot, bv);
252 }
253 
254 static void il_opdmp_add(RzILOpPure *op, RzStrBuf *sb, PJ *pj) {
255  il_op_param_2("+", op->op.add, pure, x, pure, y);
256 }
257 
258 static void il_opdmp_sub(RzILOpPure *op, RzStrBuf *sb, PJ *pj) {
259  il_op_param_2("-", op->op.sub, pure, x, pure, y);
260 }
261 
262 static void il_opdmp_mul(RzILOpPure *op, RzStrBuf *sb, PJ *pj) {
263  il_op_param_2("*", op->op.mul, pure, x, pure, y);
264 }
265 
266 static void il_opdmp_div(RzILOpPure *op, RzStrBuf *sb, PJ *pj) {
267  il_op_param_2("div", op->op.div, pure, x, pure, y);
268 }
269 
270 static void il_opdmp_sdiv(RzILOpPure *op, RzStrBuf *sb, PJ *pj) {
271  il_op_param_2("sdiv", op->op.sdiv, pure, x, pure, y);
272 }
273 
274 static void il_opdmp_mod(RzILOpPure *op, RzStrBuf *sb, PJ *pj) {
275  il_op_param_2("mod", op->op.mod, pure, x, pure, y);
276 }
277 
278 static void il_opdmp_smod(RzILOpPure *op, RzStrBuf *sb, PJ *pj) {
279  il_op_param_2("smod", op->op.smod, pure, x, pure, y);
280 }
281 
282 static void il_opdmp_logand(RzILOpPure *op, RzStrBuf *sb, PJ *pj) {
283  il_op_param_2("&", op->op.logand, pure, x, pure, y);
284 }
285 
286 static void il_opdmp_logor(RzILOpPure *op, RzStrBuf *sb, PJ *pj) {
287  il_op_param_2("|", op->op.logor, pure, x, pure, y);
288 }
289 
290 static void il_opdmp_logxor(RzILOpPure *op, RzStrBuf *sb, PJ *pj) {
291  il_op_param_2("^", op->op.logxor, pure, x, pure, y);
292 }
293 
294 static void il_opdmp_shiftr(RzILOpPure *op, RzStrBuf *sb, PJ *pj) {
295  il_op_param_3(">>", op->op.shiftr, pure, x, pure, y, pure, fill_bit);
296 }
297 
298 static void il_opdmp_shiftl(RzILOpPure *op, RzStrBuf *sb, PJ *pj) {
299  il_op_param_3("<<", op->op.shiftl, pure, x, pure, y, pure, fill_bit);
300 }
301 
302 static void il_opdmp_eq(RzILOpPure *op, RzStrBuf *sb, PJ *pj) {
303  il_op_param_2("==", op->op.ule, pure, x, pure, y);
304 }
305 
306 static void il_opdmp_sle(RzILOpPure *op, RzStrBuf *sb, PJ *pj) {
307  il_op_param_2("sle", op->op.sle, pure, x, pure, y);
308 }
309 
310 static void il_opdmp_ule(RzILOpPure *op, RzStrBuf *sb, PJ *pj) {
311  il_op_param_2("ule", op->op.ule, pure, x, pure, y);
312 }
313 
314 static void il_opdmp_cast(RzILOpPure *op, RzStrBuf *sb, PJ *pj) {
315  RzILOpArgsCast *opx = &op->op.cast;
316  if (sb) {
317  rz_strbuf_appendf(sb, "(cast %u ", opx->length);
318  il_op_pure_resolve(opx->fill, sb, pj);
319  rz_strbuf_append(sb, " ");
320  il_op_pure_resolve(opx->val, sb, pj);
321  rz_strbuf_append(sb, ")");
322  } else {
323  pj_o(pj);
324  pj_ks(pj, "opcode", "cast");
325  pj_k(pj, "value");
326  il_op_pure_resolve(opx->val, sb, pj);
327  pj_kn(pj, "length", opx->length);
328  pj_k(pj, "fill");
329  il_op_pure_resolve(opx->fill, sb, pj);
330  pj_end(pj);
331  }
332 }
333 
334 static void il_opdmp_append(RzILOpPure *op, RzStrBuf *sb, PJ *pj) {
335  il_op_param_2("append", op->op.append, pure, high, pure, low);
336 }
337 
338 static void il_opdmp_load(RzILOpPure *op, RzStrBuf *sb, PJ *pj) {
339  RzILOpArgsLoad *opx = &op->op.load;
340  if (sb) {
341  rz_strbuf_appendf(sb, "(load %u ", (ut32)opx->mem);
342  il_op_pure_resolve(opx->key, sb, pj);
343  rz_strbuf_append(sb, ")");
344  } else {
345  pj_o(pj);
346  pj_ks(pj, "opcode", "load");
347  pj_kn(pj, "mem", opx->mem);
348  pj_k(pj, "key");
349  il_op_pure_resolve(opx->key, sb, pj);
350  pj_end(pj);
351  }
352 }
353 
354 static void il_opdmp_loadw(RzILOpPure *op, RzStrBuf *sb, PJ *pj) {
355  RzILOpArgsLoadW *opx = &op->op.loadw;
356  if (sb) {
357  rz_strbuf_appendf(sb, "(loadw %u %u ", (ut32)opx->mem, (ut32)opx->n_bits);
358  il_op_pure_resolve(opx->key, sb, pj);
359  rz_strbuf_append(sb, ")");
360  } else {
361  pj_o(pj);
362  pj_ks(pj, "opcode", "loadw");
363  pj_kn(pj, "mem", opx->mem);
364  pj_k(pj, "key");
365  il_op_pure_resolve(opx->key, sb, pj);
366  pj_kn(pj, "bits", opx->n_bits);
367  pj_end(pj);
368  }
369 }
370 
371 static void il_opdmp_store(RzILOpEffect *op, RzStrBuf *sb, PJ *pj) {
372  RzILOpArgsStore *opx = &op->op.store;
373 
374  if (sb) {
375  rz_strbuf_appendf(sb, "(store %u ", (ut32)opx->mem);
376  il_op_pure_resolve(opx->key, sb, pj);
377  rz_strbuf_append(sb, " ");
378  il_op_pure_resolve(opx->value, sb, pj);
379  rz_strbuf_append(sb, ")");
380  } else {
381  pj_o(pj);
382  pj_ks(pj, "opcode", "store");
383  pj_kn(pj, "mem", opx->mem);
384  pj_k(pj, "key");
385  il_op_pure_resolve(opx->key, sb, pj);
386  pj_k(pj, "value");
387  il_op_pure_resolve(opx->value, sb, pj);
388  pj_end(pj);
389  }
390 }
391 
392 static void il_opdmp_storew(RzILOpEffect *op, RzStrBuf *sb, PJ *pj) {
393  RzILOpArgsStore *opx = &op->op.store;
394 
395  if (sb) {
396  rz_strbuf_appendf(sb, "(storew %u ", (ut32)opx->mem);
397  il_op_pure_resolve(opx->key, sb, pj);
398  rz_strbuf_append(sb, " ");
399  il_op_pure_resolve(opx->value, sb, pj);
400  rz_strbuf_append(sb, ")");
401  } else {
402  pj_o(pj);
403  pj_ks(pj, "opcode", "storew");
404  pj_kn(pj, "mem", opx->mem);
405  pj_k(pj, "key");
406  il_op_pure_resolve(opx->key, sb, pj);
407  pj_k(pj, "value");
408  il_op_pure_resolve(opx->value, sb, pj);
409  pj_end(pj);
410  }
411 }
412 
413 static void il_opdmp_nop(RzILOpEffect *op, RzStrBuf *sb, PJ *pj) {
414  il_op_param_0("nop");
415 }
416 
417 static void il_opdmp_empty(RzILOpEffect *op, RzStrBuf *sb, PJ *pj) {
418  il_op_param_0("empty");
419 }
420 
421 static void il_opdmp_set(RzILOpEffect *op, RzStrBuf *sb, PJ *pj) {
422  RzILOpArgsSet *opx = &op->op.set;
423  if (sb) {
424  rz_strbuf_appendf(sb, "(set %s ", opx->v);
425  il_op_pure_resolve(opx->x, sb, pj);
426  rz_strbuf_append(sb, ")");
427  } else {
428  pj_o(pj);
429  pj_ks(pj, "opcode", "set");
430  pj_ks(pj, "dst", opx->v);
431  pj_k(pj, "src");
432  il_op_pure_resolve(opx->x, sb, pj);
433  pj_end(pj);
434  }
435 }
436 
437 static void il_opdmp_jmp(RzILOpEffect *op, RzStrBuf *sb, PJ *pj) {
438  il_op_param_1("jmp", op->op.jmp, dst);
439 }
440 
441 static void il_opdmp_goto(RzILOpEffect *op, RzStrBuf *sb, PJ *pj) {
442  RzILOpArgsGoto *opx = &op->op.goto_;
443  if (sb) {
444  rz_strbuf_appendf(sb, "(goto %s)", opx->lbl);
445  } else {
446  pj_o(pj);
447  pj_ks(pj, "opcode", "goto");
448  pj_ks(pj, "label", opx->lbl);
449  pj_end(pj);
450  }
451 }
452 
454  RzILOpArgsSeq *seq = &op->op.seq;
455  if (seq->x->code == RZ_IL_OP_SEQ) {
456  il_opdmp_seq_inner(seq->x, sb);
457  } else {
458  il_op_effect_resolve(seq->x, sb, NULL);
459  }
460  rz_strbuf_append(sb, " ");
461  if (seq->y->code == RZ_IL_OP_SEQ) {
462  il_opdmp_seq_inner(seq->y, sb);
463  } else {
464  il_op_effect_resolve(seq->y, sb, NULL);
465  }
466 }
467 
468 static void il_opdmp_seq(RzILOpEffect *op, RzStrBuf *sb, PJ *pj) {
469  if (sb) {
470  // print things like
471  // (seq (...) (seq (...) (...)))
472  // as just
473  // (seq (...) (...) (...))
474  rz_strbuf_append(sb, "(seq ");
476  rz_strbuf_append(sb, ")");
477  } else {
478  il_op_param_2("seq", op->op.seq, effect, x, effect, y);
479  }
480 }
481 
482 static void il_opdmp_blk(RzILOpEffect *op, RzStrBuf *sb, PJ *pj) {
483  RzILOpArgsBlk *opx = &op->op.blk;
484  if (sb) {
485  rz_strbuf_appendf(sb, "(blk %s ", opx->label);
486  il_op_effect_resolve(opx->data_eff, sb, pj);
487  rz_strbuf_append(sb, " ");
488  il_op_effect_resolve(opx->ctrl_eff, sb, pj);
489  rz_strbuf_append(sb, ")");
490  } else {
491  pj_o(pj);
492  pj_ks(pj, "label", opx->label);
493  pj_k(pj, "data");
494  il_op_effect_resolve(opx->data_eff, sb, pj);
495  pj_k(pj, "ctrl");
496  il_op_effect_resolve(opx->ctrl_eff, sb, pj);
497  pj_end(pj);
498  }
499 }
500 
501 static void il_opdmp_repeat(RzILOpEffect *op, RzStrBuf *sb, PJ *pj) {
502  il_op_param_2("repeat", op->op.repeat, pure, condition, effect, data_eff);
503 }
504 
505 static void il_opdmp_branch(RzILOpEffect *op, RzStrBuf *sb, PJ *pj) {
506  il_op_param_3("branch", op->op.branch, pure, condition, effect, true_eff, effect, false_eff);
507 }
508 
510  if (!op && sb) {
511  rz_strbuf_append(sb, "(null)");
512  return;
513  } else if (!op && pj) {
514  pj_o(pj);
515  pj_knull(pj, "opcode");
516  pj_end(pj);
517  return;
518  }
519  switch (op->code) {
520  case RZ_IL_OP_VAR:
521  il_opdmp_var(op, sb, pj);
522  return;
523  case RZ_IL_OP_ITE:
524  il_opdmp_ite(op, sb, pj);
525  return;
526  case RZ_IL_OP_LET:
527  il_opdmp_let(op, sb, pj);
528  return;
529  case RZ_IL_OP_B0:
530  il_opdmp_bool_false(op, sb, pj);
531  return;
532  case RZ_IL_OP_B1:
533  il_opdmp_bool_true(op, sb, pj);
534  return;
535  case RZ_IL_OP_INV:
536  il_opdmp_bool_inv(op, sb, pj);
537  return;
538  case RZ_IL_OP_AND:
539  il_opdmp_bool_and(op, sb, pj);
540  return;
541  case RZ_IL_OP_OR:
542  il_opdmp_bool_or(op, sb, pj);
543  return;
544  case RZ_IL_OP_XOR:
545  il_opdmp_bool_xor(op, sb, pj);
546  return;
547  case RZ_IL_OP_BITV:
548  il_opdmp_bitv(op, sb, pj);
549  return;
550  case RZ_IL_OP_MSB:
551  il_opdmp_msb(op, sb, pj);
552  return;
553  case RZ_IL_OP_LSB:
554  il_opdmp_lsb(op, sb, pj);
555  return;
556  case RZ_IL_OP_IS_ZERO:
557  il_opdmp_is_zero(op, sb, pj);
558  return;
559  case RZ_IL_OP_NEG:
560  il_opdmp_neg(op, sb, pj);
561  return;
562  case RZ_IL_OP_LOGNOT:
563  il_opdmp_lognot(op, sb, pj);
564  return;
565  case RZ_IL_OP_ADD:
566  il_opdmp_add(op, sb, pj);
567  return;
568  case RZ_IL_OP_SUB:
569  il_opdmp_sub(op, sb, pj);
570  return;
571  case RZ_IL_OP_MUL:
572  il_opdmp_mul(op, sb, pj);
573  return;
574  case RZ_IL_OP_DIV:
575  il_opdmp_div(op, sb, pj);
576  return;
577  case RZ_IL_OP_SDIV:
578  il_opdmp_sdiv(op, sb, pj);
579  return;
580  case RZ_IL_OP_MOD:
581  il_opdmp_mod(op, sb, pj);
582  return;
583  case RZ_IL_OP_SMOD:
584  il_opdmp_smod(op, sb, pj);
585  return;
586  case RZ_IL_OP_LOGAND:
587  il_opdmp_logand(op, sb, pj);
588  return;
589  case RZ_IL_OP_LOGOR:
590  il_opdmp_logor(op, sb, pj);
591  return;
592  case RZ_IL_OP_LOGXOR:
593  il_opdmp_logxor(op, sb, pj);
594  return;
595  case RZ_IL_OP_SHIFTR:
596  il_opdmp_shiftr(op, sb, pj);
597  return;
598  case RZ_IL_OP_SHIFTL:
599  il_opdmp_shiftl(op, sb, pj);
600  return;
601  case RZ_IL_OP_EQ:
602  il_opdmp_eq(op, sb, pj);
603  return;
604  case RZ_IL_OP_SLE:
605  il_opdmp_sle(op, sb, pj);
606  return;
607  case RZ_IL_OP_ULE:
608  il_opdmp_ule(op, sb, pj);
609  return;
610  case RZ_IL_OP_CAST:
611  il_opdmp_cast(op, sb, pj);
612  return;
613  case RZ_IL_OP_APPEND:
614  il_opdmp_append(op, sb, pj);
615  return;
616  case RZ_IL_OP_LOAD:
617  il_opdmp_load(op, sb, pj);
618  return;
619  case RZ_IL_OP_LOADW:
620  il_opdmp_loadw(op, sb, pj);
621  return;
622  default:
624  if (sb) {
625  rz_strbuf_appendf(sb, "unk_%u", op->code);
626  } else {
627  char tmp[64];
628  rz_strf(tmp, "unk_%u", op->code);
629  pj_o(pj);
630  pj_ks(pj, "opcode", tmp);
631  pj_end(pj);
632  }
633  return;
634  }
635 }
636 
638  if (!op && sb) {
639  rz_strbuf_append(sb, "nop");
640  return;
641  } else if (!op && pj) {
642  pj_o(pj);
643  pj_ks(pj, "opcode", "nop");
644  pj_end(pj);
645  return;
646  }
647  switch (op->code) {
648  case RZ_IL_OP_EMPTY:
649  il_opdmp_empty(op, sb, pj);
650  break;
651  case RZ_IL_OP_STORE:
652  il_opdmp_store(op, sb, pj);
653  return;
654  case RZ_IL_OP_STOREW:
655  il_opdmp_storew(op, sb, pj);
656  return;
657  case RZ_IL_OP_NOP:
658  il_opdmp_nop(op, sb, pj);
659  return;
660  case RZ_IL_OP_SET:
661  il_opdmp_set(op, sb, pj);
662  return;
663  case RZ_IL_OP_JMP:
664  il_opdmp_jmp(op, sb, pj);
665  return;
666  case RZ_IL_OP_GOTO:
667  il_opdmp_goto(op, sb, pj);
668  return;
669  case RZ_IL_OP_SEQ:
670  il_opdmp_seq(op, sb, pj);
671  return;
672  case RZ_IL_OP_BLK:
673  il_opdmp_blk(op, sb, pj);
674  return;
675  case RZ_IL_OP_REPEAT:
676  il_opdmp_repeat(op, sb, pj);
677  return;
678  case RZ_IL_OP_BRANCH:
679  il_opdmp_branch(op, sb, pj);
680  return;
681  default:
683  if (sb) {
684  rz_strbuf_appendf(sb, "unk_%u", op->code);
685  } else {
686  char tmp[64];
687  rz_strf(tmp, "unk_%u", op->code);
688  pj_o(pj);
689  pj_ks(pj, "opcode", tmp);
690  pj_end(pj);
691  }
692  return;
693  }
694 }
695 
702  rz_return_if_fail(op && sb);
704 }
705 
712  rz_return_if_fail(op && sb);
714 }
715 
722  rz_return_if_fail(op && pj);
723  il_op_pure_resolve(op, NULL, pj);
724 }
725 
732  rz_return_if_fail(op && pj);
734 }
735 
742  if (!bv) {
743  return NULL;
744  }
745  char *r = rz_bv_as_hex_string(bv, false);
746  rz_bv_free(bv);
747  return r;
748 }
749 
754  rz_return_if_fail(evt && sb);
755  char *tmp0 = NULL, *tmp1 = NULL, *tmp2 = NULL;
756 
757  switch (evt->type) {
759  rz_strbuf_appendf(sb, "exception(%s)", evt->data.exception);
760  break;
762  tmp0 = rz_bv_as_hex_string(evt->data.pc_write.old_pc, false);
763  tmp1 = rz_bv_as_hex_string(evt->data.pc_write.new_pc, false);
764  rz_strbuf_appendf(sb, "pc_write(old: %s, new: %s)", tmp0, tmp1);
765  break;
767  tmp0 = rz_bv_as_hex_string(evt->data.mem_read.address, false);
768  tmp1 = evt->data.mem_read.value ? rz_bv_as_hex_string(evt->data.mem_read.value, false) : NULL;
769  rz_strbuf_appendf(sb, "mem_read(addr: %s, value: %s)", tmp0, tmp1 ? tmp1 : "uninitialized memory");
770  break;
772  tmp1 = rz_il_value_stringify(evt->data.var_read.value);
773  rz_strbuf_appendf(sb, "var_read(name: %s, value: %s)", evt->data.var_write.variable, tmp1 ? tmp1 : "uninitialized variable");
774  break;
776  tmp0 = rz_bv_as_hex_string(evt->data.mem_write.address, false);
777  tmp1 = evt->data.mem_write.old_value ? rz_bv_as_hex_string(evt->data.mem_write.old_value, false) : NULL;
778  tmp2 = rz_bv_as_hex_string(evt->data.mem_write.new_value, false);
779  rz_strbuf_appendf(sb, "mem_write(addr: %s, old: %s, new: %s)", tmp0, tmp1 ? tmp1 : "uninitialized memory", tmp2);
780  break;
782  tmp1 = rz_il_value_stringify(evt->data.var_write.old_value);
783  tmp2 = rz_il_value_stringify(evt->data.var_write.new_value);
784  rz_strbuf_appendf(sb, "var_write(name: %s, old: %s, new: %s)", evt->data.var_write.variable, tmp1 ? tmp1 : "uninitialized variable", tmp2);
785  break;
786  default:
788  rz_strbuf_append(sb, "unknown(?)");
789  break;
790  }
791 
792  free(tmp0);
793  free(tmp1);
794  free(tmp2);
795 }
796 
798  rz_return_if_fail(evt && pj);
799  char *tmp0 = NULL, *tmp1 = NULL, *tmp2 = NULL;
800 
801  switch (evt->type) {
803  pj_o(pj);
804  pj_ks(pj, "type", "exception");
805  pj_ks(pj, "exception", evt->data.exception);
806  pj_end(pj);
807  break;
809  tmp0 = rz_bv_as_hex_string(evt->data.pc_write.old_pc, false);
810  tmp1 = rz_bv_as_hex_string(evt->data.pc_write.new_pc, false);
811  pj_o(pj);
812  pj_ks(pj, "type", "pc_write");
813  pj_ks(pj, "old", tmp0);
814  pj_ks(pj, "new", tmp1);
815  pj_end(pj);
816  break;
818  tmp0 = rz_bv_as_hex_string(evt->data.mem_read.address, false);
819  tmp1 = rz_bv_as_hex_string(evt->data.mem_read.value, false);
820  pj_o(pj);
821  pj_ks(pj, "type", "mem_read");
822  pj_ks(pj, "address", tmp0);
823  pj_ks(pj, "value", tmp1);
824  pj_end(pj);
825  break;
827  tmp1 = rz_il_value_stringify(evt->data.var_read.value);
828  pj_o(pj);
829  pj_ks(pj, "type", "var_read");
830  pj_ks(pj, "name", evt->data.var_read.variable);
831  pj_ks(pj, "value", tmp1 ? tmp1 : "uninitialized variable");
832  pj_end(pj);
833  break;
835  tmp0 = rz_bv_as_hex_string(evt->data.mem_write.address, false);
836  tmp1 = evt->data.mem_write.old_value ? rz_bv_as_hex_string(evt->data.mem_write.old_value, false) : NULL;
837  tmp2 = rz_bv_as_hex_string(evt->data.mem_write.new_value, false);
838  pj_o(pj);
839  pj_ks(pj, "type", "mem_write");
840  pj_ks(pj, "address", tmp0);
841  pj_ks(pj, "old", tmp1 ? tmp1 : "uninitialized memory");
842  pj_ks(pj, "new", tmp2);
843  pj_end(pj);
844  break;
846  tmp1 = rz_il_value_stringify(evt->data.var_write.old_value);
847  tmp2 = rz_il_value_stringify(evt->data.var_write.new_value);
848  pj_o(pj);
849  pj_ks(pj, "type", "var_write");
850  pj_ks(pj, "name", evt->data.var_write.variable);
851  pj_ks(pj, "old", tmp1 ? tmp1 : "uninitialized variable");
852  pj_ks(pj, "new", tmp2);
853  pj_end(pj);
854  break;
855  default:
857  pj_o(pj);
858  pj_ks(pj, "type", "unknown");
859  pj_end(pj);
860  break;
861  }
862 
863  free(tmp0);
864  free(tmp1);
865  free(tmp2);
866 }
867 
873  switch (code) {
874  case RZ_IL_OP_VAR:
875  return "var";
876  case RZ_IL_OP_ITE:
877  return "ite";
878  case RZ_IL_OP_LET:
879  return "let";
880  case RZ_IL_OP_B0:
881  return "b0";
882  case RZ_IL_OP_B1:
883  return "b1";
884  case RZ_IL_OP_INV:
885  return "inv";
886  case RZ_IL_OP_AND:
887  return "and";
888  case RZ_IL_OP_OR:
889  return "or";
890  case RZ_IL_OP_XOR:
891  return "xor";
892  case RZ_IL_OP_BITV:
893  return "bitv";
894  case RZ_IL_OP_MSB:
895  return "msb";
896  case RZ_IL_OP_LSB:
897  return "lsb";
898  case RZ_IL_OP_IS_ZERO:
899  return "is_zero";
900  case RZ_IL_OP_NEG:
901  return "neg";
902  case RZ_IL_OP_LOGNOT:
903  return "lognot";
904  case RZ_IL_OP_ADD:
905  return "add";
906  case RZ_IL_OP_SUB:
907  return "sub";
908  case RZ_IL_OP_MUL:
909  return "mul";
910  case RZ_IL_OP_DIV:
911  return "div";
912  case RZ_IL_OP_SDIV:
913  return "sdiv";
914  case RZ_IL_OP_MOD:
915  return "mod";
916  case RZ_IL_OP_SMOD:
917  return "smod";
918  case RZ_IL_OP_LOGAND:
919  return "logand";
920  case RZ_IL_OP_LOGOR:
921  return "logor";
922  case RZ_IL_OP_LOGXOR:
923  return "logxor";
924  case RZ_IL_OP_SHIFTR:
925  return "shiftr";
926  case RZ_IL_OP_SHIFTL:
927  return "shiftl";
928  case RZ_IL_OP_EQ:
929  return "eq";
930  case RZ_IL_OP_SLE:
931  return "sle";
932  case RZ_IL_OP_ULE:
933  return "ule";
934  case RZ_IL_OP_CAST:
935  return "cast";
936  case RZ_IL_OP_APPEND:
937  return "append";
938  case RZ_IL_OP_LOAD:
939  return "load";
940  case RZ_IL_OP_LOADW:
941  return "loadw";
942  case RZ_IL_OP_PURE_MAX:
943  break;
944  }
945  return "invalid";
946 }
947 
953  switch (sort.type) {
955  return rz_str_newf("bitvector:%u", (unsigned int)sort.props.bv.length);
957  return strdup("bool");
958  }
959  return strdup("invalid");
960 }
ut16 val
Definition: armass64_const.h:6
static SblHeader sb
Definition: bin_mbn.c:26
#define RZ_API
#define NULL
Definition: cris-opc.c:27
#define r
Definition: crypto_rc6.c:12
uint32_t ut32
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130
RZ_API RZ_OWN RzBitVector * rz_il_value_to_bv(RZ_NONNULL const RzILVal *val)
Definition: value.c:141
static void il_opdmp_store(RzILOpEffect *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:371
static void il_opdmp_cast(RzILOpPure *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:314
static void il_opdmp_bool_false(RzILOpPure *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:181
static void il_opdmp_shiftl(RzILOpPure *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:298
static void il_opdmp_jmp(RzILOpEffect *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:437
RZ_API RZ_NONNULL const char * rz_il_op_pure_code_stringify(RzILOpPureCode code)
Definition: il_export.c:872
RZ_API void rz_il_event_json(RZ_NONNULL RzILEvent *evt, RZ_NONNULL PJ *pj)
Definition: il_export.c:797
static void il_opdmp_append(RzILOpPure *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:334
RZ_API char * rz_il_value_stringify(RZ_NONNULL const RzILVal *val)
Definition: il_export.c:739
static void il_opdmp_bool_inv(RzILOpPure *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:203
static void il_opdmp_bool_or(RzILOpPure *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:211
#define il_op_param_0(name)
Definition: il_export.c:77
static void il_opdmp_loadw(RzILOpPure *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:354
static void il_opdmp_lognot(RzILOpPure *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:250
static void il_opdmp_logxor(RzILOpPure *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:290
static void il_opdmp_blk(RzILOpEffect *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:482
#define il_op_param_3(name, opx, sort0, v0, sort1, v1, sort2, v2)
Definition: il_export.c:122
static void il_opdmp_ite(RzILOpPure *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:157
static void il_opdmp_msb(RzILOpPure *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:234
static void il_opdmp_bitv(RzILOpPure *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:219
static void il_opdmp_bool_xor(RzILOpPure *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:215
static void il_opdmp_storew(RzILOpEffect *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:392
static void il_opdmp_add(RzILOpPure *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:254
static void il_opdmp_ule(RzILOpPure *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:310
RZ_API void rz_il_op_effect_json(RZ_NONNULL RzILOpEffect *op, RZ_NONNULL PJ *pj)
Definition: il_export.c:731
#define il_op_param_2(name, opx, sort0, v0, sort1, v1)
Definition: il_export.c:103
RZ_API void rz_il_op_pure_json(RZ_NONNULL RzILOpPure *op, RZ_NONNULL PJ *pj)
Definition: il_export.c:721
static void il_opdmp_seq_inner(RzILOpEffect *op, RzStrBuf *sb)
Definition: il_export.c:453
static void il_opdmp_logand(RzILOpPure *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:282
static void il_opdmp_logor(RzILOpPure *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:286
static void il_opdmp_sle(RzILOpPure *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:306
static void il_opdmp_smod(RzILOpPure *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:278
static void il_opdmp_load(RzILOpPure *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:338
static void il_opdmp_bool_true(RzILOpPure *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:192
static void il_opdmp_let(RzILOpPure *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:161
static void il_opdmp_repeat(RzILOpEffect *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:501
static void il_opdmp_lsb(RzILOpPure *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:238
static void il_opdmp_neg(RzILOpPure *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:246
static void il_op_effect_resolve(RzILOpEffect *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:637
RZ_API RZ_OWN char * rz_il_sort_pure_stringify(RzILSortPure sort)
Definition: il_export.c:952
static void il_opdmp_goto(RzILOpEffect *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:441
static void il_opdmp_set(RzILOpEffect *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:421
static void il_opdmp_sub(RzILOpPure *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:258
static void il_opdmp_empty(RzILOpEffect *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:417
static void il_opdmp_bool_and(RzILOpPure *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:207
static void il_opdmp_branch(RzILOpEffect *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:505
static void il_opdmp_nop(RzILOpEffect *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:413
RZ_API void rz_il_op_effect_stringify(RZ_NONNULL RzILOpEffect *op, RZ_NONNULL RzStrBuf *sb)
Definition: il_export.c:711
RZ_API void rz_il_op_pure_stringify(RZ_NONNULL RzILOpPure *op, RZ_NONNULL RzStrBuf *sb)
Definition: il_export.c:701
static void il_opdmp_is_zero(RzILOpPure *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:242
static void il_opdmp_shiftr(RzILOpPure *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:294
static void il_opdmp_mod(RzILOpPure *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:274
static void il_opdmp_var(RzILOpPure *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:145
#define il_op_param_1(name, opx, v0)
Definition: il_export.c:88
static void il_opdmp_div(RzILOpPure *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:266
RZ_API void rz_il_event_stringify(RZ_NONNULL const RzILEvent *evt, RZ_NONNULL RzStrBuf *sb)
Definition: il_export.c:753
static void il_opdmp_eq(RzILOpPure *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:302
static void il_op_pure_resolve(RzILOpPure *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:509
static void il_opdmp_sdiv(RzILOpPure *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:270
static void il_opdmp_seq(RzILOpEffect *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:468
static void il_opdmp_mul(RzILOpPure *op, RzStrBuf *sb, PJ *pj)
Definition: il_export.c:262
static static fork const void static count static fd const char const char static newpath char char char static envp time_t static t const char static mode static whence const char static dir time_t static t unsigned static seconds const char struct utimbuf static buf static inc static sig const char static mode static oldfd struct tms static buf static getgid static geteuid const char static filename static arg static mask struct ustat static ubuf static getppid static setsid static egid sigset_t static set struct timeval struct timezone static tz fd_set fd_set fd_set struct timeval static timeout const char char static bufsiz const char static swapflags void static offset const char static length static mode static who const char struct statfs static buf unsigned unsigned num
Definition: sflib.h:126
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")
char * dst
Definition: lz4.h:724
int x
Definition: mipsasm.c:20
#define rz_warn_if_reached()
Definition: rz_assert.h:29
#define rz_return_if_fail(expr)
Definition: rz_assert.h:100
#define rz_return_val_if_fail(expr, val)
Definition: rz_assert.h:108
RZ_API void rz_bv_free(RZ_NULLABLE RzBitVector *bv)
Definition: bitvector.c:85
RZ_API RZ_OWN char * rz_bv_as_hex_string(RZ_NONNULL RzBitVector *bv, bool pad)
Definition: bitvector.c:121
@ RZ_IL_EVENT_VAR_READ
Definition: rz_il_events.h:23
@ RZ_IL_EVENT_MEM_READ
Definition: rz_il_events.h:22
@ RZ_IL_EVENT_MEM_WRITE
Definition: rz_il_events.h:24
@ RZ_IL_EVENT_EXCEPTION
Definition: rz_il_events.h:20
@ RZ_IL_EVENT_VAR_WRITE
Definition: rz_il_events.h:25
@ RZ_IL_EVENT_PC_WRITE
Definition: rz_il_events.h:21
RzILOpPureCode
@ RZ_IL_OP_SHIFTR
@ RZ_IL_OP_ULE
@ RZ_IL_OP_SUB
@ RZ_IL_OP_LOGNOT
@ RZ_IL_OP_MSB
@ RZ_IL_OP_ITE
@ RZ_IL_OP_PURE_MAX
@ RZ_IL_OP_SLE
@ RZ_IL_OP_LSB
@ RZ_IL_OP_OR
@ RZ_IL_OP_IS_ZERO
@ RZ_IL_OP_NEG
@ RZ_IL_OP_ADD
@ RZ_IL_OP_B0
@ RZ_IL_OP_LET
@ RZ_IL_OP_CAST
@ RZ_IL_OP_MOD
@ RZ_IL_OP_LOGOR
@ RZ_IL_OP_VAR
@ RZ_IL_OP_INV
@ RZ_IL_OP_APPEND
@ RZ_IL_OP_DIV
@ RZ_IL_OP_SHIFTL
@ RZ_IL_OP_EQ
@ RZ_IL_OP_MUL
@ RZ_IL_OP_BITV
@ RZ_IL_OP_B1
@ RZ_IL_OP_XOR
@ RZ_IL_OP_LOAD
@ RZ_IL_OP_AND
@ RZ_IL_OP_SMOD
@ RZ_IL_OP_LOGXOR
@ RZ_IL_OP_SDIV
@ RZ_IL_OP_LOADW
@ RZ_IL_OP_LOGAND
@ RZ_IL_OP_BLK
@ RZ_IL_OP_GOTO
@ RZ_IL_OP_SEQ
@ RZ_IL_OP_NOP
@ RZ_IL_OP_JMP
@ RZ_IL_OP_EMPTY
@ RZ_IL_OP_STORE
@ RZ_IL_OP_STOREW
@ RZ_IL_OP_REPEAT
@ RZ_IL_OP_BRANCH
@ RZ_IL_OP_SET
RZ_API PJ * pj_kb(PJ *j, const char *k, bool v)
Definition: pj.c:177
RZ_API PJ * pj_k(PJ *j, const char *k)
Definition: pj.c:104
RZ_API PJ * pj_end(PJ *j)
Definition: pj.c:87
RZ_API PJ * pj_knull(PJ *j, const char *k)
Definition: pj.c:114
RZ_API PJ * pj_o(PJ *j)
Definition: pj.c:75
RZ_API PJ * pj_ks(PJ *j, const char *k, const char *v)
Definition: pj.c:170
RZ_API PJ * pj_kn(PJ *j, const char *k, ut64 n)
Definition: pj.c:121
RZ_API char * rz_str_newf(const char *fmt,...) RZ_PRINTF_CHECK(1
#define rz_strf(buf,...)
Convenience macro for local temporary strings.
Definition: rz_str.h:59
RZ_API bool rz_strbuf_append(RzStrBuf *sb, const char *s)
Definition: strbuf.c:222
RZ_API bool rz_strbuf_appendf(RzStrBuf *sb, const char *fmt,...) RZ_PRINTF_CHECK(2
#define RZ_OWN
Definition: rz_types.h:62
#define RZ_NONNULL
Definition: rz_types.h:64
@ RZ_IL_TYPE_PURE_BOOL
Definition: sort.h:24
@ RZ_IL_TYPE_PURE_BITVECTOR
Definition: sort.h:25
structure for bitvector
Definition: rz_bitvector.h:19
ut32 len
number of bits – virtual / logical
Definition: rz_bitvector.h:25
Definition: inftree9.h:24
Definition: rz_pj.h:12
value is a bitvector constant.
Definition: rz_il_opcodes.h:51
RzBitVector * value
value of bitvector
Definition: rz_il_opcodes.h:52
op structure for casting bitv
RzILOpBool * fill
If m = size val - length > 0 then m fill-bits are prepended to the most significant part of the vecto...
RzILOpBitVector * val
value to cast
ut32 length
new bits length
op structure for goto (label -> ctrl eff)
const char * lbl
name of the label, const one
op structure for let_ : 'a var -> 'a pure -> 'b pure -> 'b pure
const char * name
name of variable
RzILOpPure * exp
value/expression to bind the variable to
RzILOpPure * body
body in which the variable will be bound and that produces the result
op structure for load (('a, 'b) mem -> 'a bitv -> 'b bitv)
RzILMemIndex mem
index of the mem inside the vm to use
RzILOpBitVector * key
index of the cell (address) in mem, must have exactly the size of a key in the memory
Load an entire word of arbitrary bit size from a memory.
RzILOpBitVector * key
memory index of the RzBitVector key (address)
RzILMemIndex mem
index of the mem inside the vm to use
ut32 n_bits
n of bits to read, and of the resulting bitvector
op structure for Seq ('a eff -> 'a eff -> 'a eff)
RzILOpEffect * y
perform this second
RzILOpEffect * x
perform this first
op structure for set ('a var -> 'a pure -> data eff)
const char * v
name of variable, const one
RzILOpPure * x
value to set the variable to
op structure for store (('a, 'b) mem -> 'a bitv -> 'b bitv -> ('a, 'b) mem)
RzILOpBitVector * value
value to store, must have exactly the size of a memory cell
RzILOpBitVector * key
address where to store to, must have exactly the size of a key in the memory
RzILMemIndex mem
index of memory in the vm to use
op structure for var ('a var -> 'a pure)
const char * v
name of variable, const one
RzILOpEffectCode code
An IL op performing a pure computation, 'a pure.
struct rz_il_sort_pure_t::@283::@284 bv
union rz_il_sort_pure_t::@283 props
RzILTypePure type
Definition: sort.h:29
op structure for blk (label -> data eff -> ctrl eff -> unit eff)
RzILOpEffect * data_eff
index of data_eff
const char * label
name of the label, const one
RzILOpEffect * ctrl_eff
index of ctrl_eff
Definition: dis.c:32
struct op_code code
Definition: dis.c:33