Rizin
unix-like reverse engineering framework and cli tools
analysis_m68k_cs.c
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2015-2018 pancake <pancake@nopcode.org>
2 // SPDX-License-Identifier: LGPL-3.0-only
3 
4 #include <rz_asm.h>
5 #include <rz_lib.h>
6 #include <capstone/capstone.h>
7 
8 #ifdef CAPSTONE_M68K_H
9 #define CAPSTONE_HAS_M68K 1
10 #else
11 #define CAPSTONE_HAS_M68K 0
12 #ifdef _MSC_VER
13 #pragma message("Cannot find capstone-m68k support")
14 #else
15 #warning Cannot find capstone-m68k support
16 #endif
17 #endif
18 
19 #if CAPSTONE_HAS_M68K
20 #include <capstone/m68k.h>
21 // http://www.mrc.uidaho.edu/mrc/people/jff/digital/M68Kir.html
22 
23 #define OPERAND(x) insn->detail->m68k.operands[x]
24 #define REG(x) cs_reg_name(*handle, insn->detail->m68k.operands[x].reg)
25 #define IMM(x) insn->detail->m68k.operands[x].imm
26 #define MEMBASE(x) cs_reg_name(*handle, insn->detail->m68k.operands[x].mem.base)
27 #define MEMINDEX(x) insn->detail->m68k.operands[x].mem.index
28 #define MEMDISP(x) insn->detail->m68k.operands[x].mem.disp
29 
30 static inline ut64 make_64bits_address(ut64 address) {
31  return UT32_MAX & address;
32 }
33 
34 static inline void handle_branch_instruction(RzAnalysisOp *op, ut64 addr, cs_m68k *m68k, ut32 type, int index) {
35 #if CS_API_MAJOR >= 4
36  if (m68k->operands[index].type == M68K_OP_BR_DISP) {
37  op->type = type;
38  // TODO: disp_size is ignored
39  op->jump = make_64bits_address(addr + m68k->operands[index].br_disp.disp + 2);
40  op->fail = make_64bits_address(addr + op->size);
41  }
42 #else
43  op->type = type;
44  // TODO: disp_size is ignored
45  op->jump = make_64bits_address(addr + m68k->operands[index].br_disp.disp + 2);
46  op->fail = make_64bits_address(addr + op->size);
47 #endif
48 }
49 
50 static inline void handle_jump_instruction(RzAnalysisOp *op, ut64 addr, cs_m68k *m68k, ut32 type) {
51  op->type = type;
52 
53  // Handle PC relative mode jump
54  if (m68k->operands[0].address_mode == M68K_AM_PCI_DISP) {
55  op->jump = make_64bits_address(addr + m68k->operands[0].mem.disp + 2);
56  } else {
57  op->jump = make_64bits_address(m68k->operands[0].imm);
58  }
59 
60  op->fail = make_64bits_address(addr + op->size);
61 }
62 
63 static void opex(RzStrBuf *buf, csh handle, cs_insn *insn) {
64  int i;
65  PJ *pj = pj_new();
66  if (!pj) {
67  return;
68  }
69  pj_o(pj);
70  cs_m68k *x = &insn->detail->m68k;
71  pj_ka(pj, "operands");
72  for (i = 0; i < x->op_count; i++) {
73  cs_m68k_op *op = &x->operands[i];
74  pj_o(pj);
75  switch (op->type) {
76  case M68K_OP_REG:
77  pj_ks(pj, "type", "reg");
78  pj_ks(pj, "value", cs_reg_name(handle, op->reg));
79  break;
80  case M68K_OP_IMM:
81  pj_ks(pj, "type", "imm");
82  pj_kN(pj, "value", (st64)op->imm);
83  break;
84  case M68K_OP_MEM:
85  pj_ks(pj, "type", "mem");
86  if (op->mem.base_reg != M68K_REG_INVALID) {
87  pj_ks(pj, "base_reg", cs_reg_name(handle, op->mem.base_reg));
88  }
89  if (op->mem.index_reg != M68K_REG_INVALID) {
90  pj_ks(pj, "index_reg", cs_reg_name(handle, op->mem.index_reg));
91  }
92  if (op->mem.in_base_reg != M68K_REG_INVALID) {
93  pj_ks(pj, "in_base_reg", cs_reg_name(handle, op->mem.in_base_reg));
94  }
95  pj_kN(pj, "in_disp", op->mem.in_disp);
96  pj_kN(pj, "out_disp", op->mem.out_disp);
97  pj_ki(pj, "disp", op->mem.disp);
98  pj_ki(pj, "scale", op->mem.scale);
99  pj_ki(pj, "bitfield", op->mem.bitfield);
100  pj_ki(pj, "width", op->mem.width);
101  pj_ki(pj, "offset", op->mem.offset);
102  pj_ki(pj, "index_size", op->mem.index_size);
103  break;
104  default:
105  pj_ks(pj, "type", "invalid");
106  break;
107  }
108  pj_end(pj); /* o operand */
109  }
110  pj_end(pj); /* a operands */
111  pj_end(pj);
112 
115  pj_free(pj);
116 }
117 
118 static int parse_reg_name(RzRegItem *reg, csh handle, cs_insn *insn, int reg_num) {
119  if (!reg) {
120  return -1;
121  }
122  switch (OPERAND(reg_num).type) {
123  case M68K_OP_REG:
124  reg->name = (char *)cs_reg_name(handle, OPERAND(reg_num).reg);
125  break;
126  case M68K_OP_MEM:
127  if (OPERAND(reg_num).mem.base_reg != M68K_REG_INVALID) {
128  reg->name = (char *)cs_reg_name(handle, OPERAND(reg_num).mem.base_reg);
129  }
130  break;
131  default:
132  break;
133  }
134  return 0;
135 }
136 
137 static void op_fillval(RzAnalysisOp *op, csh handle, cs_insn *insn) {
138  static RzRegItem reg;
139  switch (op->type & RZ_ANALYSIS_OP_TYPE_MASK) {
141  ZERO_FILL(reg);
142  if (OPERAND(1).type == M68K_OP_MEM) {
143  op->src[0] = rz_analysis_value_new();
144  op->src[0]->type = RZ_ANALYSIS_VAL_MEM;
145  op->src[0]->reg = &reg;
146  parse_reg_name(op->src[0]->reg, handle, insn, 1);
147  op->src[0]->delta = OPERAND(0).mem.disp;
148  } else if (OPERAND(0).type == M68K_OP_MEM) {
149  op->dst = rz_analysis_value_new();
150  op->dst->type = RZ_ANALYSIS_VAL_MEM;
151  op->dst->reg = &reg;
152  parse_reg_name(op->dst->reg, handle, insn, 0);
153  op->dst->delta = OPERAND(1).mem.disp;
154  }
155  break;
157  ZERO_FILL(reg);
158  if (OPERAND(1).type == M68K_OP_MEM) {
159  op->dst = rz_analysis_value_new();
160  op->dst->type = RZ_ANALYSIS_VAL_MEM;
161  op->dst->reg = &reg;
162  parse_reg_name(op->dst->reg, handle, insn, 1);
163  op->dst->delta = OPERAND(1).mem.disp;
164  }
165  break;
166  }
167 }
168 
169 static int analop(RzAnalysis *a, RzAnalysisOp *op, ut64 addr, const ut8 *buf, int len, RzAnalysisOpMask mask) {
170  int n, ret, opsize = -1;
171  static csh handle = 0;
172  static int omode = -1;
173  static int obits = 32;
174  cs_insn *insn;
175  cs_m68k *m68k;
176  cs_detail *detail;
177 
178  int mode = a->big_endian ? CS_MODE_BIG_ENDIAN : CS_MODE_LITTLE_ENDIAN;
179 
180  // mode |= (a->bits==64)? CS_MODE_64: CS_MODE_32;
181  if (mode != omode || a->bits != obits) {
182  cs_close(&handle);
183  handle = 0;
184  omode = mode;
185  obits = a->bits;
186  }
187  // XXX no arch->cpu ?!?! CS_MODE_MICRO, N64
188  // replace this with the asm.features?
189  if (a->cpu && strstr(a->cpu, "68000")) {
191  }
192  if (a->cpu && strstr(a->cpu, "68010")) {
194  }
195  if (a->cpu && strstr(a->cpu, "68020")) {
197  }
198  if (a->cpu && strstr(a->cpu, "68030")) {
200  }
201  if (a->cpu && strstr(a->cpu, "68040")) {
203  }
204  if (a->cpu && strstr(a->cpu, "68060")) {
206  }
207  op->size = 4;
208  if (handle == 0) {
209  ret = cs_open(CS_ARCH_M68K, mode, &handle);
210  if (ret != CS_ERR_OK) {
211  goto fin;
212  }
214  }
215  n = cs_disasm(handle, (ut8 *)buf, len, addr, 1, &insn);
216  if (n < 1 || insn->size < 1) {
217  op->type = RZ_ANALYSIS_OP_TYPE_ILL;
218  op->size = 2;
219  opsize = -1;
220  goto beach;
221  }
222  if (!memcmp(buf, "\xff\xff", RZ_MIN(len, 2))) {
223  op->type = RZ_ANALYSIS_OP_TYPE_ILL;
224  op->size = 2;
225  opsize = -1;
226  goto beach;
227  }
228  detail = insn->detail;
229  m68k = &detail->m68k;
230  op->id = insn->id;
231  opsize = op->size = insn->size;
233  opex(&op->opex, handle, insn);
234  }
235  switch (insn->id) {
236  case M68K_INS_INVALID:
237  op->type = RZ_ANALYSIS_OP_TYPE_ILL;
238  break;
239  case M68K_INS_ADD:
240  case M68K_INS_ADDA:
241  case M68K_INS_ADDI:
242  case M68K_INS_ADDQ:
243  case M68K_INS_ADDX:
244  op->type = RZ_ANALYSIS_OP_TYPE_ADD;
245  break;
246  case M68K_INS_AND:
247  case M68K_INS_ANDI:
248  op->type = RZ_ANALYSIS_OP_TYPE_AND;
249  break;
250  case M68K_INS_ASL:
251  op->type = RZ_ANALYSIS_OP_TYPE_SHL;
252  break;
253  case M68K_INS_ASR:
254  op->type = RZ_ANALYSIS_OP_TYPE_SHR;
255  break;
256  case M68K_INS_ABCD:
257  break;
258  case M68K_INS_BHS:
259  case M68K_INS_BLO:
260  case M68K_INS_BHI:
261  case M68K_INS_BLS:
262  case M68K_INS_BCC:
263  case M68K_INS_BCS:
264  case M68K_INS_BNE:
265  case M68K_INS_BEQ:
266  case M68K_INS_BVC:
267  case M68K_INS_BVS:
268  case M68K_INS_BPL:
269  case M68K_INS_BMI:
270  case M68K_INS_BGE:
271  case M68K_INS_BLT:
272  case M68K_INS_BGT:
273  case M68K_INS_BLE:
274  handle_branch_instruction(op, addr, m68k, RZ_ANALYSIS_OP_TYPE_CJMP, 0);
275  break;
276  case M68K_INS_BRA:
277  handle_branch_instruction(op, addr, m68k, RZ_ANALYSIS_OP_TYPE_JMP, 0);
278  break;
279  case M68K_INS_BSR:
280  handle_branch_instruction(op, addr, m68k, RZ_ANALYSIS_OP_TYPE_CALL, 0);
281  break;
282  case M68K_INS_BCHG:
283  case M68K_INS_BCLR:
284  case M68K_INS_BSET:
285  case M68K_INS_BTST:
286  case M68K_INS_BFCHG:
287  case M68K_INS_BFCLR:
288  case M68K_INS_BFEXTS:
289  case M68K_INS_BFEXTU:
290  case M68K_INS_BFFFO:
291  case M68K_INS_BFINS:
292  case M68K_INS_BFSET:
293  case M68K_INS_BFTST:
294  case M68K_INS_BKPT:
295  case M68K_INS_CALLM:
296  case M68K_INS_CAS:
297  case M68K_INS_CAS2:
298  case M68K_INS_CHK:
299  case M68K_INS_CHK2:
300  case M68K_INS_CLR:
301  // TODO:
302  break;
303  case M68K_INS_CMP:
304  case M68K_INS_CMPA:
305  case M68K_INS_CMPI:
306  case M68K_INS_CMPM:
307  case M68K_INS_CMP2:
308  op->type = RZ_ANALYSIS_OP_TYPE_CMP;
309  break;
310  case M68K_INS_CINVL:
311  case M68K_INS_CINVP:
312  case M68K_INS_CINVA:
313  op->type = RZ_ANALYSIS_OP_TYPE_ILL;
314  break;
315  case M68K_INS_CPUSHL:
316  case M68K_INS_CPUSHP:
317  case M68K_INS_CPUSHA:
318  break;
319  case M68K_INS_DBT:
320  case M68K_INS_DBF:
321  case M68K_INS_DBHI:
322  case M68K_INS_DBLS:
323  case M68K_INS_DBCC:
324  case M68K_INS_DBCS:
325  case M68K_INS_DBNE:
326  case M68K_INS_DBEQ:
327  case M68K_INS_DBVC:
328  case M68K_INS_DBVS:
329  case M68K_INS_DBPL:
330  case M68K_INS_DBMI:
331  case M68K_INS_DBGE:
332  case M68K_INS_DBLT:
333  case M68K_INS_DBGT:
334  case M68K_INS_DBLE:
335  case M68K_INS_DBRA:
336  handle_branch_instruction(op, addr, m68k, RZ_ANALYSIS_OP_TYPE_CJMP, 1);
337  break;
338  case M68K_INS_DIVS:
339  case M68K_INS_DIVSL:
340  case M68K_INS_DIVU:
341  case M68K_INS_DIVUL:
342  op->type = RZ_ANALYSIS_OP_TYPE_DIV;
343  break;
344  case M68K_INS_EOR:
345  case M68K_INS_EORI:
346  op->type = RZ_ANALYSIS_OP_TYPE_XOR;
347  break;
348  case M68K_INS_EXG:
349  op->type = RZ_ANALYSIS_OP_TYPE_MOV;
350  break;
351  case M68K_INS_EXT:
352  case M68K_INS_EXTB:
353  break;
354  case M68K_INS_FABS:
355  case M68K_INS_FSABS:
356  case M68K_INS_FDABS:
357  case M68K_INS_FACOS:
358  case M68K_INS_FADD:
359  case M68K_INS_FSADD:
360  case M68K_INS_FDADD:
361  case M68K_INS_FASIN:
362  case M68K_INS_FATAN:
363  case M68K_INS_FATANH:
364  case M68K_INS_FBF:
365  case M68K_INS_FBEQ:
366  case M68K_INS_FBOGT:
367  case M68K_INS_FBOGE:
368  case M68K_INS_FBOLT:
369  case M68K_INS_FBOLE:
370  case M68K_INS_FBOGL:
371  case M68K_INS_FBOR:
372  case M68K_INS_FBUN:
373  case M68K_INS_FBUEQ:
374  case M68K_INS_FBUGT:
375  case M68K_INS_FBUGE:
376  case M68K_INS_FBULT:
377  case M68K_INS_FBULE:
378  case M68K_INS_FBNE:
379  case M68K_INS_FBT:
380  case M68K_INS_FBSF:
381  case M68K_INS_FBSEQ:
382  case M68K_INS_FBGT:
383  case M68K_INS_FBGE:
384  case M68K_INS_FBLT:
385  case M68K_INS_FBLE:
386  case M68K_INS_FBGL:
387  case M68K_INS_FBGLE:
388  case M68K_INS_FBNGLE:
389  case M68K_INS_FBNGL:
390  case M68K_INS_FBNLE:
391  case M68K_INS_FBNLT:
392  case M68K_INS_FBNGE:
393  case M68K_INS_FBNGT:
394  case M68K_INS_FBSNE:
395  case M68K_INS_FBST:
396  case M68K_INS_FCMP:
397  case M68K_INS_FCOS:
398  case M68K_INS_FCOSH:
399  case M68K_INS_FDBF:
400  case M68K_INS_FDBEQ:
401  case M68K_INS_FDBOGT:
402  case M68K_INS_FDBOGE:
403  case M68K_INS_FDBOLT:
404  case M68K_INS_FDBOLE:
405  case M68K_INS_FDBOGL:
406  case M68K_INS_FDBOR:
407  case M68K_INS_FDBUN:
408  case M68K_INS_FDBUEQ:
409  case M68K_INS_FDBUGT:
410  case M68K_INS_FDBUGE:
411  case M68K_INS_FDBULT:
412  case M68K_INS_FDBULE:
413  case M68K_INS_FDBNE:
414  case M68K_INS_FDBT:
415  case M68K_INS_FDBSF:
416  case M68K_INS_FDBSEQ:
417  case M68K_INS_FDBGT:
418  case M68K_INS_FDBGE:
419  case M68K_INS_FDBLT:
420  case M68K_INS_FDBLE:
421  case M68K_INS_FDBGL:
422  case M68K_INS_FDBGLE:
423  case M68K_INS_FDBNGLE:
424  case M68K_INS_FDBNGL:
425  case M68K_INS_FDBNLE:
426  case M68K_INS_FDBNLT:
427  case M68K_INS_FDBNGE:
428  case M68K_INS_FDBNGT:
429  case M68K_INS_FDBSNE:
430  case M68K_INS_FDBST:
431  case M68K_INS_FDIV:
432  case M68K_INS_FSDIV:
433  case M68K_INS_FDDIV:
434  case M68K_INS_FETOX:
435  case M68K_INS_FETOXM1:
436  case M68K_INS_FGETEXP:
437  case M68K_INS_FGETMAN:
438  case M68K_INS_FINT:
439  case M68K_INS_FINTRZ:
440  case M68K_INS_FLOG10:
441  case M68K_INS_FLOG2:
442  case M68K_INS_FLOGN:
443  case M68K_INS_FLOGNP1:
444  case M68K_INS_FMOD:
445  case M68K_INS_FMOVE:
446  case M68K_INS_FSMOVE:
447  case M68K_INS_FDMOVE:
448  case M68K_INS_FMOVECR:
449  case M68K_INS_FMOVEM:
450  case M68K_INS_FMUL:
451  case M68K_INS_FSMUL:
452  case M68K_INS_FDMUL:
453  case M68K_INS_FNEG:
454  case M68K_INS_FSNEG:
455  case M68K_INS_FDNEG:
456  case M68K_INS_FNOP:
457  case M68K_INS_FREM:
458  case M68K_INS_FRESTORE:
459  case M68K_INS_FSAVE:
460  case M68K_INS_FSCALE:
461  case M68K_INS_FSGLDIV:
462  case M68K_INS_FSGLMUL:
463  case M68K_INS_FSIN:
464  case M68K_INS_FSINCOS:
465  case M68K_INS_FSINH:
466  case M68K_INS_FSQRT:
467  case M68K_INS_FSSQRT:
468  case M68K_INS_FDSQRT:
469  case M68K_INS_FSF:
470  case M68K_INS_FSBEQ:
471  case M68K_INS_FSOGT:
472  case M68K_INS_FSOGE:
473  case M68K_INS_FSOLT:
474  case M68K_INS_FSOLE:
475  case M68K_INS_FSOGL:
476  case M68K_INS_FSOR:
477  case M68K_INS_FSUN:
478  case M68K_INS_FSUEQ:
479  case M68K_INS_FSUGT:
480  case M68K_INS_FSUGE:
481  case M68K_INS_FSULT:
482  case M68K_INS_FSULE:
483  case M68K_INS_FSNE:
484  case M68K_INS_FST:
485  case M68K_INS_FSSF:
486  case M68K_INS_FSSEQ:
487  case M68K_INS_FSGT:
488  case M68K_INS_FSGE:
489  case M68K_INS_FSLT:
490  case M68K_INS_FSLE:
491  case M68K_INS_FSGL:
492  case M68K_INS_FSGLE:
493  case M68K_INS_FSNGLE:
494  case M68K_INS_FSNGL:
495  case M68K_INS_FSNLE:
496  case M68K_INS_FSNLT:
497  case M68K_INS_FSNGE:
498  case M68K_INS_FSNGT:
499  case M68K_INS_FSSNE:
500  case M68K_INS_FSST:
501  case M68K_INS_FSUB:
502  case M68K_INS_FSSUB:
503  case M68K_INS_FDSUB:
504  case M68K_INS_FTAN:
505  case M68K_INS_FTANH:
506  case M68K_INS_FTENTOX:
507  case M68K_INS_FTRAPF:
508  case M68K_INS_FTRAPEQ:
509  case M68K_INS_FTRAPOGT:
510  case M68K_INS_FTRAPOGE:
511  case M68K_INS_FTRAPOLT:
512  case M68K_INS_FTRAPOLE:
513  case M68K_INS_FTRAPOGL:
514  case M68K_INS_FTRAPOR:
515  case M68K_INS_FTRAPUN:
516  case M68K_INS_FTRAPUEQ:
517  case M68K_INS_FTRAPUGT:
518  case M68K_INS_FTRAPUGE:
519  case M68K_INS_FTRAPULT:
520  case M68K_INS_FTRAPULE:
521  case M68K_INS_FTRAPNE:
522  case M68K_INS_FTRAPT:
523  case M68K_INS_FTRAPSF:
524  case M68K_INS_FTRAPSEQ:
525  case M68K_INS_FTRAPGT:
526  case M68K_INS_FTRAPGE:
527  case M68K_INS_FTRAPLT:
528  case M68K_INS_FTRAPLE:
529  case M68K_INS_FTRAPGL:
530  case M68K_INS_FTRAPGLE:
531  case M68K_INS_FTRAPNGLE:
532  case M68K_INS_FTRAPNGL:
533  case M68K_INS_FTRAPNLE:
534  case M68K_INS_FTRAPNLT:
535  case M68K_INS_FTRAPNGE:
536  case M68K_INS_FTRAPNGT:
537  case M68K_INS_FTRAPSNE:
538  case M68K_INS_FTRAPST:
539  case M68K_INS_FTST:
540  case M68K_INS_FTWOTOX:
541  op->type = RZ_ANALYSIS_OP_TYPE_UNK;
542  op->family = RZ_ANALYSIS_OP_FAMILY_FPU;
543  break;
544  case M68K_INS_HALT:
545  op->type = RZ_ANALYSIS_OP_TYPE_NOP;
546  break;
547  case M68K_INS_ILLEGAL:
548  op->type = RZ_ANALYSIS_OP_TYPE_ILL;
549  break;
550  case M68K_INS_JMP:
551  handle_jump_instruction(op, addr, m68k, RZ_ANALYSIS_OP_TYPE_JMP);
552  break;
553  case M68K_INS_JSR:
554  handle_jump_instruction(op, addr, m68k, RZ_ANALYSIS_OP_TYPE_CALL);
555  break;
556  case M68K_INS_LPSTOP:
557  op->type = RZ_ANALYSIS_OP_TYPE_NOP;
558  break;
559  case M68K_INS_LSL:
560  op->type = RZ_ANALYSIS_OP_TYPE_SHL;
561  break;
562  case M68K_INS_LINK:
564  op->stackop = RZ_ANALYSIS_STACK_INC;
565  op->stackptr = -(st16)IMM(1);
566  break;
567  case M68K_INS_LSR:
568  op->type = RZ_ANALYSIS_OP_TYPE_SHR;
569  break;
570  case M68K_INS_PEA:
571  case M68K_INS_LEA:
572  op->type = RZ_ANALYSIS_OP_TYPE_LEA;
573  break;
574  case M68K_INS_MOVE:
575  case M68K_INS_MOVEA:
576  case M68K_INS_MOVEC:
577  case M68K_INS_MOVEM:
578  case M68K_INS_MOVEP:
579  case M68K_INS_MOVEQ:
580  case M68K_INS_MOVES:
581  case M68K_INS_MOVE16:
582  op->type = RZ_ANALYSIS_OP_TYPE_MOV;
583  break;
584  case M68K_INS_MULS:
585  case M68K_INS_MULU:
586  op->type = RZ_ANALYSIS_OP_TYPE_MUL;
587  break;
588  case M68K_INS_NBCD:
589  case M68K_INS_NEG:
590  case M68K_INS_NEGX:
591  break;
592  case M68K_INS_NOP:
593  op->type = RZ_ANALYSIS_OP_TYPE_NOP;
594  break;
595  case M68K_INS_NOT:
596  op->type = RZ_ANALYSIS_OP_TYPE_NOT;
597  break;
598  case M68K_INS_OR:
599  case M68K_INS_ORI:
600  op->type = RZ_ANALYSIS_OP_TYPE_OR;
601  break;
602  case M68K_INS_PACK:
603  case M68K_INS_PFLUSH:
604  case M68K_INS_PFLUSHA:
605  case M68K_INS_PFLUSHAN:
606  case M68K_INS_PFLUSHN:
607  case M68K_INS_PLOADR:
608  case M68K_INS_PLOADW:
609  case M68K_INS_PLPAR:
610  case M68K_INS_PLPAW:
611  case M68K_INS_PMOVE:
612  case M68K_INS_PMOVEFD:
613  case M68K_INS_PTESTR:
614  case M68K_INS_PTESTW:
615  case M68K_INS_PULSE:
616  case M68K_INS_REMS:
617  case M68K_INS_REMU:
618  case M68K_INS_RESET:
619  break;
620  case M68K_INS_ROL:
621  op->type = RZ_ANALYSIS_OP_TYPE_ROL;
622  break;
623  case M68K_INS_ROR:
624  op->type = RZ_ANALYSIS_OP_TYPE_ROR;
625  break;
626  case M68K_INS_ROXL:
627  case M68K_INS_ROXR:
628  break;
629  case M68K_INS_RTD:
630  case M68K_INS_RTE:
631  case M68K_INS_RTM:
632  case M68K_INS_RTR:
633  case M68K_INS_RTS:
634  op->type = RZ_ANALYSIS_OP_TYPE_RET;
635  break;
636  case M68K_INS_SBCD:
637  case M68K_INS_ST:
638  case M68K_INS_SF:
639  case M68K_INS_SHI:
640  case M68K_INS_SLS:
641  case M68K_INS_SCC:
642  case M68K_INS_SHS:
643  case M68K_INS_SCS:
644  case M68K_INS_SLO:
645  case M68K_INS_SNE:
646  case M68K_INS_SEQ:
647  case M68K_INS_SVC:
648  case M68K_INS_SVS:
649  case M68K_INS_SPL:
650  case M68K_INS_SMI:
651  case M68K_INS_SGE:
652  case M68K_INS_SLT:
653  case M68K_INS_SGT:
654  case M68K_INS_SLE:
655  case M68K_INS_STOP:
656  break;
657  case M68K_INS_SUB:
658  case M68K_INS_SUBA:
659  case M68K_INS_SUBI:
660  case M68K_INS_SUBQ:
661  case M68K_INS_SUBX:
662  op->type = RZ_ANALYSIS_OP_TYPE_SUB;
663  break;
664  case M68K_INS_SWAP:
665  op->type = RZ_ANALYSIS_OP_TYPE_MOV;
666  break;
667  case M68K_INS_TAS:
668  break;
669  case M68K_INS_TRAP:
670  case M68K_INS_TRAPV:
671  case M68K_INS_TRAPT:
672  case M68K_INS_TRAPF:
673  case M68K_INS_TRAPHI:
674  case M68K_INS_TRAPLS:
675  case M68K_INS_TRAPCC:
676  case M68K_INS_TRAPHS:
677  case M68K_INS_TRAPCS:
678  case M68K_INS_TRAPLO:
679  case M68K_INS_TRAPNE:
680  case M68K_INS_TRAPEQ:
681  case M68K_INS_TRAPVC:
682  case M68K_INS_TRAPVS:
683  case M68K_INS_TRAPPL:
684  case M68K_INS_TRAPMI:
685  case M68K_INS_TRAPGE:
686  case M68K_INS_TRAPLT:
687  case M68K_INS_TRAPGT:
688  case M68K_INS_TRAPLE:
690  break;
691  case M68K_INS_TST:
692  op->type = RZ_ANALYSIS_OP_TYPE_CMP;
693  break;
694  case M68K_INS_UNPK: // unpack BCD
695  op->type = RZ_ANALYSIS_OP_TYPE_MOV;
696  break;
697  case M68K_INS_UNLK:
698  op->type = RZ_ANALYSIS_OP_TYPE_POP;
699  // reset stackframe
700  op->stackop = RZ_ANALYSIS_STACK_SET;
701  op->stackptr = 0;
702  break;
703  }
705  op_fillval(op, handle, insn);
706  }
707 beach:
708  cs_free(insn, n);
709  // cs_close (&handle);
710 fin:
711  return opsize;
712 }
713 
714 static char *get_reg_profile(RzAnalysis *analysis) {
715  const char *p =
716  "=PC pc\n"
717  "=SP a7\n"
718  "=BP a6\n"
719  "=A0 a0\n"
720  "=A1 a1\n"
721  "=A2 a2\n"
722  "=A3 a3\n"
723  "gpr d0 .32 0 0\n"
724  "gpr d1 .32 4 0\n"
725  "gpr d2 .32 8 0\n"
726  "gpr d3 .32 12 0\n"
727  "gpr d4 .32 16 0\n"
728  "gpr d5 .32 20 0\n"
729  "gpr d6 .32 24 0\n"
730  "gpr d7 .32 28 0\n"
731  "gpr a0 .32 32 0\n"
732  "gpr a1 .32 36 0\n"
733  "gpr a2 .32 40 0\n"
734  "gpr a3 .32 44 0\n"
735  "gpr a4 .32 48 0\n"
736  "gpr a5 .32 52 0\n"
737  "gpr a6 .32 56 0\n"
738  "gpr a7 .32 60 0\n"
739  "gpr fp0 .32 64 0\n" // FPU register 0, 96bits to write and read max
740  "gpr fp1 .32 68 0\n" // FPU register 1, 96bits to write and read max
741  "gpr fp2 .32 72 0\n" // FPU register 2, 96bits to write and read max
742  "gpr fp3 .32 76 0\n" // FPU register 3, 96bits to write and read max
743  "gpr fp4 .32 80 0\n" // FPU register 4, 96bits to write and read max
744  "gpr fp5 .32 84 0\n" // FPU register 5, 96bits to write and read max
745  "gpr fp6 .32 88 0\n" // FPU register 6, 96bits to write and read max
746  "gpr fp7 .32 92 0\n" // FPU register 7, 96bits to write and read max
747  "gpr pc .32 96 0\n"
748  "gpr sr .32 100 0\n" // only available for read and write access during supervisor mode 16bit
749  "gpr ccr .32 104 0\n" // subset of the SR, available from any mode
750  "gpr sfc .32 108 0\n" // source function code register
751  "gpr dfc .32 112 0\n" // destination function code register
752  "gpr usp .32 116 0\n" // user stack point this is an shadow register of A7 user mode, SR bit 0xD is 0
753  "gpr vbr .32 120 0\n" // vector base register, this is a Address pointer
754  "gpr cacr .32 124 0\n" // cache control register, implementation specific
755  "gpr caar .32 128 0\n" // cache address register, 68020, 68EC020, 68030 and 68EC030 only.
756  "gpr msp .32 132 0\n" // master stack pointer, this is an shadow register of A7 supervisor mode, SR bits 0xD && 0xC are set
757  "gpr isp .32 136 0\n" // interrupt stack pointer, this is an shadow register of A7 supervisor mode, SR bit 0xD is set, 0xC is not.
758  "gpr tc .32 140 0\n"
759  "gpr itt0 .32 144 0\n" // in 68EC040 this is IACR0
760  "gpr itt1 .32 148 0\n" // in 68EC040 this is IACR1
761  "gpr dtt0 .32 156 0\n" // in 68EC040 this is DACR0
762  "gpr dtt1 .32 160 0\n" // in 68EC040 this is DACR1
763  "gpr mmusr .32 164 0\n"
764  "gpr urp .32 168 0\n"
765  "gpr srp .32 172 0\n"
766  "gpr fpcr .32 176 0\n"
767  "gpr fpsr .32 180 0\n"
768  "gpr fpiar .32 184 0\n";
769  return strdup(p);
770 }
771 
773  .name = "m68k",
774  .desc = "Capstone M68K analyzer",
775  .license = "BSD",
776  .esil = false,
777  .arch = "m68k",
778  .get_reg_profile = &get_reg_profile,
779  .bits = 32,
780  .op = &analop,
781 };
782 #else
784  .name = "m68k (unsupported)",
785  .desc = "Capstone M68K analyzer (unsupported)",
786  .license = "BSD",
787  .arch = "m68k",
788  .bits = 32,
789 };
790 #endif
791 
792 #ifndef RZ_PLUGIN_INCORE
797 };
798 #endif
size_t len
Definition: 6502dis.c:15
RZ_API RzAnalysisValue * rz_analysis_value_new(void)
Definition: value.c:6
static int analop(RzAnalysis *a, RzAnalysisOp *op, ut64 addr, const ut8 *buf, int len, RzAnalysisOpMask mask)
static void op_fillval(RzAnalysis *analysis, RzAnalysisOp *op, csh handle, cs_insn *insn, int bits)
static void opex(RzStrBuf *buf, csh handle, cs_insn *insn)
static int parse_reg_name(RzReg *reg, RzRegItem **reg_base, RzRegItem **reg_delta, csh handle, cs_insn *insn, int reg_num)
#define mask()
RZ_API char * get_reg_profile(RzAnalysis *analysis)
RzAnalysisPlugin rz_analysis_plugin_m68k_cs
RZ_API RzLibStruct rizin_plugin
#define OPERAND(x)
lzma_index ** i
Definition: index.h:629
#define IMM(x)
static mcore_handle handle
Definition: asm_mcore.c:8
@ CS_ARCH_M68K
68K architecture
Definition: capstone.h:83
@ CS_MODE_M68K_040
M68K 68040 mode.
Definition: capstone.h:121
@ CS_MODE_M68K_000
M68K 68000 mode.
Definition: capstone.h:117
@ CS_MODE_M68K_060
M68K 68060 mode.
Definition: capstone.h:122
@ CS_MODE_M68K_010
M68K 68010 mode.
Definition: capstone.h:118
@ CS_MODE_BIG_ENDIAN
big-endian mode
Definition: capstone.h:123
@ CS_MODE_M68K_020
M68K 68020 mode.
Definition: capstone.h:119
@ CS_MODE_M68K_030
M68K 68030 mode.
Definition: capstone.h:120
@ CS_MODE_LITTLE_ENDIAN
little-endian mode (default mode)
Definition: capstone.h:103
@ CS_OPT_DETAIL
Break down instruction structure into details.
Definition: capstone.h:171
size_t csh
Definition: capstone.h:71
@ CS_OPT_ON
Turn ON an option (CS_OPT_DETAIL, CS_OPT_SKIPDATA).
Definition: capstone.h:183
#define RZ_API
CAPSTONE_EXPORT size_t CAPSTONE_API cs_disasm(csh ud, const uint8_t *buffer, size_t size, uint64_t offset, size_t count, cs_insn **insn)
Definition: cs.c:798
CAPSTONE_EXPORT cs_err CAPSTONE_API cs_open(cs_arch arch, cs_mode mode, csh *handle)
Definition: cs.c:453
CAPSTONE_EXPORT void CAPSTONE_API cs_free(cs_insn *insn, size_t count)
Definition: cs.c:1017
CAPSTONE_EXPORT const char *CAPSTONE_API cs_reg_name(csh ud, unsigned int reg)
Definition: cs.c:1154
CAPSTONE_EXPORT cs_err CAPSTONE_API cs_close(csh *handle)
Definition: cs.c:501
CAPSTONE_EXPORT cs_err CAPSTONE_API cs_option(csh ud, cs_opt_type type, size_t value)
Definition: cs.c:646
uint32_t ut32
voidpf void uLong size
Definition: ioapi.h:138
const char int mode
Definition: ioapi.h:137
voidpf void * buf
Definition: ioapi.h:138
#define reg(n)
uint8_t ut8
Definition: lh5801.h:11
void * p
Definition: libc.cpp:67
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")
@ M68K_AM_PCI_DISP
Program Counter Indirect - with Displacement.
Definition: m68k.h:96
@ M68K_OP_BR_DISP
Branch displacement.
Definition: m68k.h:121
@ M68K_OP_IMM
= CS_OP_IMM (Immediate operand).
Definition: m68k.h:115
@ M68K_OP_REG
= CS_OP_REG (Register operand).
Definition: m68k.h:114
@ M68K_OP_MEM
= CS_OP_MEM (Memory operand).
Definition: m68k.h:116
@ M68K_INS_SUBQ
Definition: m68k.h:568
@ M68K_INS_FDBGE
Definition: m68k.h:369
@ M68K_INS_BFSET
Definition: m68k.h:259
@ M68K_INS_NOP
Definition: m68k.h:514
@ M68K_INS_FBNGL
Definition: m68k.h:340
@ M68K_INS_FDSQRT
Definition: m68k.h:419
@ M68K_INS_FSUGE
Definition: m68k.h:431
@ M68K_INS_SHS
Definition: m68k.h:551
@ M68K_INS_FDSUB
Definition: m68k.h:454
@ M68K_INS_FTRAPST
Definition: m68k.h:489
@ M68K_INS_FGETMAN
Definition: m68k.h:388
@ M68K_INS_FCOS
Definition: m68k.h:348
@ M68K_INS_FBUEQ
Definition: m68k.h:324
@ M68K_INS_DBLS
Definition: m68k.h:282
@ M68K_INS_FTRAPOGL
Definition: m68k.h:464
@ M68K_INS_BGE
Definition: m68k.h:243
@ M68K_INS_BFEXTU
Definition: m68k.h:256
@ M68K_INS_ADDQ
Definition: m68k.h:225
@ M68K_INS_RTR
Definition: m68k.h:543
@ M68K_INS_SUBX
Definition: m68k.h:569
@ M68K_INS_FBOGL
Definition: m68k.h:321
@ M68K_INS_CINVL
Definition: m68k.h:273
@ M68K_INS_ORI
Definition: m68k.h:517
@ M68K_INS_BFCHG
Definition: m68k.h:253
@ M68K_INS_FTANH
Definition: m68k.h:456
@ M68K_INS_OR
Definition: m68k.h:516
@ M68K_INS_TRAPNE
Definition: m68k.h:582
@ M68K_INS_FTRAPLE
Definition: m68k.h:479
@ M68K_INS_FBUGT
Definition: m68k.h:325
@ M68K_INS_FTRAPUN
Definition: m68k.h:466
@ M68K_INS_ROXL
Definition: m68k.h:538
@ M68K_INS_BLE
Definition: m68k.h:246
@ M68K_INS_INVALID
Definition: m68k.h:219
@ M68K_INS_FBNLT
Definition: m68k.h:342
@ M68K_INS_FBGL
Definition: m68k.h:337
@ M68K_INS_FLOGN
Definition: m68k.h:393
@ M68K_INS_SVS
Definition: m68k.h:557
@ M68K_INS_TRAPMI
Definition: m68k.h:587
@ M68K_INS_FATAN
Definition: m68k.h:313
@ M68K_INS_FBGT
Definition: m68k.h:333
@ M68K_INS_LEA
Definition: m68k.h:496
@ M68K_INS_FSSNE
Definition: m68k.h:450
@ M68K_INS_FTRAPNGL
Definition: m68k.h:483
@ M68K_INS_FINTRZ
Definition: m68k.h:390
@ M68K_INS_FSOR
Definition: m68k.h:427
@ M68K_INS_SPL
Definition: m68k.h:558
@ M68K_INS_FETOX
Definition: m68k.h:385
@ M68K_INS_RTM
Definition: m68k.h:542
@ M68K_INS_FTAN
Definition: m68k.h:455
@ M68K_INS_CMPI
Definition: m68k.h:270
@ M68K_INS_JSR
Definition: m68k.h:495
@ M68K_INS_MULS
Definition: m68k.h:509
@ M68K_INS_FLOGNP1
Definition: m68k.h:394
@ M68K_INS_DBGT
Definition: m68k.h:293
@ M68K_INS_FSULT
Definition: m68k.h:432
@ M68K_INS_FST
Definition: m68k.h:435
@ M68K_INS_BSET
Definition: m68k.h:251
@ M68K_INS_SVC
Definition: m68k.h:556
@ M68K_INS_MOVEQ
Definition: m68k.h:506
@ M68K_INS_EXG
Definition: m68k.h:302
@ M68K_INS_TRAPCC
Definition: m68k.h:578
@ M68K_INS_FBNLE
Definition: m68k.h:341
@ M68K_INS_FDBUGT
Definition: m68k.h:360
@ M68K_INS_DBF
Definition: m68k.h:280
@ M68K_INS_BPL
Definition: m68k.h:241
@ M68K_INS_FTRAPNGE
Definition: m68k.h:486
@ M68K_INS_DBEQ
Definition: m68k.h:286
@ M68K_INS_FDBNE
Definition: m68k.h:364
@ M68K_INS_BSR
Definition: m68k.h:248
@ M68K_INS_FTRAPNLT
Definition: m68k.h:485
@ M68K_INS_FSSQRT
Definition: m68k.h:418
@ M68K_INS_PLPAW
Definition: m68k.h:527
@ M68K_INS_PACK
Definition: m68k.h:518
@ M68K_INS_FDBGL
Definition: m68k.h:372
@ M68K_INS_FINT
Definition: m68k.h:389
@ M68K_INS_LSL
Definition: m68k.h:499
@ M68K_INS_BCLR
Definition: m68k.h:250
@ M68K_INS_FTRAPOGE
Definition: m68k.h:461
@ M68K_INS_FDABS
Definition: m68k.h:307
@ M68K_INS_RTS
Definition: m68k.h:544
@ M68K_INS_FMOD
Definition: m68k.h:395
@ M68K_INS_TRAPGT
Definition: m68k.h:590
@ M68K_INS_TRAPEQ
Definition: m68k.h:583
@ M68K_INS_PLOADW
Definition: m68k.h:525
@ M68K_INS_FCOSH
Definition: m68k.h:349
@ M68K_INS_MOVES
Definition: m68k.h:507
@ M68K_INS_FSNGE
Definition: m68k.h:448
@ M68K_INS_FDBOGL
Definition: m68k.h:356
@ M68K_INS_FSADD
Definition: m68k.h:310
@ M68K_INS_FSGT
Definition: m68k.h:438
@ M68K_INS_BMI
Definition: m68k.h:242
@ M68K_INS_SUB
Definition: m68k.h:565
@ M68K_INS_FCMP
Definition: m68k.h:347
@ M68K_INS_FDBUEQ
Definition: m68k.h:359
@ M68K_INS_FTST
Definition: m68k.h:490
@ M68K_INS_FTRAPNLE
Definition: m68k.h:484
@ M68K_INS_FSGL
Definition: m68k.h:442
@ M68K_INS_TST
Definition: m68k.h:592
@ M68K_INS_LSR
Definition: m68k.h:500
@ M68K_INS_PULSE
Definition: m68k.h:532
@ M68K_INS_FSDIV
Definition: m68k.h:383
@ M68K_INS_FDBLE
Definition: m68k.h:371
@ M68K_INS_FBNE
Definition: m68k.h:329
@ M68K_INS_ADDI
Definition: m68k.h:224
@ M68K_INS_FDBGT
Definition: m68k.h:368
@ M68K_INS_FSUB
Definition: m68k.h:452
@ M68K_INS_FSF
Definition: m68k.h:420
@ M68K_INS_SUBI
Definition: m68k.h:567
@ M68K_INS_FDBUGE
Definition: m68k.h:361
@ M68K_INS_BFEXTS
Definition: m68k.h:255
@ M68K_INS_TRAPF
Definition: m68k.h:575
@ M68K_INS_SGT
Definition: m68k.h:562
@ M68K_INS_FSINH
Definition: m68k.h:416
@ M68K_INS_FABS
Definition: m68k.h:305
@ M68K_INS_BNE
Definition: m68k.h:237
@ M68K_INS_FSNEG
Definition: m68k.h:405
@ M68K_INS_FDBGLE
Definition: m68k.h:373
@ M68K_INS_BFFFO
Definition: m68k.h:257
@ M68K_INS_BTST
Definition: m68k.h:252
@ M68K_INS_FADD
Definition: m68k.h:309
@ M68K_INS_FSULE
Definition: m68k.h:433
@ M68K_INS_DBGE
Definition: m68k.h:291
@ M68K_INS_FETOXM1
Definition: m68k.h:386
@ M68K_INS_FMOVECR
Definition: m68k.h:399
@ M68K_INS_ROXR
Definition: m68k.h:539
@ M68K_INS_TRAPLT
Definition: m68k.h:589
@ M68K_INS_PLPAR
Definition: m68k.h:526
@ M68K_INS_PTESTR
Definition: m68k.h:530
@ M68K_INS_FSOLE
Definition: m68k.h:425
@ M68K_INS_FSMOVE
Definition: m68k.h:397
@ M68K_INS_LPSTOP
Definition: m68k.h:498
@ M68K_INS_PFLUSHAN
Definition: m68k.h:522
@ M68K_INS_TRAPLS
Definition: m68k.h:577
@ M68K_INS_RESET
Definition: m68k.h:535
@ M68K_INS_DIVU
Definition: m68k.h:298
@ M68K_INS_FMUL
Definition: m68k.h:401
@ M68K_INS_FDBOR
Definition: m68k.h:357
@ M68K_INS_SF
Definition: m68k.h:547
@ M68K_INS_FDBLT
Definition: m68k.h:370
@ M68K_INS_BFCLR
Definition: m68k.h:254
@ M68K_INS_FBOLE
Definition: m68k.h:320
@ M68K_INS_FTRAPNE
Definition: m68k.h:472
@ M68K_INS_HALT
Definition: m68k.h:492
@ M68K_INS_TAS
Definition: m68k.h:571
@ M68K_INS_CAS2
Definition: m68k.h:264
@ M68K_INS_FBSEQ
Definition: m68k.h:332
@ M68K_INS_FDBNGLE
Definition: m68k.h:374
@ M68K_INS_CINVA
Definition: m68k.h:275
@ M68K_INS_FTRAPGLE
Definition: m68k.h:481
@ M68K_INS_FTRAPNGLE
Definition: m68k.h:482
@ M68K_INS_DBVC
Definition: m68k.h:287
@ M68K_INS_TRAPLO
Definition: m68k.h:581
@ M68K_INS_FTRAPOLT
Definition: m68k.h:462
@ M68K_INS_PMOVEFD
Definition: m68k.h:529
@ M68K_INS_STOP
Definition: m68k.h:564
@ M68K_INS_FMOVEM
Definition: m68k.h:400
@ M68K_INS_FBGE
Definition: m68k.h:334
@ M68K_INS_FDBNGL
Definition: m68k.h:375
@ M68K_INS_MOVE
Definition: m68k.h:501
@ M68K_INS_PTESTW
Definition: m68k.h:531
@ M68K_INS_FNOP
Definition: m68k.h:407
@ M68K_INS_FSGLE
Definition: m68k.h:443
@ M68K_INS_SLO
Definition: m68k.h:553
@ M68K_INS_FSCALE
Definition: m68k.h:411
@ M68K_INS_FDBOLE
Definition: m68k.h:355
@ M68K_INS_DBNE
Definition: m68k.h:285
@ M68K_INS_FBNGLE
Definition: m68k.h:339
@ M68K_INS_LINK
Definition: m68k.h:497
@ M68K_INS_TRAPHS
Definition: m68k.h:579
@ M68K_INS_FDBOLT
Definition: m68k.h:354
@ M68K_INS_FSMUL
Definition: m68k.h:402
@ M68K_INS_FDBNLE
Definition: m68k.h:376
@ M68K_INS_FSUN
Definition: m68k.h:428
@ M68K_INS_ASR
Definition: m68k.h:230
@ M68K_INS_FTRAPGT
Definition: m68k.h:476
@ M68K_INS_FDBNLT
Definition: m68k.h:377
@ M68K_INS_PEA
Definition: m68k.h:519
@ M68K_INS_DBCC
Definition: m68k.h:283
@ M68K_INS_SHI
Definition: m68k.h:548
@ M68K_INS_BFINS
Definition: m68k.h:258
@ M68K_INS_FSQRT
Definition: m68k.h:417
@ M68K_INS_SLT
Definition: m68k.h:561
@ M68K_INS_FTRAPSF
Definition: m68k.h:474
@ M68K_INS_CINVP
Definition: m68k.h:274
@ M68K_INS_ANDI
Definition: m68k.h:228
@ M68K_INS_CMP2
Definition: m68k.h:272
@ M68K_INS_FMOVE
Definition: m68k.h:396
@ M68K_INS_FLOG10
Definition: m68k.h:391
@ M68K_INS_FSGLMUL
Definition: m68k.h:413
@ M68K_INS_FSNGL
Definition: m68k.h:445
@ M68K_INS_PMOVE
Definition: m68k.h:528
@ M68K_INS_DBCS
Definition: m68k.h:284
@ M68K_INS_BEQ
Definition: m68k.h:238
@ M68K_INS_BCS
Definition: m68k.h:236
@ M68K_INS_CPUSHP
Definition: m68k.h:277
@ M68K_INS_CAS
Definition: m68k.h:263
@ M68K_INS_FTRAPNGT
Definition: m68k.h:487
@ M68K_INS_FDBOGE
Definition: m68k.h:353
@ M68K_INS_CPUSHA
Definition: m68k.h:278
@ M68K_INS_FBLT
Definition: m68k.h:335
@ M68K_INS_FDNEG
Definition: m68k.h:406
@ M68K_INS_TRAP
Definition: m68k.h:572
@ M68K_INS_ST
Definition: m68k.h:546
@ M68K_INS_CMPM
Definition: m68k.h:271
@ M68K_INS_FSOGT
Definition: m68k.h:422
@ M68K_INS_FREM
Definition: m68k.h:408
@ M68K_INS_BCC
Definition: m68k.h:235
@ M68K_INS_CHK2
Definition: m68k.h:266
@ M68K_INS_FBOGT
Definition: m68k.h:317
@ M68K_INS_FBOLT
Definition: m68k.h:319
@ M68K_INS_FATANH
Definition: m68k.h:314
@ M68K_INS_PFLUSHA
Definition: m68k.h:521
@ M68K_INS_FGETEXP
Definition: m68k.h:387
@ M68K_INS_EOR
Definition: m68k.h:300
@ M68K_INS_FTENTOX
Definition: m68k.h:457
@ M68K_INS_PFLUSH
Definition: m68k.h:520
@ M68K_INS_FBUN
Definition: m68k.h:323
@ M68K_INS_FDBT
Definition: m68k.h:365
@ M68K_INS_DBMI
Definition: m68k.h:290
@ M68K_INS_FSOGL
Definition: m68k.h:426
@ M68K_INS_EXT
Definition: m68k.h:303
@ M68K_INS_ROR
Definition: m68k.h:537
@ M68K_INS_FTRAPF
Definition: m68k.h:458
@ M68K_INS_CPUSHL
Definition: m68k.h:276
@ M68K_INS_FDBNGE
Definition: m68k.h:378
@ M68K_INS_FDBSNE
Definition: m68k.h:380
@ M68K_INS_FDBULE
Definition: m68k.h:363
@ M68K_INS_JMP
Definition: m68k.h:494
@ M68K_INS_FACOS
Definition: m68k.h:308
@ M68K_INS_FSNE
Definition: m68k.h:434
@ M68K_INS_ROL
Definition: m68k.h:536
@ M68K_INS_FTRAPT
Definition: m68k.h:473
@ M68K_INS_TRAPHI
Definition: m68k.h:576
@ M68K_INS_RTE
Definition: m68k.h:541
@ M68K_INS_FSSUB
Definition: m68k.h:453
@ M68K_INS_FDBULT
Definition: m68k.h:362
@ M68K_INS_CLR
Definition: m68k.h:267
@ M68K_INS_BVC
Definition: m68k.h:239
@ M68K_INS_FBOR
Definition: m68k.h:322
@ M68K_INS_ADDA
Definition: m68k.h:223
@ M68K_INS_CMP
Definition: m68k.h:268
@ M68K_INS_SBCD
Definition: m68k.h:545
@ M68K_INS_BHI
Definition: m68k.h:233
@ M68K_INS_FTRAPUEQ
Definition: m68k.h:467
@ M68K_INS_DBVS
Definition: m68k.h:288
@ M68K_INS_MOVEC
Definition: m68k.h:503
@ M68K_INS_FLOG2
Definition: m68k.h:392
@ M68K_INS_SCC
Definition: m68k.h:550
@ M68K_INS_FTRAPGL
Definition: m68k.h:480
@ M68K_INS_FSGLDIV
Definition: m68k.h:412
@ M68K_INS_FDDIV
Definition: m68k.h:384
@ M68K_INS_SNE
Definition: m68k.h:554
@ M68K_INS_MOVEP
Definition: m68k.h:505
@ M68K_INS_TRAPGE
Definition: m68k.h:588
@ M68K_INS_TRAPPL
Definition: m68k.h:586
@ M68K_INS_FDBST
Definition: m68k.h:381
@ M68K_INS_FBLE
Definition: m68k.h:336
@ M68K_INS_BVS
Definition: m68k.h:240
@ M68K_INS_FTRAPSEQ
Definition: m68k.h:475
@ M68K_INS_FSLE
Definition: m68k.h:441
@ M68K_INS_FSSEQ
Definition: m68k.h:437
@ M68K_INS_FBGLE
Definition: m68k.h:338
@ M68K_INS_ADDX
Definition: m68k.h:226
@ M68K_INS_FTRAPGE
Definition: m68k.h:477
@ M68K_INS_FSST
Definition: m68k.h:451
@ M68K_INS_FSIN
Definition: m68k.h:414
@ M68K_INS_FTRAPOGT
Definition: m68k.h:460
@ M68K_INS_FRESTORE
Definition: m68k.h:409
@ M68K_INS_FBSNE
Definition: m68k.h:345
@ M68K_INS_FDADD
Definition: m68k.h:311
@ M68K_INS_UNLK
Definition: m68k.h:593
@ M68K_INS_FDBOGT
Definition: m68k.h:352
@ M68K_INS_TRAPV
Definition: m68k.h:573
@ M68K_INS_FTRAPSNE
Definition: m68k.h:488
@ M68K_INS_FSINCOS
Definition: m68k.h:415
@ M68K_INS_FBULT
Definition: m68k.h:327
@ M68K_INS_FTRAPULT
Definition: m68k.h:470
@ M68K_INS_SLE
Definition: m68k.h:563
@ M68K_INS_FSBEQ
Definition: m68k.h:421
@ M68K_INS_ASL
Definition: m68k.h:229
@ M68K_INS_FTRAPLT
Definition: m68k.h:478
@ M68K_INS_FDBNGT
Definition: m68k.h:379
@ M68K_INS_FSABS
Definition: m68k.h:306
@ M68K_INS_BLT
Definition: m68k.h:244
@ M68K_INS_BCHG
Definition: m68k.h:249
@ M68K_INS_CMPA
Definition: m68k.h:269
@ M68K_INS_SGE
Definition: m68k.h:560
@ M68K_INS_FDBSEQ
Definition: m68k.h:367
@ M68K_INS_SWAP
Definition: m68k.h:570
@ M68K_INS_DBLT
Definition: m68k.h:292
@ M68K_INS_FBOGE
Definition: m68k.h:318
@ M68K_INS_NEG
Definition: m68k.h:512
@ M68K_INS_TRAPVC
Definition: m68k.h:584
@ M68K_INS_ABCD
Definition: m68k.h:221
@ M68K_INS_DBT
Definition: m68k.h:279
@ M68K_INS_ILLEGAL
Definition: m68k.h:493
@ M68K_INS_FDMOVE
Definition: m68k.h:398
@ M68K_INS_FDMUL
Definition: m68k.h:403
@ M68K_INS_NEGX
Definition: m68k.h:513
@ M68K_INS_FBUGE
Definition: m68k.h:326
@ M68K_INS_BLO
Definition: m68k.h:232
@ M68K_INS_FBEQ
Definition: m68k.h:316
@ M68K_INS_SLS
Definition: m68k.h:549
@ M68K_INS_MOVE16
Definition: m68k.h:508
@ M68K_INS_SMI
Definition: m68k.h:559
@ M68K_INS_FSNGT
Definition: m68k.h:449
@ M68K_INS_EXTB
Definition: m68k.h:304
@ M68K_INS_REMU
Definition: m68k.h:534
@ M68K_INS_DBLE
Definition: m68k.h:294
@ M68K_INS_EORI
Definition: m68k.h:301
@ M68K_INS_DBPL
Definition: m68k.h:289
@ M68K_INS_MOVEA
Definition: m68k.h:502
@ M68K_INS_FBF
Definition: m68k.h:315
@ M68K_INS_MULU
Definition: m68k.h:510
@ M68K_INS_FSLT
Definition: m68k.h:440
@ M68K_INS_FTRAPOLE
Definition: m68k.h:463
@ M68K_INS_FSSF
Definition: m68k.h:436
@ M68K_INS_BGT
Definition: m68k.h:245
@ M68K_INS_BRA
Definition: m68k.h:247
@ M68K_INS_FDIV
Definition: m68k.h:382
@ M68K_INS_FSUEQ
Definition: m68k.h:429
@ M68K_INS_BKPT
Definition: m68k.h:261
@ M68K_INS_ADD
Definition: m68k.h:222
@ M68K_INS_FBT
Definition: m68k.h:330
@ M68K_INS_NBCD
Definition: m68k.h:511
@ M68K_INS_PFLUSHN
Definition: m68k.h:523
@ M68K_INS_TRAPT
Definition: m68k.h:574
@ M68K_INS_FSUGT
Definition: m68k.h:430
@ M68K_INS_FTRAPUGE
Definition: m68k.h:469
@ M68K_INS_SEQ
Definition: m68k.h:555
@ M68K_INS_FDBUN
Definition: m68k.h:358
@ M68K_INS_CHK
Definition: m68k.h:265
@ M68K_INS_NOT
Definition: m68k.h:515
@ M68K_INS_TRAPVS
Definition: m68k.h:585
@ M68K_INS_BHS
Definition: m68k.h:231
@ M68K_INS_FNEG
Definition: m68k.h:404
@ M68K_INS_SCS
Definition: m68k.h:552
@ M68K_INS_FSAVE
Definition: m68k.h:410
@ M68K_INS_TRAPCS
Definition: m68k.h:580
@ M68K_INS_SUBA
Definition: m68k.h:566
@ M68K_INS_FBNGT
Definition: m68k.h:344
@ M68K_INS_FTRAPUGT
Definition: m68k.h:468
@ M68K_INS_AND
Definition: m68k.h:227
@ M68K_INS_PLOADR
Definition: m68k.h:524
@ M68K_INS_FTRAPEQ
Definition: m68k.h:459
@ M68K_INS_FSGE
Definition: m68k.h:439
@ M68K_INS_FTRAPOR
Definition: m68k.h:465
@ M68K_INS_FSOGE
Definition: m68k.h:423
@ M68K_INS_CALLM
Definition: m68k.h:262
@ M68K_INS_DIVSL
Definition: m68k.h:297
@ M68K_INS_REMS
Definition: m68k.h:533
@ M68K_INS_FSOLT
Definition: m68k.h:424
@ M68K_INS_FSNLT
Definition: m68k.h:447
@ M68K_INS_FDBSF
Definition: m68k.h:366
@ M68K_INS_FTWOTOX
Definition: m68k.h:491
@ M68K_INS_FTRAPULE
Definition: m68k.h:471
@ M68K_INS_FSNLE
Definition: m68k.h:446
@ M68K_INS_FDBEQ
Definition: m68k.h:351
@ M68K_INS_BFTST
Definition: m68k.h:260
@ M68K_INS_TRAPLE
Definition: m68k.h:591
@ M68K_INS_DIVUL
Definition: m68k.h:299
@ M68K_INS_FDBF
Definition: m68k.h:350
@ M68K_INS_MOVEM
Definition: m68k.h:504
@ M68K_INS_BLS
Definition: m68k.h:234
@ M68K_INS_FASIN
Definition: m68k.h:312
@ M68K_INS_FBULE
Definition: m68k.h:328
@ M68K_INS_UNPK
Definition: m68k.h:594
@ M68K_INS_FBNGE
Definition: m68k.h:343
@ M68K_INS_FBSF
Definition: m68k.h:331
@ M68K_INS_RTD
Definition: m68k.h:540
@ M68K_INS_FSNGLE
Definition: m68k.h:444
@ M68K_INS_DBRA
Definition: m68k.h:295
@ M68K_INS_FBST
Definition: m68k.h:346
@ M68K_INS_DIVS
Definition: m68k.h:296
@ M68K_INS_DBHI
Definition: m68k.h:281
@ M68K_REG_INVALID
Definition: m68k.h:21
int x
Definition: mipsasm.c:20
int n
Definition: mipsasm.c:19
int type
Definition: mipsasm.c:17
int CS_ERR_OK
Definition: __init__.py:235
@ RZ_ANALYSIS_STACK_SET
Definition: rz_analysis.h:459
@ RZ_ANALYSIS_STACK_INC
Definition: rz_analysis.h:457
@ RZ_ANALYSIS_VAL_MEM
Definition: rz_analysis.h:769
@ RZ_ANALYSIS_OP_FAMILY_FPU
Definition: rz_analysis.h:313
RzAnalysisOpMask
Definition: rz_analysis.h:439
@ RZ_ANALYSIS_OP_MASK_VAL
Definition: rz_analysis.h:442
@ RZ_ANALYSIS_OP_MASK_OPEX
Definition: rz_analysis.h:444
#define RZ_ANALYSIS_OP_TYPE_MASK
Definition: rz_analysis.h:358
@ RZ_ANALYSIS_OP_TYPE_CMP
Definition: rz_analysis.h:399
@ RZ_ANALYSIS_OP_TYPE_SUB
Definition: rz_analysis.h:402
@ RZ_ANALYSIS_OP_TYPE_UNK
Definition: rz_analysis.h:388
@ RZ_ANALYSIS_OP_TYPE_MUL
Definition: rz_analysis.h:404
@ RZ_ANALYSIS_OP_TYPE_ROL
Definition: rz_analysis.h:420
@ RZ_ANALYSIS_OP_TYPE_JMP
Definition: rz_analysis.h:368
@ RZ_ANALYSIS_OP_TYPE_AND
Definition: rz_analysis.h:411
@ RZ_ANALYSIS_OP_TYPE_ROR
Definition: rz_analysis.h:419
@ RZ_ANALYSIS_OP_TYPE_TRAP
Definition: rz_analysis.h:392
@ 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_PUSH
Definition: rz_analysis.h:397
@ RZ_ANALYSIS_OP_TYPE_SHR
Definition: rz_analysis.h:406
@ RZ_ANALYSIS_OP_TYPE_POP
Definition: rz_analysis.h:398
@ RZ_ANALYSIS_OP_TYPE_CJMP
Definition: rz_analysis.h:373
@ RZ_ANALYSIS_OP_TYPE_DIV
Definition: rz_analysis.h:405
@ RZ_ANALYSIS_OP_TYPE_MOV
Definition: rz_analysis.h:390
@ RZ_ANALYSIS_OP_TYPE_SHL
Definition: rz_analysis.h:407
@ RZ_ANALYSIS_OP_TYPE_ILL
Definition: rz_analysis.h:387
@ RZ_ANALYSIS_OP_TYPE_NOT
Definition: rz_analysis.h:414
@ RZ_ANALYSIS_OP_TYPE_RET
Definition: rz_analysis.h:385
@ RZ_ANALYSIS_OP_TYPE_NOP
Definition: rz_analysis.h:389
@ RZ_ANALYSIS_OP_TYPE_LEA
Definition: rz_analysis.h:417
@ RZ_ANALYSIS_OP_TYPE_XOR
Definition: rz_analysis.h:412
@ RZ_LIB_TYPE_ANALYSIS
Definition: rz_lib.h:73
RZ_API PJ * pj_ka(PJ *j, const char *k)
Definition: pj.c:163
RZ_API PJ * pj_new(void)
Definition: pj.c:25
RZ_API PJ * pj_ki(PJ *j, const char *k, int d)
Definition: pj.c:149
RZ_API PJ * pj_end(PJ *j)
Definition: pj.c:87
RZ_API const char * pj_string(PJ *pj)
Definition: pj.c:57
RZ_API void pj_free(PJ *j)
Definition: pj.c:34
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, st64 n)
Definition: pj.c:128
RZ_API bool rz_strbuf_append(RzStrBuf *sb, const char *s)
Definition: strbuf.c:222
RZ_API void rz_strbuf_init(RzStrBuf *sb)
Definition: strbuf.c:33
#define ZERO_FILL(x)
Definition: rz_types.h:281
#define RZ_MIN(x, y)
#define st64
Definition: rz_types_base.h:10
#define UT32_MAX
Definition: rz_types_base.h:99
#define st16
Definition: rz_types_base.h:14
#define RZ_VERSION
Definition: rz_version.h:8
#define a(i)
Definition: sha256.c:41
Instruction operand.
Definition: m68k.h:160
The M68K instruction and it's operands.
Definition: m68k.h:210
Definition: rz_pj.h:12
const char * version
Definition: rz_analysis.h:1239
Definition: dis.c:32
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
static int addr
Definition: z80asm.c:58