7 #include <capstone/platform.h>
8 #include <capstone/capstone.h>
38 if (ins->detail ==
NULL)
41 mips = &(ins->detail->mips);
45 for (
i = 0;
i <
mips->op_count;
i++) {
47 switch((
int)
op->type) {
57 printf(
"\t\toperands[%u].type: MEM\n",
i);
59 printf(
"\t\t\toperands[%u].mem.base: REG = %s\n",
61 if (
op->mem.disp != 0)
62 printf(
"\t\t\toperands[%u].mem.disp: 0x%" PRIx64 "\n",
i,
op->mem.disp);
74 #define MIPS_CODE "\x0C\x10\x00\x97\x00\x00\x00\x00\x24\x02\x00\x0c\x8f\xa2\x00\x00\x34\x21\x34\x56"
75 #define MIPS_CODE2 "\x56\x34\x21\x34\xc2\x17\x01\x00"
76 #define MIPS_32R6M "\x00\x07\x00\x07\x00\x11\x93\x7c\x01\x8c\x8b\x7c\x00\xc7\x48\xd0"
77 #define MIPS_32R6 "\xec\x80\x00\x19\x7c\x43\x22\xa0"
78 #define MIPS_64SD "\x70\x00\xb2\xff"
86 "MIPS-32 (Big-endian)"
93 "MIPS-64-EL (Little-endian)"
100 "MIPS-32R6 | Micro (Big-endian)"
107 "MIPS-32R6 (Big-endian)"
114 "MIPS-64-EL + Mips II (Little-endian)"
121 "MIPS-64-EL (Little-endian)"
133 printf(
"Failed on cs_open() with error returned: %u\n",
err);
143 printf(
"****************\n");
148 for (j = 0; j <
count; j++) {
157 printf(
"****************\n");
160 printf(
"ERROR: Failed to disasm given code!\n");
cs_arch
Architecture type.
@ CS_ARCH_MIPS
Mips architecture.
@ CS_MODE_MIPS64
Mips64 ISA (Mips)
@ CS_MODE_MICRO
MicroMips mode (MIPS)
@ CS_MODE_MIPS32
Mips32 ISA (Mips)
@ CS_MODE_MIPS32R6
Mips32r6 ISA.
@ CS_MODE_BIG_ENDIAN
big-endian mode
@ CS_MODE_LITTLE_ENDIAN
little-endian mode (default mode)
@ CS_MODE_MIPS2
Mips II ISA.
@ 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[]
@ MIPS_OP_REG
= CS_OP_REG (Register operand).
@ MIPS_OP_IMM
= CS_OP_IMM (Immediate operand).
@ MIPS_OP_MEM
= CS_OP_MEM (Memory operand).
static void print_string_hex(const char *comment, unsigned char *str, size_t len)
static void print_insn_detail(cs_insn *ins)