6 #include <capstone/platform.h>
7 #include <capstone/capstone.h>
37 if (ins->detail ==
NULL)
40 sparc = &(ins->detail->sparc);
44 for (
i = 0;
i <
sparc->op_count;
i++) {
46 switch((
int)
op->type) {
56 printf(
"\t\toperands[%u].type: MEM\n",
i);
58 printf(
"\t\t\toperands[%u].mem.base: REG = %s\n",
61 printf(
"\t\t\toperands[%u].mem.index: REG = %s\n",
63 if (
op->mem.disp != 0)
64 printf(
"\t\t\toperands[%u].mem.disp: 0x%x\n",
i,
op->mem.disp);
81 #define SPARC_CODE "\x80\xa0\x40\x02\x85\xc2\x60\x08\x85\xe8\x20\x01\x81\xe8\x00\x00\x90\x10\x20\x01\xd5\xf6\x10\x16\x21\x00\x00\x0a\x86\x00\x40\x02\x01\x00\x00\x00\x12\xbf\xff\xff\x10\xbf\xff\xff\xa0\x02\x00\x09\x0d\xbf\xff\xff\xd4\x20\x60\x00\xd4\x4e\x00\x16\x2a\xc2\x80\x03"
83 #define SPARCV9_CODE "\x81\xa8\x0a\x24\x89\xa0\x10\x20\x89\xa0\x1a\x60\x89\xa0\x00\xe0"
110 printf(
"Failed on cs_open() with error returned: %u\n",
err);
120 printf(
"****************\n");
125 for (j = 0; j <
count; j++) {
134 printf(
"****************\n");
137 printf(
"ERROR: Failed to disasm given code!\n");
cs_arch
Architecture type.
@ CS_ARCH_SPARC
Sparc architecture.
@ CS_MODE_BIG_ENDIAN
big-endian mode
@ CS_MODE_V9
SparcV9 mode (Sparc)
@ CS_OPT_DETAIL
Break down instruction structure into details.
@ CS_OPT_ON
Turn ON an option (CS_OPT_DETAIL, CS_OPT_SKIPDATA).
CAPSTONE_EXPORT size_t CAPSTONE_API cs_disasm(csh ud, const uint8_t *buffer, size_t size, uint64_t offset, size_t count, cs_insn **insn)
CAPSTONE_EXPORT cs_err CAPSTONE_API cs_open(cs_arch arch, cs_mode mode, csh *handle)
CAPSTONE_EXPORT void CAPSTONE_API cs_free(cs_insn *insn, size_t count)
CAPSTONE_EXPORT const char *CAPSTONE_API cs_reg_name(csh ud, unsigned int reg)
CAPSTONE_EXPORT cs_err CAPSTONE_API cs_close(csh *handle)
CAPSTONE_EXPORT cs_err CAPSTONE_API cs_option(csh ud, cs_opt_type type, size_t value)
_Use_decl_annotations_ int __cdecl printf(const char *const _Format,...)
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
struct platform platforms[]
@ SPARC_OP_MEM
= CS_OP_MEM (Memory operand).
@ SPARC_OP_IMM
= CS_OP_IMM (Immediate operand).
@ SPARC_OP_REG
= CS_OP_REG (Register operand).
static void print_string_hex(const char *comment, unsigned char *str, size_t len)
static void print_insn_detail(cs_insn *ins)