Debian Codegraph @

cstool/cstool_sparc.c

raw symbols SCIP
1 /* Capstone Disassembler Engine */
2 /* By Nguyen Anh Quynh <[email protected]>, 2013-2014 */
3
4 #include <stdio.h>
5
6 #include <capstone/capstone.h>
7 #include "cstool.h"
8
9 void print_insn_detail_sparc(csh handle, cs_insn *ins)
10 {
11 cs_sparc *sparc;
12 int i;
13
14 // detail can be NULL on "data" instruction if SKIPDATA option is turned ON
15 if (ins->detail == NULL)
16 return;
17
18 sparc = &(ins->detail->sparc);
19 if (sparc->op_count)
20 printf("\top_count: %u\n", sparc->op_count);
21
22 for (i = 0; i < sparc->op_count; i++) {
23 cs_sparc_op *op = &(sparc->operands[i]);
24 switch((int)op->type) {
25 default:
26 break;
27 case SPARC_OP_REG:
28 printf("\t\toperands[%u].type: REG = %s\n", i, cs_reg_name(handle, op->reg));
29 break;
30 case SPARC_OP_IMM:
31 printf("\t\toperands[%u].type: IMM = 0x%" PRIx64 "\n", i, op->imm);
32 break;
33 case SPARC_OP_MEM:
34 printf("\t\toperands[%u].type: MEM\n", i);
35 if (op->mem.base != X86_REG_INVALID)
36 printf("\t\t\toperands[%u].mem.base: REG = %s\n",
37 i, cs_reg_name(handle, op->mem.base));
38 if (op->mem.index != X86_REG_INVALID)
39 printf("\t\t\toperands[%u].mem.index: REG = %s\n",
40 i, cs_reg_name(handle, op->mem.index));
41 if (op->mem.disp != 0)
42 printf("\t\t\toperands[%u].mem.disp: 0x%x\n", i, op->mem.disp);
43
44 break;
45 }
46 }
47
48 if (sparc->cc != 0)
49 printf("\tCode condition: %u\n", sparc->cc);
50
51 if (sparc->hint != 0)
52 printf("\tHint code: %u\n", sparc->hint);
53 }