Rizin
unix-like reverse engineering framework and cli tools
test_x86.c
Go to the documentation of this file.
1 /* Capstone Disassembler Engine */
2 /* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2019 */
3 
4 #include <stdio.h>
5 #include <stdlib.h>
6 
7 #include <capstone/platform.h>
8 #include <capstone/capstone.h>
9 
10 static csh handle;
11 
12 struct platform {
13  cs_arch arch;
14  cs_mode mode;
15  unsigned char *code;
16  size_t size;
17  const char *comment;
20 };
21 
22 static void print_string_hex(const char *comment, unsigned char *str, size_t len)
23 {
24  unsigned char *c;
25 
26  printf("%s", comment);
27  for (c = str; c < str + len; c++) {
28  printf("0x%02x ", *c & 0xff);
29  }
30 
31  printf("\n");
32 }
33 
34 static const char *get_eflag_name(uint64_t flag)
35 {
36  switch(flag) {
37  default:
38  return NULL;
40  return "UNDEF_OF";
42  return "UNDEF_SF";
44  return "UNDEF_ZF";
46  return "MOD_AF";
48  return "UNDEF_PF";
50  return "MOD_CF";
52  return "MOD_SF";
54  return "MOD_ZF";
56  return "UNDEF_AF";
58  return "MOD_PF";
60  return "UNDEF_CF";
62  return "MOD_OF";
64  return "RESET_OF";
66  return "RESET_CF";
68  return "RESET_DF";
70  return "RESET_IF";
71  case X86_EFLAGS_TEST_OF:
72  return "TEST_OF";
73  case X86_EFLAGS_TEST_SF:
74  return "TEST_SF";
75  case X86_EFLAGS_TEST_ZF:
76  return "TEST_ZF";
77  case X86_EFLAGS_TEST_PF:
78  return "TEST_PF";
79  case X86_EFLAGS_TEST_CF:
80  return "TEST_CF";
82  return "RESET_SF";
84  return "RESET_AF";
86  return "RESET_TF";
88  return "RESET_NT";
90  return "PRIOR_OF";
92  return "PRIOR_SF";
94  return "PRIOR_ZF";
96  return "PRIOR_AF";
98  return "PRIOR_PF";
100  return "PRIOR_CF";
101  case X86_EFLAGS_PRIOR_TF:
102  return "PRIOR_TF";
103  case X86_EFLAGS_PRIOR_IF:
104  return "PRIOR_IF";
105  case X86_EFLAGS_PRIOR_DF:
106  return "PRIOR_DF";
107  case X86_EFLAGS_TEST_NT:
108  return "TEST_NT";
109  case X86_EFLAGS_TEST_DF:
110  return "TEST_DF";
111  case X86_EFLAGS_RESET_PF:
112  return "RESET_PF";
113  case X86_EFLAGS_PRIOR_NT:
114  return "PRIOR_NT";
116  return "MOD_TF";
118  return "MOD_IF";
120  return "MOD_DF";
122  return "MOD_NT";
124  return "MOD_RF";
125  case X86_EFLAGS_SET_CF:
126  return "SET_CF";
127  case X86_EFLAGS_SET_DF:
128  return "SET_DF";
129  case X86_EFLAGS_SET_IF:
130  return "SET_IF";
131  }
132 }
133 
134 static const char *get_fpu_flag_name(uint64_t flag)
135 {
136  switch (flag) {
137  default:
138  return NULL;
140  return "MOD_C0";
142  return "MOD_C1";
144  return "MOD_C2";
146  return "MOD_C3";
148  return "RESET_C0";
150  return "RESET_C1";
152  return "RESET_C2";
154  return "RESET_C3";
156  return "SET_C0";
158  return "SET_C1";
160  return "SET_C2";
162  return "SET_C3";
164  return "UNDEF_C0";
166  return "UNDEF_C1";
168  return "UNDEF_C2";
170  return "UNDEF_C3";
172  return "TEST_C0";
174  return "TEST_C1";
176  return "TEST_C2";
178  return "TEST_C3";
179  }
180 }
181 
182 static void print_insn_detail(csh ud, cs_mode mode, cs_insn *ins)
183 {
184  int count, i;
185  cs_x86 *x86;
186  cs_regs regs_read, regs_write;
187  uint8_t regs_read_count, regs_write_count;
188 
189  // detail can be NULL on "data" instruction if SKIPDATA option is turned ON
190  if (ins->detail == NULL)
191  return;
192 
193  x86 = &(ins->detail->x86);
194 
195  print_string_hex("\tPrefix:", x86->prefix, 4);
196 
197  print_string_hex("\tOpcode:", x86->opcode, 4);
198 
199  printf("\trex: 0x%x\n", x86->rex);
200 
201  printf("\taddr_size: %u\n", x86->addr_size);
202  printf("\tmodrm: 0x%x\n", x86->modrm);
203  if (x86->encoding.modrm_offset != 0) {
204  printf("\tmodrm_offset: 0x%x\n", x86->encoding.modrm_offset);
205  }
206 
207  printf("\tdisp: 0x%" PRIx64 "\n", x86->disp);
208  if (x86->encoding.disp_offset != 0) {
209  printf("\tdisp_offset: 0x%x\n", x86->encoding.disp_offset);
210  }
211 
212  if (x86->encoding.disp_size != 0) {
213  printf("\tdisp_size: 0x%x\n", x86->encoding.disp_size);
214  }
215 
216  // SIB is not available in 16-bit mode
217  if ((mode & CS_MODE_16) == 0) {
218  printf("\tsib: 0x%x\n", x86->sib);
219  if (x86->sib_base != X86_REG_INVALID)
220  printf("\t\tsib_base: %s\n", cs_reg_name(handle, x86->sib_base));
221  if (x86->sib_index != X86_REG_INVALID)
222  printf("\t\tsib_index: %s\n", cs_reg_name(handle, x86->sib_index));
223  if (x86->sib_scale != 0)
224  printf("\t\tsib_scale: %d\n", x86->sib_scale);
225  }
226 
227  // XOP code condition
228  if (x86->xop_cc != X86_XOP_CC_INVALID) {
229  printf("\txop_cc: %u\n", x86->xop_cc);
230  }
231 
232  // SSE code condition
233  if (x86->sse_cc != X86_SSE_CC_INVALID) {
234  printf("\tsse_cc: %u\n", x86->sse_cc);
235  }
236 
237  // AVX code condition
238  if (x86->avx_cc != X86_AVX_CC_INVALID) {
239  printf("\tavx_cc: %u\n", x86->avx_cc);
240  }
241 
242  // AVX Suppress All Exception
243  if (x86->avx_sae) {
244  printf("\tavx_sae: %u\n", x86->avx_sae);
245  }
246 
247  // AVX Rounding Mode
248  if (x86->avx_rm != X86_AVX_RM_INVALID) {
249  printf("\tavx_rm: %u\n", x86->avx_rm);
250  }
251 
252  // Print out all immediate operands
253  count = cs_op_count(ud, ins, X86_OP_IMM);
254  if (count) {
255  printf("\timm_count: %u\n", count);
256  for (i = 1; i < count + 1; i++) {
257  int index = cs_op_index(ud, ins, X86_OP_IMM, i);
258  printf("\t\timms[%u]: 0x%" PRIx64 "\n", i, x86->operands[index].imm);
259  if (x86->encoding.imm_offset != 0) {
260  printf("\timm_offset: 0x%x\n", x86->encoding.imm_offset);
261  }
262 
263  if (x86->encoding.imm_size != 0) {
264  printf("\timm_size: 0x%x\n", x86->encoding.imm_size);
265  }
266  }
267  }
268 
269  if (x86->op_count)
270  printf("\top_count: %u\n", x86->op_count);
271 
272  // Print out all operands
273  for (i = 0; i < x86->op_count; i++) {
274  cs_x86_op *op = &(x86->operands[i]);
275 
276  switch((int)op->type) {
277  case X86_OP_REG:
278  printf("\t\toperands[%u].type: REG = %s\n", i, cs_reg_name(handle, op->reg));
279  break;
280  case X86_OP_IMM:
281  printf("\t\toperands[%u].type: IMM = 0x%" PRIx64 "\n", i, op->imm);
282  break;
283  case X86_OP_MEM:
284  printf("\t\toperands[%u].type: MEM\n", i);
285  if (op->mem.segment != X86_REG_INVALID)
286  printf("\t\t\toperands[%u].mem.segment: REG = %s\n", i, cs_reg_name(handle, op->mem.segment));
287  if (op->mem.base != X86_REG_INVALID)
288  printf("\t\t\toperands[%u].mem.base: REG = %s\n", i, cs_reg_name(handle, op->mem.base));
289  if (op->mem.index != X86_REG_INVALID)
290  printf("\t\t\toperands[%u].mem.index: REG = %s\n", i, cs_reg_name(handle, op->mem.index));
291  if (op->mem.scale != 1)
292  printf("\t\t\toperands[%u].mem.scale: %u\n", i, op->mem.scale);
293  if (op->mem.disp != 0)
294  printf("\t\t\toperands[%u].mem.disp: 0x%" PRIx64 "\n", i, op->mem.disp);
295  break;
296  default:
297  break;
298  }
299 
300  // AVX broadcast type
301  if (op->avx_bcast != X86_AVX_BCAST_INVALID)
302  printf("\t\toperands[%u].avx_bcast: %u\n", i, op->avx_bcast);
303 
304  // AVX zero opmask {z}
305  if (op->avx_zero_opmask != false)
306  printf("\t\toperands[%u].avx_zero_opmask: TRUE\n", i);
307 
308  printf("\t\toperands[%u].size: %u\n", i, op->size);
309 
310  switch(op->access) {
311  default:
312  break;
313  case CS_AC_READ:
314  printf("\t\toperands[%u].access: READ\n", i);
315  break;
316  case CS_AC_WRITE:
317  printf("\t\toperands[%u].access: WRITE\n", i);
318  break;
319  case CS_AC_READ | CS_AC_WRITE:
320  printf("\t\toperands[%u].access: READ | WRITE\n", i);
321  break;
322  }
323  }
324 
325  // Print out all registers accessed by this instruction (either implicit or explicit)
326  if (!cs_regs_access(ud, ins,
327  regs_read, &regs_read_count,
328  regs_write, &regs_write_count)) {
329  if (regs_read_count) {
330  printf("\tRegisters read:");
331  for(i = 0; i < regs_read_count; i++) {
332  printf(" %s", cs_reg_name(handle, regs_read[i]));
333  }
334  printf("\n");
335  }
336 
337  if (regs_write_count) {
338  printf("\tRegisters modified:");
339  for(i = 0; i < regs_write_count; i++) {
340  printf(" %s", cs_reg_name(handle, regs_write[i]));
341  }
342  printf("\n");
343  }
344  }
345 
346  if (x86->eflags || x86->fpu_flags) {
347  for(i = 0; i < ins->detail->groups_count; i++) {
348  if (ins->detail->groups[i] == X86_GRP_FPU) {
349  printf("\tFPU_FLAGS:");
350  for(i = 0; i <= 63; i++)
351  if (x86->fpu_flags & ((uint64_t)1 << i)) {
352  printf(" %s", get_fpu_flag_name((uint64_t)1 << i));
353  }
354  printf("\n");
355  break;
356  }
357  }
358 
359  if (i == ins->detail->groups_count) {
360  printf("\tEFLAGS:");
361  for(i = 0; i <= 63; i++)
362  if (x86->eflags & ((uint64_t)1 << i)) {
363  printf(" %s", get_eflag_name((uint64_t)1 << i));
364  }
365  printf("\n");
366  }
367  }
368 
369  printf("\n");
370 }
371 
372 static void test()
373 {
374 #define X86_CODE64 "\x55\x48\x8b\x05\xb8\x13\x00\x00\xe9\xea\xbe\xad\xde\xff\x25\x23\x01\x00\x00\xe8\xdf\xbe\xad\xde\x74\xff"
375 #define X86_CODE16 "\x8d\x4c\x32\x08\x01\xd8\x81\xc6\x34\x12\x00\x00\x05\x23\x01\x00\x00\x36\x8b\x84\x91\x23\x01\x00\x00\x41\x8d\x84\x39\x89\x67\x00\x00\x8d\x87\x89\x67\x00\x00\xb4\xc6\x66\xe9\xb8\x00\x00\x00\x67\xff\xa0\x23\x01\x00\x00\x66\xe8\xcb\x00\x00\x00\x74\xfc"
376 #define X86_CODE32 "\x8d\x4c\x32\x08\x01\xd8\x81\xc6\x34\x12\x00\x00\x05\x23\x01\x00\x00\x36\x8b\x84\x91\x23\x01\x00\x00\x41\x8d\x84\x39\x89\x67\x00\x00\x8d\x87\x89\x67\x00\x00\xb4\xc6\xe9\xea\xbe\xad\xde\xff\xa0\x23\x01\x00\x00\xe8\xdf\xbe\xad\xde\x74\xff"
377 
378  struct platform platforms[] = {
379  {
380  CS_ARCH_X86,
381  CS_MODE_16,
382  (unsigned char *)X86_CODE16,
383  sizeof(X86_CODE16) - 1,
384  "X86 16bit (Intel syntax)"
385  },
386  {
387  CS_ARCH_X86,
388  CS_MODE_32,
389  (unsigned char *)X86_CODE32,
390  sizeof(X86_CODE32) - 1,
391  "X86 32 (AT&T syntax)",
394  },
395  {
396  CS_ARCH_X86,
397  CS_MODE_32,
398  (unsigned char *)X86_CODE32,
399  sizeof(X86_CODE32) - 1,
400  "X86 32 (Intel syntax)"
401  },
402  {
403  CS_ARCH_X86,
404  CS_MODE_64,
405  (unsigned char *)X86_CODE64,
406  sizeof(X86_CODE64) - 1,
407  "X86 64 (Intel syntax)"
408  },
409  };
410 
411  uint64_t address = 0x1000;
412  cs_insn *insn;
413  int i;
414  size_t count;
415 
416  for (i = 0; i < sizeof(platforms)/sizeof(platforms[0]); i++) {
417  cs_err err = cs_open(platforms[i].arch, platforms[i].mode, &handle);
418  if (err) {
419  printf("Failed on cs_open() with error returned: %u\n", err);
420  abort();
421  }
422 
423  if (platforms[i].opt_type)
425 
427 
428  count = cs_disasm(handle, platforms[i].code, platforms[i].size, address, 0, &insn);
429  if (count) {
430  size_t j;
431 
432  printf("****************\n");
433  printf("Platform: %s\n", platforms[i].comment);
435  printf("Disasm:\n");
436 
437  for (j = 0; j < count; j++) {
438  printf("0x%" PRIx64 ":\t%s\t%s\n", insn[j].address, insn[j].mnemonic, insn[j].op_str);
439  print_insn_detail(handle, platforms[i].mode, &insn[j]);
440  }
441  printf("0x%" PRIx64 ":\n", insn[j-1].address + insn[j-1].size);
442 
443  // free memory allocated by cs_disasm()
444  cs_free(insn, count);
445  } else {
446  printf("****************\n");
447  printf("Platform: %s\n", platforms[i].comment);
449  printf("ERROR: Failed to disasm given code!\n");
450  abort();
451  }
452 
453  printf("\n");
454 
455  cs_close(&handle);
456  }
457 }
458 
459 int main()
460 {
461  test();
462 
463  return 0;
464 }
size_t len
Definition: 6502dis.c:15
lzma_index ** i
Definition: index.h:629
static bool err
Definition: armass.c:435
cs_arch
Architecture type.
Definition: capstone.h:74
@ CS_ARCH_X86
X86 architecture (including x86 & x86-64)
Definition: capstone.h:78
cs_mode
Mode type.
Definition: capstone.h:102
@ CS_MODE_64
64-bit mode (X86, PPC)
Definition: capstone.h:107
@ CS_MODE_32
32-bit mode (X86)
Definition: capstone.h:106
@ CS_MODE_16
16-bit mode (X86)
Definition: capstone.h:105
cs_opt_type
Runtime option for the disassembled engine.
Definition: capstone.h:168
@ CS_OPT_DETAIL
Break down instruction structure into details.
Definition: capstone.h:171
@ CS_OPT_SYNTAX
Assembly output syntax.
Definition: capstone.h:170
size_t csh
Definition: capstone.h:71
cs_opt_value
Runtime option value (associated with option type above)
Definition: capstone.h:181
@ CS_OPT_SYNTAX_ATT
X86 ATT asm syntax (CS_OPT_SYNTAX).
Definition: capstone.h:186
@ CS_OPT_ON
Turn ON an option (CS_OPT_DETAIL, CS_OPT_SKIPDATA).
Definition: capstone.h:183
@ CS_AC_READ
Operand read from memory or register.
Definition: capstone.h:204
@ CS_AC_WRITE
Operand write to memory or register.
Definition: capstone.h:205
#define X86_EFLAGS_SET_IF
Definition: x86.h:107
@ X86_AVX_BCAST_INVALID
Uninitialized.
Definition: x86.h:180
#define X86_EFLAGS_RESET_AF
Definition: x86.h:101
#define X86_EFLAGS_PRIOR_DF
Definition: x86.h:94
#define X86_FPU_FLAGS_RESET_C0
Definition: x86.h:139
#define X86_FPU_FLAGS_SET_C3
Definition: x86.h:146
#define X86_EFLAGS_PRIOR_NT
Definition: x86.h:95
#define X86_FPU_FLAGS_UNDEFINED_C0
Definition: x86.h:147
#define X86_FPU_FLAGS_UNDEFINED_C1
Definition: x86.h:148
#define X86_EFLAGS_TEST_NT
Definition: x86.h:113
@ X86_AVX_RM_INVALID
Uninitialized.
Definition: x86.h:239
#define X86_EFLAGS_RESET_TF
Definition: x86.h:102
#define X86_EFLAGS_RESET_DF
Definition: x86.h:98
#define X86_EFLAGS_RESET_CF
Definition: x86.h:97
#define X86_FPU_FLAGS_UNDEFINED_C3
Definition: x86.h:150
#define X86_FPU_FLAGS_MODIFY_C0
Definition: x86.h:135
#define X86_FPU_FLAGS_TEST_C0
Definition: x86.h:151
#define X86_EFLAGS_UNDEFINED_AF
Definition: x86.h:119
#define X86_EFLAGS_MODIFY_CF
Definition: x86.h:76
#define X86_EFLAGS_TEST_OF
Definition: x86.h:108
#define X86_FPU_FLAGS_SET_C0
Definition: x86.h:143
#define X86_EFLAGS_MODIFY_IF
Definition: x86.h:82
#define X86_EFLAGS_MODIFY_DF
Definition: x86.h:83
#define X86_FPU_FLAGS_MODIFY_C3
Definition: x86.h:138
#define X86_EFLAGS_PRIOR_IF
Definition: x86.h:93
#define X86_EFLAGS_SET_CF
Definition: x86.h:105
#define X86_EFLAGS_MODIFY_OF
Definition: x86.h:80
#define X86_EFLAGS_RESET_SF
Definition: x86.h:100
#define X86_EFLAGS_TEST_PF
Definition: x86.h:111
#define X86_FPU_FLAGS_TEST_C1
Definition: x86.h:152
@ X86_OP_IMM
= CS_OP_IMM (Immediate operand).
Definition: x86.h:161
@ X86_OP_REG
= CS_OP_REG (Register operand).
Definition: x86.h:160
@ X86_OP_MEM
= CS_OP_MEM (Memory operand).
Definition: x86.h:162
#define X86_EFLAGS_SET_DF
Definition: x86.h:106
#define X86_EFLAGS_MODIFY_PF
Definition: x86.h:79
#define X86_EFLAGS_RESET_OF
Definition: x86.h:96
#define X86_EFLAGS_UNDEFINED_ZF
Definition: x86.h:117
#define X86_EFLAGS_MODIFY_TF
Definition: x86.h:81
#define X86_EFLAGS_MODIFY_NT
Definition: x86.h:84
#define X86_FPU_FLAGS_RESET_C2
Definition: x86.h:141
#define X86_EFLAGS_PRIOR_OF
Definition: x86.h:86
#define X86_FPU_FLAGS_TEST_C3
Definition: x86.h:154
#define X86_EFLAGS_RESET_PF
Definition: x86.h:104
#define X86_EFLAGS_MODIFY_ZF
Definition: x86.h:78
#define X86_EFLAGS_PRIOR_PF
Definition: x86.h:90
#define X86_EFLAGS_MODIFY_AF
Definition: x86.h:75
@ X86_REG_INVALID
Definition: x86.h:20
#define X86_FPU_FLAGS_MODIFY_C2
Definition: x86.h:137
#define X86_FPU_FLAGS_SET_C1
Definition: x86.h:144
@ X86_XOP_CC_INVALID
Uninitialized.
Definition: x86.h:167
@ X86_GRP_FPU
Definition: x86.h:1963
#define X86_EFLAGS_UNDEFINED_PF
Definition: x86.h:118
#define X86_EFLAGS_TEST_ZF
Definition: x86.h:110
#define X86_FPU_FLAGS_UNDEFINED_C2
Definition: x86.h:149
#define X86_EFLAGS_UNDEFINED_SF
Definition: x86.h:116
#define X86_FPU_FLAGS_RESET_C3
Definition: x86.h:142
#define X86_EFLAGS_TEST_SF
Definition: x86.h:109
#define X86_FPU_FLAGS_RESET_C1
Definition: x86.h:140
#define X86_FPU_FLAGS_SET_C2
Definition: x86.h:145
#define X86_EFLAGS_PRIOR_ZF
Definition: x86.h:88
#define X86_EFLAGS_RESET_NT
Definition: x86.h:103
#define X86_EFLAGS_UNDEFINED_OF
Definition: x86.h:115
#define X86_EFLAGS_PRIOR_AF
Definition: x86.h:89
#define X86_EFLAGS_PRIOR_SF
Definition: x86.h:87
#define X86_EFLAGS_PRIOR_TF
Definition: x86.h:92
#define X86_EFLAGS_MODIFY_SF
Definition: x86.h:77
@ X86_AVX_CC_INVALID
Uninitialized.
Definition: x86.h:202
@ X86_SSE_CC_INVALID
Uninitialized.
Definition: x86.h:189
#define X86_EFLAGS_RESET_IF
Definition: x86.h:99
#define X86_EFLAGS_TEST_DF
Definition: x86.h:114
#define X86_FPU_FLAGS_MODIFY_C1
Definition: x86.h:136
#define X86_EFLAGS_TEST_CF
Definition: x86.h:112
#define X86_EFLAGS_PRIOR_CF
Definition: x86.h:91
#define X86_FPU_FLAGS_TEST_C2
Definition: x86.h:153
#define X86_EFLAGS_UNDEFINED_CF
Definition: x86.h:120
#define X86_EFLAGS_MODIFY_RF
Definition: x86.h:85
#define NULL
Definition: cris-opc.c:27
CAPSTONE_EXPORT cs_err CAPSTONE_API cs_regs_access(csh ud, const cs_insn *insn, cs_regs regs_read, uint8_t *regs_read_count, cs_regs regs_write, uint8_t *regs_write_count)
Definition: cs.c:1504
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 int CAPSTONE_API cs_op_count(csh ud, const cs_insn *insn, unsigned int op_type)
Definition: cs.c:1271
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 int CAPSTONE_API cs_op_index(csh ud, const cs_insn *insn, unsigned int op_type, unsigned int post)
Definition: cs.c:1369
CAPSTONE_EXPORT cs_err CAPSTONE_API cs_option(csh ud, cs_opt_type type, size_t value)
Definition: cs.c:646
_Use_decl_annotations_ int __cdecl printf(const char *const _Format,...)
Definition: cs_driver.c:93
cs_arch arch
Definition: cstool.c:13
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
Definition: sflib.h:98
struct platform platforms[]
Definition: fuzz_diff.c:18
voidpf void uLong size
Definition: ioapi.h:138
const char int mode
Definition: ioapi.h:137
unsigned long uint64_t
Definition: sftypes.h:28
unsigned char uint8_t
Definition: sftypes.h:31
#define c(i)
Definition: sha256.c:43
Definition: inftree9.h:24
Instruction operand.
Definition: x86.h:275
Instruction structure.
Definition: x86.h:312
cs_opt_type opt_type
Definition: test_basic.c:16
cs_opt_value opt_value
Definition: test_basic.c:17
unsigned char * code
#define PRIx64
Definition: sysdefs.h:94
static csh handle
Definition: test_x86.c:10
static void print_insn_detail(csh ud, cs_mode mode, cs_insn *ins)
Definition: test_x86.c:182
#define X86_CODE64
static void print_string_hex(const char *comment, unsigned char *str, size_t len)
Definition: test_x86.c:22
#define X86_CODE16
static void test()
Definition: test_x86.c:372
static const char * get_fpu_flag_name(uint64_t flag)
Definition: test_x86.c:134
#define X86_CODE32
int main()
Definition: test_x86.c:459
static const char * get_eflag_name(uint64_t flag)
Definition: test_x86.c:34
Definition: dis.c:32
mnemonic
Definition: z80asm.h:48