Debian Codegraph @

cstool/cstool_tricore.c

raw symbols SCIP
1 #cxx . . $ `<file>/cstool/cstool_tricore.c`/include <stdio.h>
2 #include <stdlib.h>
3
4 #include <capstone/capstone.h>cxx . . $ `<file>/include/capstone/capstone.h`/
5 #include "cstool.h"cxx . . $ `<file>/cstool/cstool.h`/
6
7 void print_insn_detail_tricorecxx . . $ print_insn_detail_tricore(2888c3e5b0984e8d).(cshcxx . . $ csh# handle, cs_insncxx . . $ cs_insn# *ins)
8 {
9 cs_tricorecxx . . $ cs_tricore# *tricore;
10 int i;
11 cs_regscxx . . $ cs_regs# regs_read, regs_write;
12 uint8_tcxx . . $ uint8_t# regs_read_count, regs_write_count;
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 tricore = &(ins->detailcxx . . $ cs_insn#detail.->tricorecxx . . $ cs_detail#$anonymous_type_0#tricore.);
19
20 if (tricore->op_countcxx . . $ cs_tricore#op_count.)
21 printfcxx . . $ printf(581fddd72a8db8fc).("\top_count: %u\n", tricore->op_countcxx . . $ cs_tricore#op_count.);
22
23 for (i = 0; i < tricore->op_countcxx . . $ cs_tricore#op_count.; i++) {
24 cs_tricore_opcxx . . $ cs_tricore_op# *op = &(tricore->operandscxx . . $ cs_tricore#operands.[i]);
25 switch ((int)op->typecxx . . $ cs_tricore_op#type.) {
26 default:
27 break;
28 case TRICORE_OP_REGcxx . . $ TRICORE_OP_REG.:
29 printfcxx . . $ printf(581fddd72a8db8fc).("\t\toperands[%u].type: REG = %s\n", i,
30 cs_reg_namecxx . . $ cs_reg_name(efd1348d9ae5172e).(handle, op->regcxx . . $ cs_tricore_op#$anonymous_type_0#reg.));
31 break;
32 case TRICORE_OP_IMMcxx . . $ TRICORE_OP_IMM.:
33 printfcxx . . $ printf(581fddd72a8db8fc).("\t\toperands[%u].type: IMM = 0x%x\n", i,
34 op->immcxx . . $ cs_tricore_op#$anonymous_type_0#imm.);
35 break;
36 case TRICORE_OP_MEMcxx . . $ TRICORE_OP_MEM.:
37 printfcxx . . $ printf(581fddd72a8db8fc).("\t\toperands[%u].type: MEM\n"
38 "\t\t\t.mem.base: REG = %s\n"
39 "\t\t\t.mem.disp: 0x%x\n",
40 i, cs_reg_namecxx . . $ cs_reg_name(efd1348d9ae5172e).(handle, op->memcxx . . $ cs_tricore_op#$anonymous_type_0#mem..basecxx . . $ tricore_op_mem#base.),
41 op->memcxx . . $ cs_tricore_op#$anonymous_type_0#mem..dispcxx . . $ tricore_op_mem#disp.);
42 break;
43 }
44
45 switch (op->accesscxx . . $ cs_tricore_op#access.) {
46 default:
47 break;
48 case CS_AC_READcxx . . $ CS_AC_READ.:
49 printfcxx . . $ printf(581fddd72a8db8fc).("\t\t\t.access: READ\n");
50 break;
51 case CS_AC_WRITEcxx . . $ CS_AC_WRITE.:
52 printfcxx . . $ printf(581fddd72a8db8fc).("\t\t\t.access: WRITE\n");
53 break;
54 case CS_AC_READcxx . . $ CS_AC_READ. | CS_AC_WRITEcxx . . $ CS_AC_WRITE.:
55 printfcxx . . $ printf(581fddd72a8db8fc).("\t\t\t.access: READ | WRITE\n");
56 break;
57 }
58 }
59 // Print out all registers accessed by this instruction (either implicit or
60 // explicit)
61 if (!cs_regs_accesscxx . . $ cs_regs_access(4779ec53ff278361).(handle, ins, regs_read, &regs_read_count,
62 regs_write, &regs_write_count)) {
63 if (regs_read_count) {
64 printfcxx . . $ printf(581fddd72a8db8fc).("\tRegisters read:");
65 for (i = 0; i < regs_read_count; i++) {
66 printfcxx . . $ printf(581fddd72a8db8fc).(" %s",
67 cs_reg_namecxx . . $ cs_reg_name(efd1348d9ae5172e).(handle, regs_read[i]));
68 }
69 printfcxx . . $ printf(581fddd72a8db8fc).("\n");
70 }
71
72 if (regs_write_count) {
73 printfcxx . . $ printf(581fddd72a8db8fc).("\tRegisters modified:");
74 for (i = 0; i < regs_write_count; i++) {
75 printfcxx . . $ printf(581fddd72a8db8fc).(" %s",
76 cs_reg_namecxx . . $ cs_reg_name(efd1348d9ae5172e).(handle, regs_write[i]));
77 }
78 printfcxx . . $ printf(581fddd72a8db8fc).("\n");
79 }
80 }
81
82 if (tricore->update_flagscxx . . $ cs_tricore#update_flags.)
83 printfcxx . . $ printf(581fddd72a8db8fc).("\tUpdate-flags: True\n");
84 }