sparc_detail.c
Go to the documentation of this file.
1 /* Capstone testing regression */
2 /* By Do Minh Tuan <tuanit96@gmail.com>, 02-2019 */
3 
4 
5 #include "factory.h"
6 
7 char *get_detail_sparc(csh *handle, cs_mode mode, cs_insn *ins)
8 {
10  int i;
11  char *result;
12 
13  result = (char *)malloc(sizeof(char));
14  result[0] = '\0';
15 
16  if (ins->detail == NULL)
17  return result;
18 
19  sparc = &(ins->detail->sparc);
20  if (sparc->op_count)
21  add_str(&result, " ; op_count: %u", sparc->op_count);
22 
23  for (i = 0; i < sparc->op_count; i++) {
24  cs_sparc_op *op = &(sparc->operands[i]);
25  switch((int)op->type) {
26  default:
27  break;
28  case SPARC_OP_REG:
29  add_str(&result, " ; operands[%u].type: REG = %s", i, cs_reg_name(*handle, op->reg));
30  break;
31  case SPARC_OP_IMM:
32  add_str(&result, " ; operands[%u].type: IMM = 0x%" PRIx64 "", i, op->imm);
33  break;
34  case SPARC_OP_MEM:
35  add_str(&result, " ; operands[%u].type: MEM", i);
36  if (op->mem.base != X86_REG_INVALID)
37  add_str(&result, " ; operands[%u].mem.base: REG = %s", i, cs_reg_name(*handle, op->mem.base));
38  if (op->mem.index != X86_REG_INVALID)
39  add_str(&result, " ; operands[%u].mem.index: REG = %s", i, cs_reg_name(*handle, op->mem.index));
40  if (op->mem.disp != 0)
41  add_str(&result, " ; operands[%u].mem.disp: 0x%x", i, op->mem.disp);
42 
43  break;
44  }
45  }
46 
47  if (sparc->cc != 0)
48  add_str(&result, " ; Code condition: %u", sparc->cc);
49 
50  if (sparc->hint != 0)
51  add_str(&result, " ; Hint code: %u", sparc->hint);
52 
53  return result;
54 }
55 
SPARC_OP_IMM
@ SPARC_OP_IMM
= CS_OP_IMM (Immediate operand).
Definition: sparc.h:73
_gevent_test_main.result
result
Definition: _gevent_test_main.py:96
sparc
Definition: test_winkernel.cpp:75
factory.h
mode
const char int mode
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:135
cs_sparc_op
Instruction operand.
Definition: sparc.h:189
cs_mode
cs_mode
Mode type.
Definition: capstone.h:103
cs_reg_name
const CAPSTONE_EXPORT char *CAPSTONE_API cs_reg_name(csh ud, unsigned int reg)
Definition: cs.c:1176
SPARC_OP_REG
@ SPARC_OP_REG
= CS_OP_REG (Register operand).
Definition: sparc.h:72
add_str
void add_str(char **src, const char *format,...)
Definition: helper.c:89
cs_sparc
Instruction structure.
Definition: sparc.h:199
csh
size_t csh
Definition: capstone.h:71
X86_REG_INVALID
@ X86_REG_INVALID
Definition: x86.h:20
handle
static csh handle
Definition: test_arm_regression.c:16
SPARC_OP_MEM
@ SPARC_OP_MEM
= CS_OP_MEM (Memory operand).
Definition: sparc.h:74
op
static grpc_op * op
Definition: test/core/fling/client.cc:47
get_detail_sparc
char * get_detail_sparc(csh *handle, cs_mode mode, cs_insn *ins)
Definition: sparc_detail.c:7
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230


grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:15