|
|
@ -70,54 +70,52 @@ typedef enum x86_reg { |
|
|
|
} x86_reg; |
|
|
|
} x86_reg; |
|
|
|
|
|
|
|
|
|
|
|
//> Sub-flags of EFLAGS
|
|
|
|
//> Sub-flags of EFLAGS
|
|
|
|
typedef enum x86_eflags_type { |
|
|
|
#define X86_EFLAGS_MODIFY_AF (1ULL << 0) |
|
|
|
X86_EFLAGS_MODIFY_AF = (uint64_t)1 << 0, |
|
|
|
#define X86_EFLAGS_MODIFY_CF (1ULL << 1) |
|
|
|
X86_EFLAGS_MODIFY_CF = (uint64_t)1 << 1, |
|
|
|
#define X86_EFLAGS_MODIFY_SF (1ULL << 2) |
|
|
|
X86_EFLAGS_MODIFY_SF = (uint64_t)1 << 2, |
|
|
|
#define X86_EFLAGS_MODIFY_ZF (1ULL << 3) |
|
|
|
X86_EFLAGS_MODIFY_ZF = (uint64_t)1 << 3, |
|
|
|
#define X86_EFLAGS_MODIFY_PF (1ULL << 4) |
|
|
|
X86_EFLAGS_MODIFY_PF = (uint64_t)1 << 4, |
|
|
|
#define X86_EFLAGS_MODIFY_OF (1ULL << 5) |
|
|
|
X86_EFLAGS_MODIFY_OF = (uint64_t)1 << 5, |
|
|
|
#define X86_EFLAGS_MODIFY_TF (1ULL << 6) |
|
|
|
X86_EFLAGS_MODIFY_TF = (uint64_t)1 << 6, |
|
|
|
#define X86_EFLAGS_MODIFY_IF (1ULL << 7) |
|
|
|
X86_EFLAGS_MODIFY_IF = (uint64_t)1 << 7, |
|
|
|
#define X86_EFLAGS_MODIFY_DF (1ULL << 8) |
|
|
|
X86_EFLAGS_MODIFY_DF = (uint64_t)1 << 8, |
|
|
|
#define X86_EFLAGS_MODIFY_NT (1ULL << 9) |
|
|
|
X86_EFLAGS_MODIFY_NT = (uint64_t)1 << 9, |
|
|
|
#define X86_EFLAGS_MODIFY_RF (1ULL << 10) |
|
|
|
X86_EFLAGS_MODIFY_RF = (uint64_t)1 << 10, |
|
|
|
#define X86_EFLAGS_PRIOR_OF (1ULL << 11) |
|
|
|
X86_EFLAGS_PRIOR_OF = (uint64_t)1 << 11, |
|
|
|
#define X86_EFLAGS_PRIOR_SF (1ULL << 12) |
|
|
|
X86_EFLAGS_PRIOR_SF = (uint64_t)1 << 12, |
|
|
|
#define X86_EFLAGS_PRIOR_ZF (1ULL << 13) |
|
|
|
X86_EFLAGS_PRIOR_ZF = (uint64_t)1 << 13, |
|
|
|
#define X86_EFLAGS_PRIOR_AF (1ULL << 14) |
|
|
|
X86_EFLAGS_PRIOR_AF = (uint64_t)1 << 14, |
|
|
|
#define X86_EFLAGS_PRIOR_PF (1ULL << 15) |
|
|
|
X86_EFLAGS_PRIOR_PF = (uint64_t)1 << 15, |
|
|
|
#define X86_EFLAGS_PRIOR_CF (1ULL << 16) |
|
|
|
X86_EFLAGS_PRIOR_CF = (uint64_t)1 << 16, |
|
|
|
#define X86_EFLAGS_PRIOR_TF (1ULL << 17) |
|
|
|
X86_EFLAGS_PRIOR_TF = (uint64_t)1 << 17, |
|
|
|
#define X86_EFLAGS_PRIOR_IF (1ULL << 18) |
|
|
|
X86_EFLAGS_PRIOR_IF = (uint64_t)1 << 18, |
|
|
|
#define X86_EFLAGS_PRIOR_DF (1ULL << 19) |
|
|
|
X86_EFLAGS_PRIOR_DF = (uint64_t)1 << 19, |
|
|
|
#define X86_EFLAGS_PRIOR_NT (1ULL << 20) |
|
|
|
X86_EFLAGS_PRIOR_NT = (uint64_t)1 << 20, |
|
|
|
#define X86_EFLAGS_RESET_OF (1ULL << 21) |
|
|
|
X86_EFLAGS_RESET_OF = (uint64_t)1 << 21, |
|
|
|
#define X86_EFLAGS_RESET_CF (1ULL << 22) |
|
|
|
X86_EFLAGS_RESET_CF = (uint64_t)1 << 22, |
|
|
|
#define X86_EFLAGS_RESET_DF (1ULL << 23) |
|
|
|
X86_EFLAGS_RESET_DF = (uint64_t)1 << 23, |
|
|
|
#define X86_EFLAGS_RESET_IF (1ULL << 24) |
|
|
|
X86_EFLAGS_RESET_IF = (uint64_t)1 << 24, |
|
|
|
#define X86_EFLAGS_RESET_SF (1ULL << 25) |
|
|
|
X86_EFLAGS_RESET_SF = (uint64_t)1 << 25, |
|
|
|
#define X86_EFLAGS_RESET_AF (1ULL << 26) |
|
|
|
X86_EFLAGS_RESET_AF = (uint64_t)1 << 26, |
|
|
|
#define X86_EFLAGS_RESET_TF (1ULL << 27) |
|
|
|
X86_EFLAGS_RESET_TF = (uint64_t)1 << 27, |
|
|
|
#define X86_EFLAGS_RESET_NT (1ULL << 28) |
|
|
|
X86_EFLAGS_RESET_NT = (uint64_t)1 << 28, |
|
|
|
#define X86_EFLAGS_RESET_PF (1ULL << 29) |
|
|
|
X86_EFLAGS_RESET_PF = (uint64_t)1 << 29, |
|
|
|
#define X86_EFLAGS_SET_CF (1ULL << 30) |
|
|
|
X86_EFLAGS_SET_CF = (uint64_t)1 << 30, |
|
|
|
#define X86_EFLAGS_SET_DF (1ULL << 31) |
|
|
|
X86_EFLAGS_SET_DF = (uint64_t)1 << 31, |
|
|
|
#define X86_EFLAGS_SET_IF (1ULL << 32) |
|
|
|
X86_EFLAGS_SET_IF = (uint64_t)1 << 32, |
|
|
|
#define X86_EFLAGS_TEST_OF (1ULL << 33) |
|
|
|
X86_EFLAGS_TEST_OF = (uint64_t)1 << 33, |
|
|
|
#define X86_EFLAGS_TEST_SF (1ULL << 34) |
|
|
|
X86_EFLAGS_TEST_SF = (uint64_t)1 << 34, |
|
|
|
#define X86_EFLAGS_TEST_ZF (1ULL << 35) |
|
|
|
X86_EFLAGS_TEST_ZF = (uint64_t)1 << 35, |
|
|
|
#define X86_EFLAGS_TEST_PF (1ULL << 36) |
|
|
|
X86_EFLAGS_TEST_PF = (uint64_t)1 << 36, |
|
|
|
#define X86_EFLAGS_TEST_CF (1ULL << 37) |
|
|
|
X86_EFLAGS_TEST_CF = (uint64_t)1 << 37, |
|
|
|
#define X86_EFLAGS_TEST_NT (1ULL << 38) |
|
|
|
X86_EFLAGS_TEST_NT = (uint64_t)1 << 38, |
|
|
|
#define X86_EFLAGS_TEST_DF (1ULL << 39) |
|
|
|
X86_EFLAGS_TEST_DF = (uint64_t)1 << 39, |
|
|
|
#define X86_EFLAGS_UNDEFINED_OF (1ULL << 40) |
|
|
|
X86_EFLAGS_UNDEFINED_OF = (uint64_t)1 << 40, |
|
|
|
#define X86_EFLAGS_UNDEFINED_SF (1ULL << 41) |
|
|
|
X86_EFLAGS_UNDEFINED_SF = (uint64_t)1 << 41, |
|
|
|
#define X86_EFLAGS_UNDEFINED_ZF (1ULL << 42) |
|
|
|
X86_EFLAGS_UNDEFINED_ZF = (uint64_t)1 << 42, |
|
|
|
#define X86_EFLAGS_UNDEFINED_PF (1ULL << 43) |
|
|
|
X86_EFLAGS_UNDEFINED_PF = (uint64_t)1 << 43, |
|
|
|
#define X86_EFLAGS_UNDEFINED_AF (1ULL << 44) |
|
|
|
X86_EFLAGS_UNDEFINED_AF = (uint64_t)1 << 44, |
|
|
|
#define X86_EFLAGS_UNDEFINED_CF (1ULL << 45) |
|
|
|
X86_EFLAGS_UNDEFINED_CF = (uint64_t)1 << 45, |
|
|
|
|
|
|
|
} x86_eflags_type; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//> Operand type for instruction's operands
|
|
|
|
//> Operand type for instruction's operands
|
|
|
|
typedef enum x86_op_type { |
|
|
|
typedef enum x86_op_type { |
|
|
@ -230,9 +228,9 @@ typedef enum x86_prefix { |
|
|
|
// Instruction's operand referring to memory
|
|
|
|
// Instruction's operand referring to memory
|
|
|
|
// This is associated with X86_OP_MEM operand type above
|
|
|
|
// This is associated with X86_OP_MEM operand type above
|
|
|
|
typedef struct x86_op_mem { |
|
|
|
typedef struct x86_op_mem { |
|
|
|
unsigned int segment; // segment register (or X86_REG_INVALID if irrelevant)
|
|
|
|
x86_reg segment; // segment register (or X86_REG_INVALID if irrelevant)
|
|
|
|
unsigned int base; // base register (or X86_REG_INVALID if irrelevant)
|
|
|
|
x86_reg base; // base register (or X86_REG_INVALID if irrelevant)
|
|
|
|
unsigned int index; // index register (or X86_REG_INVALID if irrelevant)
|
|
|
|
x86_reg index; // index register (or X86_REG_INVALID if irrelevant)
|
|
|
|
int scale; // scale for index register
|
|
|
|
int scale; // scale for index register
|
|
|
|
int64_t disp; // displacement value
|
|
|
|
int64_t disp; // displacement value
|
|
|
|
} x86_op_mem; |
|
|
|
} x86_op_mem; |
|
|
@ -241,7 +239,7 @@ typedef struct x86_op_mem { |
|
|
|
typedef struct cs_x86_op { |
|
|
|
typedef struct cs_x86_op { |
|
|
|
x86_op_type type; // operand type
|
|
|
|
x86_op_type type; // operand type
|
|
|
|
union { |
|
|
|
union { |
|
|
|
unsigned int reg; // register value for REG operand
|
|
|
|
x86_reg reg; // register value for REG operand
|
|
|
|
int64_t imm; // immediate value for IMM operand
|
|
|
|
int64_t imm; // immediate value for IMM operand
|
|
|
|
double fp; // floating point value for FP operand
|
|
|
|
double fp; // floating point value for FP operand
|
|
|
|
x86_op_mem mem; // base/index/scale/disp value for MEM operand
|
|
|
|
x86_op_mem mem; // base/index/scale/disp value for MEM operand
|
|
|
|