19 #if defined(CAPSTONE_HAS_X86) && !defined(CAPSTONE_DIET) && !defined(CAPSTONE_X86_ATT_DISABLE)
21 #if defined (WIN32) || defined (WIN64) || defined (_WIN32) || defined (_WIN64)
22 #pragma warning(disable:4996)
23 #pragma warning(disable:28719)
26 #if !defined(CAPSTONE_HAS_OSXKERNEL)
29 #include <capstone/platform.h>
31 #if defined(CAPSTONE_HAS_OSXKERNEL)
32 #include <Availability.h>
33 #include <libkern/libkern.h>
41 #include "../../utils.h"
42 #include "../../MCInst.h"
43 #include "../../SStream.h"
44 #include "../../MCRegisterInfo.h"
49 #define GET_INSTRINFO_ENUM
50 #ifdef CAPSTONE_X86_REDUCE
56 static void printMemReference(
MCInst *MI,
unsigned Op,
SStream *
O);
125 printMemReference(MI, OpNo,
O);
131 printMemReference(MI, OpNo,
O);
138 printMemReference(MI, OpNo,
O);
145 printMemReference(MI, OpNo,
O);
151 printMemReference(MI, OpNo,
O);
157 printMemReference(MI, OpNo,
O);
160 #ifndef CAPSTONE_X86_REDUCE
164 printMemReference(MI, OpNo,
O);
170 printMemReference(MI, OpNo,
O);
201 printMemReference(MI, OpNo,
O);
207 printMemReference(MI, OpNo,
O);
213 printMemReference(MI, OpNo,
O);
219 printMemReference(MI, OpNo,
O);
225 printMemReference(MI, OpNo,
O);
231 printMemReference(MI, OpNo,
O);
311 static void printRoundingControl(
MCInst *MI,
unsigned Op,
SStream *
O)
325 static void printRegName(
SStream *
OS,
unsigned RegNo);
413 MI->
flat_insn->detail->x86.operands[MI->
flat_insn->detail->x86.op_count].mem.scale = 1;
414 MI->
flat_insn->detail->x86.operands[MI->
flat_insn->detail->x86.op_count].mem.disp = 0;
425 _printOperand(MI, Op+1,
O);
434 set_mem_access(MI,
true);
436 printOperand(MI, Op,
O);
439 set_mem_access(MI,
false);
452 MI->
flat_insn->detail->x86.operands[MI->
flat_insn->detail->x86.op_count].mem.scale = 1;
453 MI->
flat_insn->detail->x86.operands[MI->
flat_insn->detail->x86.op_count].mem.disp = 0;
468 set_mem_access(MI,
true);
470 printOperand(MI, Op,
O);
473 set_mem_access(MI,
false);
479 printSrcIdx(MI, OpNo,
O);
485 printSrcIdx(MI, OpNo,
O);
491 printSrcIdx(MI, OpNo,
O);
497 printSrcIdx(MI, OpNo,
O);
503 printDstIdx(MI, OpNo,
O);
509 printDstIdx(MI, OpNo,
O);
515 printDstIdx(MI, OpNo,
O);
521 printDstIdx(MI, OpNo,
O);
538 MI->
flat_insn->detail->x86.operands[MI->
flat_insn->detail->x86.op_count].mem.scale = 1;
539 MI->
flat_insn->detail->x86.operands[MI->
flat_insn->detail->x86.op_count].mem.disp = 0;
548 _printOperand(MI, Op + 1,
O);
573 #ifndef CAPSTONE_X86_REDUCE
595 printMemOffset(MI, OpNo,
O);
601 printMemOffset(MI, OpNo,
O);
607 printMemOffset(MI, OpNo,
O);
613 printMemOffset(MI, OpNo,
O);
632 (MI->
Opcode != X86_JMP_4 && MI->
Opcode != X86_CALLpcrel32))
641 if (MI->
Opcode == X86_CALLpcrel16 || MI->
Opcode == X86_JMP_2)
669 printRegName(
O,
reg);
722 if (
imm == 0x8000000000000000LL)
793 MI->
flat_insn->detail->x86.operands[MI->
flat_insn->detail->x86.op_count].size = opsize;
794 MI->
flat_insn->detail->x86.encoding.imm_size = encsize;
806 static void printMemReference(
MCInst *MI,
unsigned Op,
SStream *
O)
824 MI->
flat_insn->detail->x86.operands[MI->
flat_insn->detail->x86.op_count].mem.scale = 1;
825 MI->
flat_insn->detail->x86.operands[MI->
flat_insn->detail->x86.op_count].mem.disp = 0;
836 MI->
flat_insn->detail->x86.operands[MI->
flat_insn->detail->x86.op_count].mem.segment = segreg;
845 MI->
flat_insn->detail->x86.operands[MI->
flat_insn->detail->x86.op_count].mem.disp = DispVal;
905 printMemReference(MI, OpNo,
O);
910 #define GET_REGINFO_ENUM
914 #define PRINT_ALIAS_INSTR
915 #ifdef CAPSTONE_X86_REDUCE
921 static void printRegName(
SStream *
OS,
unsigned RegNo)
948 printPCRelImm(MI, 0,
OS);
957 printInstruction(MI,
OS,
info);
970 if (MI->
flat_insn->detail->x86.op_count > 1) {
972 for (
i = 0;
i < MI->
flat_insn->detail->x86.op_count;
i++) {
1054 memmove(&(MI->
flat_insn->detail->x86.operands[1]), &(MI->
flat_insn->detail->x86.operands[0]),
1057 MI->
flat_insn->detail->x86.operands[0].imm = 1;
1058 MI->
flat_insn->detail->x86.operands[0].size = 1;
1071 memmove(&(MI->
flat_insn->detail->x86.operands[1]), &(MI->
flat_insn->detail->x86.operands[0]),
1076 MI->
flat_insn->detail->x86.operands[0].access = access1;
1085 MI->
flat_insn->detail->x86.operands[0].access = access1;
1087 MI->
flat_insn->detail->x86.operands[1].reg = reg2;
1089 MI->
flat_insn->detail->x86.operands[0].access = access2;
1090 MI->
flat_insn->detail->x86.op_count = 2;
1094 #ifndef CAPSTONE_DIET
unsigned MCInst_getOpcode(const MCInst *inst)
MCOperand * MCInst_getOperand(MCInst *inst, unsigned i)
bool MCOperand_isReg(const MCOperand *op)
void MCInst_setOpcodePub(MCInst *inst, unsigned Op)
int64_t MCOperand_getImm(MCOperand *op)
unsigned MCOperand_getReg(const MCOperand *op)
getReg - Returns the register number.
bool MCOperand_isImm(const MCOperand *op)
void SStream_Init(SStream *ss)
void printInt64(SStream *O, int64_t val)
void SStream_concat(SStream *ss, const char *fmt,...)
void SStream_concat0(SStream *ss, const char *s)
@ X86_AddrSegmentReg
AddrSegmentReg - The operand # of the segment in the memory operand.
void X86_ATT_printInst(MCInst *MI, SStream *OS, void *Info)
uint8_t X86_immediate_size(unsigned int id, uint8_t *enc_size)
const uint64_t arch_masks[9]
bool X86_insn_reg_att2(unsigned int id, x86_reg *reg1, enum cs_ac_type *access1, x86_reg *reg2, enum cs_ac_type *access2)
void op_addSseCC(MCInst *MI, int v)
void op_addAvxRoundingMode(MCInst *MI, int v)
uint8_t * X86_get_op_access(cs_struct *h, unsigned int id, uint64_t *eflags)
void op_addAvxSae(MCInst *MI)
x86_reg X86_insn_reg_att(unsigned int id, enum cs_ac_type *access)
void op_addXopCC(MCInst *MI, int v)
void op_addAvxCC(MCInst *MI, int v)
RzBinInfo * info(RzBinFile *bf)
@ CS_MODE_64
64-bit mode (X86, PPC)
@ CS_MODE_32
32-bit mode (X86)
@ CS_MODE_16
16-bit mode (X86)
@ CS_OPT_ON
Turn ON an option (CS_OPT_DETAIL, CS_OPT_SKIPDATA).
@ X86_AVX_RM_RD
Round down.
@ X86_AVX_RM_RN
Round to nearest.
@ X86_AVX_RM_RZ
Round toward zero.
@ X86_OP_IMM
= CS_OP_IMM (Immediate operand).
@ X86_OP_REG
= CS_OP_REG (Register operand).
@ X86_OP_MEM
= CS_OP_MEM (Memory operand).
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
static static fork const void static count static fd const char static mode const char static pathname const char static path const char static dev const char static group static getpid static getuid void void static data static pause access
static const char struct stat static buf struct stat static buf static vhangup int status
cs_opt_value imm_unsigned
const uint8_t * regsize_map