| 1 | /* Capstone Disassembler Engine */cxx . . $ `<file>/cstool/cstool_sparc.c`/ |
| 2 | /* By Nguyen Anh Quynh <[email protected]>, 2013-2014 */ |
| 3 | |
| 4 | #include <stdio.h> |
| 5 | |
| 6 | #include <capstone/capstone.h>cxx . . $ `<file>/include/capstone/capstone.h`/ |
| 7 | #include "cstool.h"cxx . . $ `<file>/cstool/cstool.h`/ |
| 8 | |
| 9 | void print_insn_detail_sparccxx . . $ print_insn_detail_sparc(2888c3e5b0984e8d).(cshcxx . . $ csh# handle, cs_insncxx . . $ cs_insn# *ins) |
| 10 | { |
| 11 | cs_sparccxx . . $ cs_sparc# *sparc; |
| 12 | int i; |
| 13 | |
| 14 | // detail can be NULL on "data" instruction if SKIPDATA option is turned ON |
| 15 | if (ins->detailcxx . . $ cs_insn#detail. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) |
| 16 | return; |
| 17 | |
| 18 | sparc = &(ins->detailcxx . . $ cs_insn#detail.->sparccxx . . $ cs_detail#$anonymous_type_0#sparc.); |
| 19 | if (sparc->op_countcxx . . $ cs_sparc#op_count.) |
| 20 | printfcxx . . $ printf(581fddd72a8db8fc).("\top_count: %u\n", sparc->op_countcxx . . $ cs_sparc#op_count.); |
| 21 | |
| 22 | for (i = 0; i < sparc->op_countcxx . . $ cs_sparc#op_count.; i++) { |
| 23 | cs_sparc_opcxx . . $ cs_sparc_op# *op = &(sparc->operandscxx . . $ cs_sparc#operands.[i]); |
| 24 | switch((int)op->typecxx . . $ cs_sparc_op#type.) { |
| 25 | default: |
| 26 | break; |
| 27 | case SPARC_OP_REGcxx . . $ SPARC_OP_REG.: |
| 28 | printfcxx . . $ printf(581fddd72a8db8fc).("\t\toperands[%u].type: REG = %s\n", i, cs_reg_namecxx . . $ cs_reg_name(efd1348d9ae5172e).(handle, op->regcxx . . $ cs_sparc_op#$anonymous_type_0#reg.)); |
| 29 | break; |
| 30 | case SPARC_OP_IMMcxx . . $ SPARC_OP_IMM.: |
| 31 | printfcxx . . $ printf(581fddd72a8db8fc).("\t\toperands[%u].type: IMM = 0x%" PRIx64cxx . . $ `<external>/15933738808807975373/inttypes.h:126:10`! "\n", i, op->immcxx . . $ cs_sparc_op#$anonymous_type_0#imm.); |
| 32 | break; |
| 33 | case SPARC_OP_MEMcxx . . $ SPARC_OP_MEM.: |
| 34 | printfcxx . . $ printf(581fddd72a8db8fc).("\t\toperands[%u].type: MEM\n", i); |
| 35 | if (op->memcxx . . $ cs_sparc_op#$anonymous_type_0#mem..basecxx . . $ sparc_op_mem#base. != X86_REG_INVALIDcxx . . $ X86_REG_INVALID.) |
| 36 | printfcxx . . $ printf(581fddd72a8db8fc).("\t\t\toperands[%u].mem.base: REG = %s\n", |
| 37 | i, cs_reg_namecxx . . $ cs_reg_name(efd1348d9ae5172e).(handle, op->memcxx . . $ cs_sparc_op#$anonymous_type_0#mem..basecxx . . $ sparc_op_mem#base.)); |
| 38 | if (op->memcxx . . $ cs_sparc_op#$anonymous_type_0#mem..indexcxx . . $ sparc_op_mem#index. != X86_REG_INVALIDcxx . . $ X86_REG_INVALID.) |
| 39 | printfcxx . . $ printf(581fddd72a8db8fc).("\t\t\toperands[%u].mem.index: REG = %s\n", |
| 40 | i, cs_reg_namecxx . . $ cs_reg_name(efd1348d9ae5172e).(handle, op->memcxx . . $ cs_sparc_op#$anonymous_type_0#mem..indexcxx . . $ sparc_op_mem#index.)); |
| 41 | if (op->memcxx . . $ cs_sparc_op#$anonymous_type_0#mem..dispcxx . . $ sparc_op_mem#disp. != 0) |
| 42 | printfcxx . . $ printf(581fddd72a8db8fc).("\t\t\toperands[%u].mem.disp: 0x%x\n", i, op->memcxx . . $ cs_sparc_op#$anonymous_type_0#mem..dispcxx . . $ sparc_op_mem#disp.); |
| 43 | |
| 44 | break; |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | if (sparc->cccxx . . $ cs_sparc#cc. != 0) |
| 49 | printfcxx . . $ printf(581fddd72a8db8fc).("\tCode condition: %u\n", sparc->cccxx . . $ cs_sparc#cc.); |
| 50 | |
| 51 | if (sparc->hintcxx . . $ cs_sparc#hint. != 0) |
| 52 | printfcxx . . $ printf(581fddd72a8db8fc).("\tHint code: %u\n", sparc->hintcxx . . $ cs_sparc#hint.); |
| 53 | } |