cstool_sparc.c
Go to the documentation of this file.
1 /* Capstone Disassembler Engine */
2 /* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2014 */
3 
4 #include <stdio.h>
5 
6 #include <capstone/capstone.h>
7 
8 void print_string_hex(char *comment, unsigned char *str, size_t len);
9 
10 void print_insn_detail_sparc(csh handle, cs_insn *ins)
11 {
12  cs_sparc *sparc;
13  int i;
14 
15  // detail can be NULL on "data" instruction if SKIPDATA option is turned ON
16  if (ins->detail == NULL)
17  return;
18 
19  sparc = &(ins->detail->sparc);
20  if (sparc->op_count)
21  printf("\top_count: %u\n", 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  printf("\t\toperands[%u].type: REG = %s\n", i, cs_reg_name(handle, op->reg));
30  break;
31  case SPARC_OP_IMM:
32  printf("\t\toperands[%u].type: IMM = 0x%" PRIx64 "\n", i, op->imm);
33  break;
34  case SPARC_OP_MEM:
35  printf("\t\toperands[%u].type: MEM\n", i);
36  if (op->mem.base != X86_REG_INVALID)
37  printf("\t\t\toperands[%u].mem.base: REG = %s\n",
38  i, cs_reg_name(handle, op->mem.base));
39  if (op->mem.index != X86_REG_INVALID)
40  printf("\t\t\toperands[%u].mem.index: REG = %s\n",
41  i, cs_reg_name(handle, op->mem.index));
42  if (op->mem.disp != 0)
43  printf("\t\t\toperands[%u].mem.disp: 0x%x\n", i, op->mem.disp);
44 
45  break;
46  }
47  }
48 
49  if (sparc->cc != 0)
50  printf("\tCode condition: %u\n", sparc->cc);
51 
52  if (sparc->hint != 0)
53  printf("\tHint code: %u\n", sparc->hint);
54 }
xds_interop_client.str
str
Definition: xds_interop_client.py:487
SPARC_OP_IMM
@ SPARC_OP_IMM
= CS_OP_IMM (Immediate operand).
Definition: sparc.h:73
sparc
Definition: test_winkernel.cpp:75
print_insn_detail_sparc
void print_insn_detail_sparc(csh handle, cs_insn *ins)
Definition: cstool_sparc.c:10
printf
_Use_decl_annotations_ int __cdecl printf(const char *_Format,...)
Definition: cs_driver.c:91
cs_sparc_op
Instruction operand.
Definition: sparc.h:189
capstone.h
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
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
len
int len
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:46
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
print_string_hex
void print_string_hex(char *comment, unsigned char *str, size_t len)
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230


grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:59:02