| 1 | /* Capstone Disassembler Engine */cxx . . $ `<file>/cstool/cstool_xcore.c`/ |
| 2 | /* By Nguyen Anh Quynh <[email protected]>, 2013-2014 */ |
| 3 | |
| 4 | #include <stdio.h> |
| 5 | #include <capstone/capstone.h>cxx . . $ `<file>/include/capstone/capstone.h`/ |
| 6 | #include "cstool.h"cxx . . $ `<file>/cstool/cstool.h`/ |
| 7 | |
| 8 | void print_insn_detail_xcorecxx . . $ print_insn_detail_xcore(2888c3e5b0984e8d).(cshcxx . . $ csh# handle, cs_insncxx . . $ cs_insn# *ins) |
| 9 | { |
| 10 | cs_xcorecxx . . $ cs_xcore# *xcore; |
| 11 | int i; |
| 12 | |
| 13 | // detail can be NULL on "data" instruction if SKIPDATA option is turned ON |
| 14 | if (ins->detailcxx . . $ cs_insn#detail. == NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!) |
| 15 | return; |
| 16 | |
| 17 | xcore = &(ins->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore.); |
| 18 | if (xcore->op_countcxx . . $ cs_xcore#op_count.) |
| 19 | printfcxx . . $ printf(581fddd72a8db8fc).("\top_count: %u\n", xcore->op_countcxx . . $ cs_xcore#op_count.); |
| 20 | |
| 21 | for (i = 0; i < xcore->op_countcxx . . $ cs_xcore#op_count.; i++) { |
| 22 | cs_xcore_opcxx . . $ cs_xcore_op# *op = &(xcore->operandscxx . . $ cs_xcore#operands.[i]); |
| 23 | switch((int)op->typecxx . . $ cs_xcore_op#type.) { |
| 24 | default: |
| 25 | break; |
| 26 | case XCORE_OP_REGcxx . . $ XCORE_OP_REG.: |
| 27 | printfcxx . . $ printf(581fddd72a8db8fc).("\t\toperands[%u].type: REG = %s\n", i, cs_reg_namecxx . . $ cs_reg_name(efd1348d9ae5172e).(handle, op->regcxx . . $ cs_xcore_op#$anonymous_type_0#reg.)); |
| 28 | break; |
| 29 | case XCORE_OP_IMMcxx . . $ XCORE_OP_IMM.: |
| 30 | printfcxx . . $ printf(581fddd72a8db8fc).("\t\toperands[%u].type: IMM = 0x%x\n", i, op->immcxx . . $ cs_xcore_op#$anonymous_type_0#imm.); |
| 31 | break; |
| 32 | case XCORE_OP_MEMcxx . . $ XCORE_OP_MEM.: |
| 33 | printfcxx . . $ printf(581fddd72a8db8fc).("\t\toperands[%u].type: MEM\n", i); |
| 34 | if (op->memcxx . . $ cs_xcore_op#$anonymous_type_0#mem..basecxx . . $ xcore_op_mem#base. != XCORE_REG_INVALIDcxx . . $ XCORE_REG_INVALID.) |
| 35 | printfcxx . . $ printf(581fddd72a8db8fc).("\t\t\toperands[%u].mem.base: REG = %s\n", |
| 36 | i, cs_reg_namecxx . . $ cs_reg_name(efd1348d9ae5172e).(handle, op->memcxx . . $ cs_xcore_op#$anonymous_type_0#mem..basecxx . . $ xcore_op_mem#base.)); |
| 37 | if (op->memcxx . . $ cs_xcore_op#$anonymous_type_0#mem..indexcxx . . $ xcore_op_mem#index. != XCORE_REG_INVALIDcxx . . $ XCORE_REG_INVALID.) |
| 38 | printfcxx . . $ printf(581fddd72a8db8fc).("\t\t\toperands[%u].mem.index: REG = %s\n", |
| 39 | i, cs_reg_namecxx . . $ cs_reg_name(efd1348d9ae5172e).(handle, op->memcxx . . $ cs_xcore_op#$anonymous_type_0#mem..indexcxx . . $ xcore_op_mem#index.)); |
| 40 | if (op->memcxx . . $ cs_xcore_op#$anonymous_type_0#mem..dispcxx . . $ xcore_op_mem#disp. != 0) |
| 41 | printfcxx . . $ printf(581fddd72a8db8fc).("\t\t\toperands[%u].mem.disp: 0x%x\n", i, op->memcxx . . $ cs_xcore_op#$anonymous_type_0#mem..dispcxx . . $ xcore_op_mem#disp.); |
| 42 | if (op->memcxx . . $ cs_xcore_op#$anonymous_type_0#mem..directcxx . . $ xcore_op_mem#direct. != 1) |
| 43 | printfcxx . . $ printf(581fddd72a8db8fc).("\t\t\toperands[%u].mem.direct: -1\n", i); |
| 44 | |
| 45 | |
| 46 | break; |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | printfcxx . . $ printf(581fddd72a8db8fc).("\n"); |
| 51 | } |