| 1 | /* Capstone Disassembler Engine */cxx . . $ `<file>/cstool/cstool_riscv.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_riscvcxx . . $ print_insn_detail_riscv(2888c3e5b0984e8d).(cshcxx . . $ csh# handle, cs_insncxx . . $ cs_insn# *ins) |
| 9 | { |
| 10 | cs_riscvcxx . . $ cs_riscv# *riscv; |
| 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 . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) |
| 15 | return; |
| 16 | |
| 17 | riscv = &(ins->detailcxx . . $ cs_insn#detail.->riscvcxx . . $ cs_detail#$anonymous_type_0#riscv.); |
| 18 | if (riscv->op_countcxx . . $ cs_riscv#op_count.) |
| 19 | printfcxx . . $ printf(581fddd72a8db8fc).("\top_count: %u\n", riscv->op_countcxx . . $ cs_riscv#op_count.); |
| 20 | |
| 21 | for (i = 0; i < riscv->op_countcxx . . $ cs_riscv#op_count.; i++) { |
| 22 | cs_riscv_opcxx . . $ cs_riscv_op# *op = &(riscv->operandscxx . . $ cs_riscv#operands.[i]); |
| 23 | switch((int)op->typecxx . . $ cs_riscv_op#type.) { |
| 24 | default: |
| 25 | break; |
| 26 | case RISCV_OP_REGcxx . . $ RISCV_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_riscv_op#$anonymous_type_0#reg.)); |
| 28 | break; |
| 29 | case RISCV_OP_IMMcxx . . $ RISCV_OP_IMM.: |
| 30 | printfcxx . . $ printf(581fddd72a8db8fc).("\t\toperands[%u].type: IMM = 0x%lx\n", i, (long)op->immcxx . . $ cs_riscv_op#$anonymous_type_0#imm.); |
| 31 | break; |
| 32 | case RISCV_OP_MEMcxx . . $ RISCV_OP_MEM.: |
| 33 | printfcxx . . $ printf(581fddd72a8db8fc).("\t\toperands[%u].type: MEM\n", i); |
| 34 | if (op->memcxx . . $ cs_riscv_op#$anonymous_type_0#mem..basecxx . . $ riscv_op_mem#base. != RISCV_REG_INVALIDcxx . . $ RISCV_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_riscv_op#$anonymous_type_0#mem..basecxx . . $ riscv_op_mem#base.)); |
| 37 | if (op->memcxx . . $ cs_riscv_op#$anonymous_type_0#mem..dispcxx . . $ riscv_op_mem#disp. != 0) |
| 38 | printfcxx . . $ printf(581fddd72a8db8fc).("\t\t\toperands[%u].mem.disp: 0x%lx\n", i, (long)op->memcxx . . $ cs_riscv_op#$anonymous_type_0#mem..dispcxx . . $ riscv_op_mem#disp.); |
| 39 | |
| 40 | break; |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | printfcxx . . $ printf(581fddd72a8db8fc).("\n"); |
| 45 | } |