3
#include <capstone/capstone.h>
6
void print_insn_detail_tricore(csh handle, cs_insn *ins)
10
cs_regs regs_read, regs_write;
11
uint8_t regs_read_count, regs_write_count;
13
// detail can be NULL on "data" instruction if SKIPDATA option is turned ON
14
if (ins->detail == NULL)
17
tricore = &(ins->detail->tricore);
19
if (tricore->op_count)
20
printf("\top_count: %u\n", tricore->op_count);
22
for (i = 0; i < tricore->op_count; i++) {
23
cs_tricore_op *op = &(tricore->operands[i]);
24
switch ((int)op->type) {
28
printf("\t\toperands[%u].type: REG = %s\n", i,
29
cs_reg_name(handle, op->reg));
32
printf("\t\toperands[%u].type: IMM = 0x%" PRIx64 "\n",
36
printf("\t\toperands[%u].type: MEM\n"
37
"\t\t\t.mem.base: REG = %s\n"
38
"\t\t\t.mem.disp: 0x%" PRIx64 "\n",
39
i, cs_reg_name(handle, op->mem.base),
48
printf("\t\t\t.access: READ\n");
51
printf("\t\t\t.access: WRITE\n");
53
case CS_AC_READ | CS_AC_WRITE:
54
printf("\t\t\t.access: READ | WRITE\n");
58
// Print out all registers accessed by this instruction (either implicit or
60
if (!cs_regs_access(handle, ins, regs_read, ®s_read_count,
61
regs_write, ®s_write_count)) {
62
if (regs_read_count) {
63
printf("\tRegisters read:");
64
for (i = 0; i < regs_read_count; i++) {
66
cs_reg_name(handle, regs_read[i]));
71
if (regs_write_count) {
72
printf("\tRegisters modified:");
73
for (i = 0; i < regs_write_count; i++) {
75
cs_reg_name(handle, regs_write[i]));
81
if (tricore->update_flags)
82
printf("\tUpdate-flags: True\n");