#include <stdio.h>
#include <capstone/platform.h>
#include <capstone/capstone.h>
Go to the source code of this file.
|
#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" |
|
#define | PPC_CODE2 "\x10\x60\x2a\x10\x10\x64\x28\x88\x7c\x4a\x5d\x0f" |
|
◆ PPC_CODE
#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" |
◆ PPC_CODE2
#define PPC_CODE2 "\x10\x60\x2a\x10\x10\x64\x28\x88\x7c\x4a\x5d\x0f" |
◆ get_bc_name()
static const char* get_bc_name |
( |
int |
bc | ) |
|
|
static |
Definition at line 31 of file test_ppc.c.
@ PPC_BC_SO
summary overflow
@ PPC_BC_NS
not summary overflow
References PPC_BC_EQ, PPC_BC_GE, PPC_BC_GT, PPC_BC_INVALID, PPC_BC_LE, PPC_BC_LT, PPC_BC_NE, PPC_BC_NS, PPC_BC_NU, PPC_BC_SO, and PPC_BC_UN.
Referenced by print_insn_detail().
◆ main()
◆ print_insn_detail()
static void print_insn_detail |
( |
cs_insn * |
ins | ) |
|
|
static |
Definition at line 60 of file test_ppc.c.
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");
CAPSTONE_EXPORT const char *CAPSTONE_API cs_reg_name(csh ud, unsigned int reg)
_Use_decl_annotations_ int __cdecl printf(const char *const _Format,...)
@ 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.
static const char * get_bc_name(int bc)
References cs_reg_name(), get_bc_name(), handle, i, NULL, PPC_OP_CRX, PPC_OP_IMM, PPC_OP_MEM, PPC_OP_REG, PPC_REG_INVALID, printf(), and PRIx64.
Referenced by test().
◆ print_string_hex()
◆ test()
Definition at line 114 of file test_ppc.c.
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_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 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)
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[]
static void print_string_hex(const char *comment, unsigned char *str, size_t len)
static void print_insn_detail(cs_insn *ins)
References arch, platform::comment, count, CS_ARCH_PPC, cs_close(), cs_disasm(), cs_free(), CS_MODE_BIG_ENDIAN, CS_MODE_QPX, cs_open(), CS_OPT_DETAIL, CS_OPT_ON, cs_option(), err, handle, i, platforms, PPC_CODE, PPC_CODE2, print_insn_detail(), print_string_hex(), printf(), and PRIx64.
Referenced by main().
◆ handle