6 #include <capstone/capstone.h>
47 if (
a->features && *
a->features) {
75 if (
a->features && *
a->features) {
77 op->size = insn->size;
81 if (
op->size == 0 &&
n > 0 && insn->size > 0) {
83 op->size = insn->size;
84 char *buf_asm =
sdb_fmt(
"%s%s%s",
85 insn->mnemonic, insn->op_str[0] ?
" " :
"",
87 ptrstr = strstr(buf_asm,
"ptr ");
89 memmove(ptrstr, ptrstr + 4, strlen(ptrstr + 4) + 1);
97 if (!strncmp(buf_asm,
"je ", 3)) {
99 }
else if (!strncmp(buf_asm,
"jne ", 4)) {
100 memcpy(buf_asm,
"jnz", 3);
111 .desc =
"Capstone X86 disassembler",
114 .platforms =
"generic",
116 .bits = 16 | 32 | 64,
121 .features =
"vm,3dnow,aes,adx,avx,avx2,avx512,bmi,bmi2,cmov,"
122 "f16c,fma,fma4,fsgsbase,hle,mmx,rtm,sha,sse1,sse2,"
123 "sse3,sse41,sse42,sse4a,ssse3,pclmul,xop"
129 if (!insn || !insn->detail) {
132 for (
i = 0;
i < insn->detail->groups_count;
i++) {
133 int id = insn->detail->groups[
i];
147 if (!strstr(
a->features,
name)) {
154 #ifndef RZ_PLUGIN_INCORE
RZ_API void rz_asm_op_set_asm(RzAsmOp *op, const char *str)
RZ_API RzLibStruct rizin_plugin
RzAsmPlugin rz_asm_plugin_x86_cs
static int disassemble(RzAsm *a, RzAsmOp *op, const ut8 *buf, int len)
static bool the_end(void *p)
static int check_features(RzAsm *a, cs_insn *insn)
void decompile_vm(RzAsm *a, RzAsmOp *op, const ut8 *buf, int len)
@ CS_ARCH_X86
X86 architecture (including x86 & x86-64)
@ CS_MODE_64
64-bit mode (X86, PPC)
@ CS_MODE_32
32-bit mode (X86)
@ CS_MODE_16
16-bit mode (X86)
@ CS_OPT_UNSIGNED
print immediate operands in unsigned form
@ CS_OPT_DETAIL
Break down instruction structure into details.
@ CS_OPT_SYNTAX
Assembly output syntax.
@ CS_OPT_SYNTAX_INTEL
X86 Intel asm syntax - default on X86 (CS_OPT_SYNTAX).
@ CS_OPT_SYNTAX_ATT
X86 ATT asm syntax (CS_OPT_SYNTAX).
@ CS_OPT_ON
Turn ON an option (CS_OPT_DETAIL, CS_OPT_SKIPDATA).
@ CS_OPT_SYNTAX_MASM
X86 Intel Masm syntax (CS_OPT_SYNTAX).
@ 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 const char *CAPSTONE_API cs_group_name(csh ud, unsigned int group)
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)
RZ_API char * sdb_fmt(const char *fmt,...)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
RZ_API char * rz_strbuf_get(RzStrBuf *sb)
#define RZ_SYS_ENDIAN_LITTLE
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
static const char * mnemonics[]