7 #include <capstone/platform.h>
8 #include <capstone/capstone.h>
33 #ifdef CAPSTONE_HAS_ARM
43 #ifdef CAPSTONE_HAS_X86
44 #define X86_CODE32 "\x8d\x4c\x32\x08\x01\xd8\x81\xc6\x34\x12\x00\x00\x00\x91\x92"
46 #define RANDOM_CODE "\xed\x00\x00\x00\x00\x1a\x5a\x0f\x1f\xff\xc2\x09\x80\x00\x00\x00\x07\xf7\xeb\x2a\xff\xff\x7f\x57\xe3\x01\xff\xff\x7f\x57\xeb\x00\xf0\x00\x00\x24\xb2\x4f\x00\x78"
48 #if defined(CAPSTONE_HAS_X86)
55 #ifdef CAPSTONE_HAS_ARM
56 cs_opt_skipdata skipdata_callback = {
63 #ifdef CAPSTONE_HAS_X86
69 "X86 32 (Intel syntax) - Skip data",
76 "X86 32 (Intel syntax) - Skip data with custom mnemonic",
83 #ifdef CAPSTONE_HAS_ARM
96 "Arm - Skip data with callback",
100 (
size_t) &skipdata_callback,
113 printf(
"****************\n");
117 printf(
"Failed on cs_open() with error returned: %u\n",
err);
135 for (j = 0; j <
count; j++) {
137 insn[j].address, insn[j].
mnemonic, insn[j].op_str);
146 printf(
"****************\n");
149 printf(
"ERROR: Failed to disasm given code!\n");
164 #define offsetof(st, m) __builtin_offsetof(st, m)
167 printf(
"size: %lu\n",
sizeof(insn));
175 printf(
"@regs_read_count: %lu\n",
offsetof(cs_insn, regs_read_count));
177 printf(
"@regs_write_count: %lu\n",
offsetof(cs_insn, regs_write_count));
static mcore_handle handle
cs_arch
Architecture type.
@ CS_ARCH_X86
X86 architecture (including x86 & x86-64)
@ CS_ARCH_ARM
ARM architecture (including Thumb, Thumb-2)
@ CS_MODE_32
32-bit mode (X86)
cs_opt_type
Runtime option for the disassembled engine.
@ CS_OPT_SKIPDATA_SETUP
Setup user-defined function for SKIPDATA option.
@ CS_OPT_INVALID
No option specified.
@ CS_OPT_SKIPDATA
Skip data when disassembling. Then engine is in SKIPDATA mode.
cs_opt_value
Runtime option value (associated with option type above)
@ CS_OPT_ON
Turn ON an option (CS_OPT_DETAIL, CS_OPT_SKIPDATA).
@ CS_OPT_OFF
Turn OFF an option - default for CS_OPT_DETAIL, CS_OPT_SKIPDATA, CS_OPT_UNSIGNED.
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)
_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[]
#define offsetof(type, member)
static void print_string_hex(unsigned char *str, size_t len)
#define buffer_size(buffer)