6 #include <capstone/platform.h>
7 #include <capstone/capstone.h>
66 if (ins->detail ==
NULL)
69 ppc = &(ins->detail->ppc);
71 printf(
"\top_count: %u\n",
ppc->op_count);
73 for (
i = 0;
i <
ppc->op_count;
i++) {
75 switch((
int)
op->type) {
85 printf(
"\t\toperands[%u].type: MEM\n",
i);
87 printf(
"\t\t\toperands[%u].mem.base: REG = %s\n",
89 if (
op->mem.disp != 0)
90 printf(
"\t\t\toperands[%u].mem.disp: 0x%x\n",
i,
op->mem.disp);
94 printf(
"\t\toperands[%u].type: CRX\n",
i);
95 printf(
"\t\t\toperands[%u].crx.scale: %d\n",
i,
op->crx.scale);
109 printf(
"\tUpdate-CR0: True\n");
116 #define PPC_CODE "\x43\x20\x0c\x07\x41\x56\xff\x17\x80\x20\x00\x00\x80\x3f\x00\x00\x10\x43\x23\x0e\xd0\x44\x00\x80\x4c\x43\x22\x02\x2d\x03\x00\x80\x7c\x43\x20\x14\x7c\x43\x20\x93\x4f\x20\x00\x21\x4c\xc8\x00\x21\x40\x82\x00\x14"
117 #define PPC_CODE2 "\x10\x60\x2a\x10\x10\x64\x28\x88\x7c\x4a\x5d\x0f"
144 printf(
"Failed on cs_open() with error returned: %u\n",
err);
154 printf(
"****************\n");
159 for (j = 0; j <
count; j++) {
168 printf(
"****************\n");
171 printf(
"ERROR: Failed to disasm given code!\n");
cs_arch
Architecture type.
@ CS_ARCH_PPC
PowerPC architecture.
@ CS_MODE_BIG_ENDIAN
big-endian mode
@ CS_MODE_QPX
Quad Processing eXtensions mode (PPC)
@ 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[]
@ PPC_OP_REG
= CS_OP_REG (Register operand).
@ PPC_OP_IMM
= CS_OP_IMM (Immediate operand).
@ PPC_OP_MEM
= CS_OP_MEM (Memory operand).
@ PPC_OP_CRX
Condition Register field.
@ PPC_BC_SO
summary overflow
@ PPC_BC_NS
not summary overflow
static void print_string_hex(const char *comment, unsigned char *str, size_t len)
static void print_insn_detail(cs_insn *ins)
static const char * get_bc_name(int bc)