X86 Encoder Decoder
Decoding Instructions

Data Structures

struct  xed_decoded_inst_s
 The main container for instructions. More...
 
struct  xed_inst_s
 constant information about a decoded instruction form, including the pointer to the constant operand properties xed_operand_t for this instruction form. More...
 
struct  xed_operand_s
 Constant information about an individual generic operand, like an operand template, describing the operand properties. More...
 

Typedefs

typedef struct xed_decoded_inst_s xed_decoded_inst_t
 The main container for instructions. More...
 
typedef struct xed_inst_s xed_inst_t
 constant information about a decoded instruction form, including the pointer to the constant operand properties xed_operand_t for this instruction form. More...
 
typedef struct xed_operand_s xed_operand_t
 Constant information about an individual generic operand, like an operand template, describing the operand properties. More...
 

Functions

XED_DLL_EXPORT xed_error_enum_t xed_decode (xed_decoded_inst_t *xedd, const xed_uint8_t *itext, const unsigned int bytes)
 This is the main interface to the decoder. More...
 
XED_DLL_EXPORT xed_error_enum_t xed_decode_with_features (xed_decoded_inst_t *xedd, const xed_uint8_t *itext, const unsigned int bytes, xed_chip_features_t *features)
 See xed_decode(). More...
 
XED_DLL_EXPORT xed_uint8_t xed_decoded_inst_get_modrm (const xed_decoded_inst_t *p)
 Returns the modrm byte. More...
 
XED_DLL_EXPORT xed_uint_t xed_decoded_inst_get_nprefixes (const xed_decoded_inst_t *p)
 Returns the number of legacy prefixes. More...
 
XED_DLL_EXPORT xed_uint32_t xed_decoded_inst_has_mpx_prefix (const xed_decoded_inst_t *p)
 Returns 1 if the instruction has mpx prefix. More...
 
XED_DLL_EXPORT xed_uint32_t xed_decoded_inst_is_xacquire (const xed_decoded_inst_t *p)
 Returns 1 if the instruction is xacquire. More...
 
XED_DLL_EXPORT xed_uint32_t xed_decoded_inst_is_xrelease (const xed_decoded_inst_t *p)
 Returns 1 if the instruction is xrelease. More...
 
XED_DLL_EXPORT xed_bool_t xed_decoded_inst_masked_vector_operation (xed_decoded_inst_t *p)
 Returns 1 iff the instruction uses destination-masking. More...
 
XED_DLL_EXPORT xed_uint_t xed_decoded_inst_vector_length_bits (xed_decoded_inst_t const *const p)
 Returns 128, 256 or 512 for operations in the VEX, EVEX (or XOP) encoding space and returns 0 for (most) nonvector operations. More...
 
XED_DLL_EXPORT xed_error_enum_t xed_ild_decode (xed_decoded_inst_t *xedd, const xed_uint8_t *itext, const unsigned int bytes)
 This function just does instruction length decoding. More...
 
XED_DLL_EXPORT const xed_inst_txed_inst_table_base (void)
 Return the base of instruction table. More...
 

xed_decoded_inst_t High-level accessors

API

static XED_INLINE xed_bool_t xed_decoded_inst_valid (const xed_decoded_inst_t *p)
 Return true if the instruction is valid. More...
 
static XED_INLINE const xed_inst_txed_decoded_inst_inst (const xed_decoded_inst_t *p)
 Return the xed_inst_t structure for this instruction. More...
 
static XED_INLINE xed_category_enum_t xed_decoded_inst_get_category (const xed_decoded_inst_t *p)
 Return the instruction xed_category_enum_t enumeration. More...
 
static XED_INLINE xed_extension_enum_t xed_decoded_inst_get_extension (const xed_decoded_inst_t *p)
 Return the instruction xed_extension_enum_t enumeration. More...
 
static XED_INLINE xed_isa_set_enum_t xed_decoded_inst_get_isa_set (xed_decoded_inst_t const *const p)
 Return the instruction xed_isa_set_enum_t enumeration. More...
 
static XED_INLINE xed_iclass_enum_t xed_decoded_inst_get_iclass (const xed_decoded_inst_t *p)
 Return the instruction xed_iclass_enum_t enumeration. More...
 

xed_decoded_inst_t Attributes and properties

XED_DLL_EXPORT xed_uint32_t xed_decoded_inst_get_attribute (const xed_decoded_inst_t *p, xed_attribute_enum_t attr)
 Returns 1 if the attribute is defined for this instruction. More...
 
XED_DLL_EXPORT xed_attributes_t xed_decoded_inst_get_attributes (const xed_decoded_inst_t *p)
 Returns the attribute bitvector. More...
 

xed_decoded_inst_t Operands

static XED_INLINE const xed_operand_values_txed_decoded_inst_operands_const (const xed_decoded_inst_t *p)
 Obtain a constant pointer to the operands. More...
 
static XED_INLINE xed_operand_values_txed_decoded_inst_operands (xed_decoded_inst_t *p)
 Obtain a non-constant pointer to the operands. More...
 
XED_DLL_EXPORT unsigned int xed_decoded_inst_operand_length_bits (const xed_decoded_inst_t *p, unsigned int operand_index)
 Return the length in bits of the operand_index'th operand. More...
 
XED_DLL_EXPORT unsigned int xed_decoded_inst_operand_length (const xed_decoded_inst_t *p, unsigned int operand_index)
 Deprecated – returns the length in bytes of the operand_index'th operand. More...
 
static XED_INLINE unsigned int xed_decoded_inst_noperands (const xed_decoded_inst_t *p)
 Return the number of operands. More...
 
XED_DLL_EXPORT unsigned int xed_decoded_inst_operand_elements (const xed_decoded_inst_t *p, unsigned int operand_index)
 Return the number of element in the operand (for SSE and AVX operands) More...
 
XED_DLL_EXPORT unsigned int xed_decoded_inst_operand_element_size_bits (const xed_decoded_inst_t *p, unsigned int operand_index)
 Return the size of an element in bits (for SSE and AVX operands) More...
 
XED_DLL_EXPORT xed_operand_element_type_enum_t xed_decoded_inst_operand_element_type (const xed_decoded_inst_t *p, unsigned int operand_index)
 Return the type of an element of type xed_operand_element_type_enum_t (for SSE and AVX operands) More...
 
XED_DLL_EXPORT xed_operand_action_enum_t xed_decoded_inst_operand_action (const xed_decoded_inst_t *p, unsigned int operand_index)
 Interpret the operand action in light of AVX512 masking and zeroing/merging. More...
 

xed_decoded_inst_t AVX512 Masking

XED_DLL_EXPORT xed_bool_t xed_decoded_inst_masking (const xed_decoded_inst_t *p)
 Returns true if the instruction uses write-masking. More...
 
XED_DLL_EXPORT xed_bool_t xed_decoded_inst_merging (const xed_decoded_inst_t *p)
 Returns true if the instruction uses write-masking with merging. More...
 
XED_DLL_EXPORT xed_bool_t xed_decoded_inst_zeroing (const xed_decoded_inst_t *p)
 Returns true if the instruction uses write-masking with zeroing. More...
 

xed_decoded_inst_t Initialization

XED_DLL_EXPORT void xed_decoded_inst_zero_set_mode (xed_decoded_inst_t *p, const xed_state_t *dstate)
 Zero the decode structure, but set the machine state/mode information. More...
 
XED_DLL_EXPORT void xed_decoded_inst_zero_keep_mode (xed_decoded_inst_t *p)
 Zero the decode structure, but preserve the existing machine state/mode information. More...
 
XED_DLL_EXPORT void xed_decoded_inst_zero (xed_decoded_inst_t *p)
 Zero the decode structure completely. More...
 
static XED_INLINE void xed_decoded_inst_set_mode (xed_decoded_inst_t *p, xed_machine_mode_enum_t mmode, xed_address_width_enum_t stack_addr_width)
 Set the machine mode and stack addressing width directly. More...
 
XED_DLL_EXPORT void xed_decoded_inst_zero_keep_mode_from_operands (xed_decoded_inst_t *p, const xed_operand_values_t *operands)
 Zero the decode structure, but copy the existing machine state/mode information from the supplied operands pointer. More...
 

xed_decoded_inst_t Length

static XED_INLINE xed_uint_t xed_decoded_inst_get_length (const xed_decoded_inst_t *p)
 Return the length of the decoded instruction in bytes. More...
 

xed_decoded_inst_t get Byte

static XED_INLINE xed_uint8_t xed_decoded_inst_get_byte (const xed_decoded_inst_t *p, xed_uint_t byte_index)
 Read itext byte. More...
 

Modes

static XED_INLINE xed_uint_t xed_decoded_inst_get_machine_mode_bits (const xed_decoded_inst_t *p)
 Returns 16/32/64 indicating the machine mode with in bits. More...
 
static XED_INLINE xed_uint_t xed_decoded_inst_get_stack_address_mode_bits (const xed_decoded_inst_t *p)
 Returns 16/32/64 indicating the stack addressing mode with in bits. More...
 
XED_DLL_EXPORT xed_uint32_t xed_decoded_inst_get_operand_width (const xed_decoded_inst_t *p)
 Returns the operand width in bits: 8/16/32/64. More...
 
static XED_INLINE xed_chip_enum_t xed_decoded_inst_get_input_chip (const xed_decoded_inst_t *p)
 Return the user-specified xed_chip_enum_t chip name, or XED_CHIP_INVALID if not set. More...
 
static XED_INLINE void xed_decoded_inst_set_input_chip (xed_decoded_inst_t *p, xed_chip_enum_t chip)
 Set a user-specified xed_chip_enum_t chip name for restricting decode. More...
 
XED_DLL_EXPORT xed_bool_t xed_decoded_inst_valid_for_chip (xed_decoded_inst_t const *const p, xed_chip_enum_t chip)
 Indicate if this decoded instruction is valid for the specified xed_chip_enum_t chip. More...
 

IFORM handling

static XED_INLINE xed_iform_enum_t xed_decoded_inst_get_iform_enum (const xed_decoded_inst_t *p)
 Return the instruction iform enum of type xed_iform_enum_t . More...
 
static XED_INLINE unsigned int xed_decoded_inst_get_iform_enum_dispatch (const xed_decoded_inst_t *p)
 Return the instruction zero-based iform number based on masking the corresponding xed_iform_enum_t. More...
 

xed_decoded_inst_t Operand Field Details

XED_DLL_EXPORT xed_reg_enum_t xed_decoded_inst_get_seg_reg (const xed_decoded_inst_t *p, unsigned int mem_idx)
 
XED_DLL_EXPORT xed_reg_enum_t xed_decoded_inst_get_base_reg (const xed_decoded_inst_t *p, unsigned int mem_idx)
 
XED_DLL_EXPORT xed_uint_t xed_decoded_inst_get_scale (const xed_decoded_inst_t *p, unsigned int mem_idx)
 
XED_DLL_EXPORT xed_int64_t xed_decoded_inst_get_memory_displacement (const xed_decoded_inst_t *p, unsigned int mem_idx)
 
XED_DLL_EXPORT xed_uint_t xed_decoded_inst_get_memory_displacement_width (const xed_decoded_inst_t *p, unsigned int mem_idx)
 Result in BYTES. More...
 
XED_DLL_EXPORT xed_uint_t xed_decoded_inst_get_memory_displacement_width_bits (const xed_decoded_inst_t *p, unsigned int mem_idx)
 Result in BITS. More...
 
XED_DLL_EXPORT xed_int32_t xed_decoded_inst_get_branch_displacement (const xed_decoded_inst_t *p)
 
XED_DLL_EXPORT xed_uint_t xed_decoded_inst_get_branch_displacement_width (const xed_decoded_inst_t *p)
 Result in BYTES. More...
 
XED_DLL_EXPORT xed_uint_t xed_decoded_inst_get_branch_displacement_width_bits (const xed_decoded_inst_t *p)
 Result in BITS. More...
 
XED_DLL_EXPORT xed_uint64_t xed_decoded_inst_get_unsigned_immediate (const xed_decoded_inst_t *p)
 
XED_DLL_EXPORT xed_uint_t xed_decoded_inst_get_immediate_is_signed (const xed_decoded_inst_t *p)
 Return true if the first immediate (IMM0) is signed. More...
 
XED_DLL_EXPORT xed_uint_t xed_decoded_inst_get_immediate_width (const xed_decoded_inst_t *p)
 Return the immediate width in BYTES. More...
 
XED_DLL_EXPORT xed_uint_t xed_decoded_inst_get_immediate_width_bits (const xed_decoded_inst_t *p)
 Return the immediate width in BITS. More...
 
XED_DLL_EXPORT xed_int32_t xed_decoded_inst_get_signed_immediate (const xed_decoded_inst_t *p)
 
static XED_INLINE xed_uint8_t xed_decoded_inst_get_second_immediate (const xed_decoded_inst_t *p)
 Return the second immediate. More...
 
XED_DLL_EXPORT xed_reg_enum_t xed_decoded_inst_get_reg (const xed_decoded_inst_t *p, xed_operand_enum_t reg_operand)
 Return the specified register operand. More...
 
XED_DLL_EXPORT const xed_simple_flag_txed_decoded_inst_get_rflags_info (const xed_decoded_inst_t *p)
 See the comment on xed_decoded_inst_uses_rflags(). More...
 
XED_DLL_EXPORT xed_bool_t xed_decoded_inst_uses_rflags (const xed_decoded_inst_t *p)
 This returns 1 if the flags are read or written. More...
 
XED_DLL_EXPORT xed_uint_t xed_decoded_inst_number_of_memory_operands (const xed_decoded_inst_t *p)
 
XED_DLL_EXPORT xed_bool_t xed_decoded_inst_mem_read (const xed_decoded_inst_t *p, unsigned int mem_idx)
 
XED_DLL_EXPORT xed_bool_t xed_decoded_inst_mem_written (const xed_decoded_inst_t *p, unsigned int mem_idx)
 
XED_DLL_EXPORT xed_bool_t xed_decoded_inst_mem_written_only (const xed_decoded_inst_t *p, unsigned int mem_idx)
 
XED_DLL_EXPORT xed_bool_t xed_decoded_inst_conditionally_writes_registers (const xed_decoded_inst_t *p)
 
XED_DLL_EXPORT unsigned int xed_decoded_inst_get_memory_operand_length (const xed_decoded_inst_t *p, unsigned int memop_idx)
 returns bytes More...
 
XED_DLL_EXPORT unsigned int xed_decoded_inst_get_memop_address_width (const xed_decoded_inst_t *p, xed_uint_t memop_idx)
 Returns the addressing width in bits (16,32,64) for MEM0 (memop_idx==0) or MEM1 (memop_idx==1). More...
 
XED_DLL_EXPORT xed_bool_t xed_decoded_inst_is_prefetch (const xed_decoded_inst_t *p)
 Returns true if the instruction is a prefetch. More...
 
XED_DLL_EXPORT xed_bool_t xed_decoded_inst_is_broadcast (const xed_decoded_inst_t *p)
 Return 1 for broadcast instructions or AVX512 load-op instructions using the broadcast feature 0 otherwise. More...
 
XED_DLL_EXPORT xed_bool_t xed_decoded_inst_is_broadcast_instruction (const xed_decoded_inst_t *p)
 Return 1 for broadcast instruction. More...
 
XED_DLL_EXPORT xed_bool_t xed_decoded_inst_uses_embedded_broadcast (const xed_decoded_inst_t *p)
 Return 1 for AVX512 load-op instructions using the broadcast feature, 0 otherwise. More...
 
XED_DLL_EXPORT xed_reg_enum_t xed_decoded_inst_get_index_reg (const xed_decoded_inst_t *p, unsigned int mem_idx)
 

xed_decoded_inst_t Modification

XED_DLL_EXPORT void xed_decoded_inst_set_scale (xed_decoded_inst_t *p, xed_uint_t scale)
 
XED_DLL_EXPORT void xed_decoded_inst_set_memory_displacement (xed_decoded_inst_t *p, xed_int64_t disp, xed_uint_t length_bytes)
 Set the memory displacement using a BYTE length. More...
 
XED_DLL_EXPORT void xed_decoded_inst_set_branch_displacement (xed_decoded_inst_t *p, xed_int32_t disp, xed_uint_t length_bytes)
 Set the branch displacement using a BYTE length. More...
 
XED_DLL_EXPORT void xed_decoded_inst_set_immediate_signed (xed_decoded_inst_t *p, xed_int32_t x, xed_uint_t length_bytes)
 Set the signed immediate a BYTE length. More...
 
XED_DLL_EXPORT void xed_decoded_inst_set_immediate_unsigned (xed_decoded_inst_t *p, xed_uint64_t x, xed_uint_t length_bytes)
 Set the unsigned immediate a BYTE length. More...
 
XED_DLL_EXPORT void xed_decoded_inst_set_memory_displacement_bits (xed_decoded_inst_t *p, xed_int64_t disp, xed_uint_t length_bits)
 Set the memory displacement a BITS length. More...
 
XED_DLL_EXPORT void xed_decoded_inst_set_branch_displacement_bits (xed_decoded_inst_t *p, xed_int32_t disp, xed_uint_t length_bits)
 Set the branch displacement a BITS length. More...
 
XED_DLL_EXPORT void xed_decoded_inst_set_immediate_signed_bits (xed_decoded_inst_t *p, xed_int32_t x, xed_uint_t length_bits)
 Set the signed immediate a BITS length. More...
 
XED_DLL_EXPORT void xed_decoded_inst_set_immediate_unsigned_bits (xed_decoded_inst_t *p, xed_uint64_t x, xed_uint_t length_bits)
 Set the unsigned immediate a BITS length. More...
 

xed_decoded_inst_t User Data Field

static XED_INLINE xed_uint64_t xed_decoded_inst_get_user_data (xed_decoded_inst_t *p)
 Return a user data field for arbitrary use by the user after decoding. More...
 
static XED_INLINE void xed_decoded_inst_set_user_data (xed_decoded_inst_t *p, xed_uint64_t new_value)
 Modify the user data field. More...
 

xed_decoded_inst_t Classifiers

XED_DLL_EXPORT xed_bool_t xed_classify_avx512 (const xed_decoded_inst_t *d)
 True for AVX512 (EVEX-encoded) SIMD and (VEX encoded) K-mask instructions. More...
 
XED_DLL_EXPORT xed_bool_t xed_classify_avx512_maskop (const xed_decoded_inst_t *d)
 True for AVX512 (VEX-encoded) K-mask operations. More...
 
XED_DLL_EXPORT xed_bool_t xed_classify_avx (const xed_decoded_inst_t *d)
 True for AVX/AVX2 SIMD VEX-encoded operations. More...
 
XED_DLL_EXPORT xed_bool_t xed_classify_sse (const xed_decoded_inst_t *d)
 True for SSE/SSE2/etc. More...
 

xed_inst_t Template Operands Access

static XED_INLINE xed_operand_enum_t xed_operand_name (const xed_operand_t *p)
 
static XED_INLINE xed_operand_visibility_enum_t xed_operand_operand_visibility (const xed_operand_t *p)
 
static XED_INLINE xed_operand_type_enum_t xed_operand_type (const xed_operand_t *p)
 
static XED_INLINE xed_operand_element_xtype_enum_t xed_operand_xtype (const xed_operand_t *p)
 
static XED_INLINE xed_operand_width_enum_t xed_operand_width (const xed_operand_t *p)
 
XED_DLL_EXPORT xed_uint32_t xed_operand_width_bits (const xed_operand_t *p, const xed_uint32_t eosz)
 
static XED_INLINE xed_nonterminal_enum_t xed_operand_nonterminal_name (const xed_operand_t *p)
 
static XED_INLINE xed_reg_enum_t xed_operand_reg (const xed_operand_t *p)
 Careful with this one – use xed_decoded_inst_get_reg()! This one is probably not what you think it is. More...
 
static XED_INLINE xed_uint_t xed_operand_template_is_register (const xed_operand_t *p)
 Careful with this one; See xed_operand_is_register(). More...
 
static XED_INLINE xed_uint32_t xed_operand_imm (const xed_operand_t *p)
 
XED_DLL_EXPORT void xed_operand_print (const xed_operand_t *p, char *buf, int buflen)
 Print the operand p into the buffer buf, of length buflen. More...
 

xed_inst_t Template Operand Enum Name Classification

static XED_INLINE xed_uint_t xed_operand_is_register (xed_operand_enum_t name)
 Tests the enum for inclusion in XED_OPERAND_REG0 through XED_OPERAND_REG15. More...
 
static XED_INLINE xed_uint_t xed_operand_is_memory_addressing_register (xed_operand_enum_t name)
 Tests the enum for inclusion in XED_OPERAND_{BASE0,BASE1,INDEX,SEG0,SEG1}. More...
 

xed_inst_t Template Operand Read/Written

static XED_INLINE xed_operand_action_enum_t xed_operand_rw (const xed_operand_t *p)
 DEPRECATED: Returns the raw R/W action. More...
 
XED_DLL_EXPORT xed_uint_t xed_operand_read (const xed_operand_t *p)
 If the operand is read, including conditional reads. More...
 
XED_DLL_EXPORT xed_uint_t xed_operand_read_only (const xed_operand_t *p)
 If the operand is read-only, including conditional reads. More...
 
XED_DLL_EXPORT xed_uint_t xed_operand_written (const xed_operand_t *p)
 If the operand is written, including conditional writes. More...
 
XED_DLL_EXPORT xed_uint_t xed_operand_written_only (const xed_operand_t *p)
 If the operand is written-only, including conditional writes. More...
 
XED_DLL_EXPORT xed_uint_t xed_operand_read_and_written (const xed_operand_t *p)
 If the operand is read-and-written, conditional reads and conditional writes. More...
 
XED_DLL_EXPORT xed_uint_t xed_operand_conditional_read (const xed_operand_t *p)
 If the operand has a conditional read (may also write) More...
 
XED_DLL_EXPORT xed_uint_t xed_operand_conditional_write (const xed_operand_t *p)
 If the operand has a conditional write (may also read) More...
 

xed_inst_t Template Instruction Information

XED_DLL_EXPORT unsigned int xed_inst_cpl (const xed_inst_t *p)
 xed_inst_cpl() is DEPRECATED. More...
 
static XED_INLINE unsigned int xed_inst_noperands (const xed_inst_t *p)
 Number of instruction operands. More...
 
XED_DLL_EXPORT const xed_operand_txed_inst_operand (const xed_inst_t *p, unsigned int i)
 Obtain a pointer to an individual operand. More...
 
static XED_INLINE xed_iform_enum_t xed_inst_iform_enum (const xed_inst_t *p)
 
static XED_INLINE xed_iclass_enum_t xed_inst_iclass (const xed_inst_t *p)
 
static XED_INLINE xed_category_enum_t xed_inst_category (const xed_inst_t *p)
 
static XED_INLINE xed_extension_enum_t xed_inst_extension (const xed_inst_t *p)
 
static XED_INLINE xed_isa_set_enum_t xed_inst_isa_set (const xed_inst_t *p)
 
XED_DLL_EXPORT xed_uint32_t xed_inst_flag_info_index (const xed_inst_t *p)
 

xed_inst_t Attribute access

XED_DLL_EXPORT xed_uint32_t xed_inst_get_attribute (const xed_inst_t *p, xed_attribute_enum_t attr)
 Scan for the attribute attr and return 1 if it is found, 0 otherwise. More...
 
XED_DLL_EXPORT xed_attributes_t xed_inst_get_attributes (const xed_inst_t *p)
 Return the attributes bit vector. More...
 
XED_DLL_EXPORT unsigned int xed_attribute_max (void)
 Return the maximum number of defined attributes, independent of any instruction. More...
 
XED_DLL_EXPORT xed_attribute_enum_t xed_attribute (unsigned int i)
 Return the i'th global attribute in a linear sequence, independent of any instruction. More...
 

Exceptions

static XED_INLINE xed_exception_enum_t xed_inst_exception (const xed_inst_t *p)
 Return xed_exception_enum_t if present for the specified instruction. More...
 

REP-like prefix removal and addition

XED_DLL_EXPORT xed_iclass_enum_t xed_rep_remove (xed_iclass_enum_t x)
 // return the corresponding xed_iclass_enum_t without that prefix. More...
 
XED_DLL_EXPORT xed_iclass_enum_t xed_repe_map (xed_iclass_enum_t iclass)
 

return the corresponding xed_iclass_enum_t with a REPE prefix. More...
 
XED_DLL_EXPORT xed_iclass_enum_t xed_repne_map (xed_iclass_enum_t iclass)
 

and return the corresponding xed_iclass_enum_t with a REPNE prefix. More...
 
XED_DLL_EXPORT xed_iclass_enum_t xed_rep_map (xed_iclass_enum_t iclass)
 

return the corresponding xed_iclass_enum_t with a REP prefix. More...
 
XED_DLL_EXPORT xed_iclass_enum_t xed_norep_map (xed_iclass_enum_t iclass)
 

REP/REPNE/REPE prefix and return the corresponding xed_iclass_enum_t without that prefix. More...
 

Detailed Description

To decode an instruction you are required to provide

The machine state is passed in to decoder via the class xed_state_t . That state is set via the constructor of each xed_decoded_inst_t .

The xed_decoded_inst_t contains the results of decoding after a successful decode.

The xed_decoded_inst_t includes an array of xed_operand_values_t and that is where most of the information about the operands, resources etc. are stored. See the Operand storage fields interface. The array is indexed by the xed_operand_enum_t enumeration. Do not access it directly though; use the interface functions in the Operand storage fields interface for portability.

After decoding the xed_decoded_inst_t contains a pointer to the xed_inst_t which acts like a kind of template giving static information about the decoded instruction: what are the types of the operands, the iclass, category extension, etc. The xed_inst_t is accessed via the xed_decoded_inst_inst(cont xed_decoded_inst_t* xedd) function.

Before every decode, you must call one of the initialization functions. The most common case would be to use xed_decoded_inst_zero_keep_mode() or maybe xed_decoded_inst_zero_set_mode().

Typedef Documentation

◆ xed_decoded_inst_t

The main container for instructions.

After decode, it holds an array of operands with derived information from decode and also valid xed_inst_t pointer which describes the operand templates and the operand order. See Decoding Instructions for API documentation.

◆ xed_inst_t

typedef struct xed_inst_s xed_inst_t

constant information about a decoded instruction form, including the pointer to the constant operand properties xed_operand_t for this instruction form.

◆ xed_operand_t

typedef struct xed_operand_s xed_operand_t

Constant information about an individual generic operand, like an operand template, describing the operand properties.

See Decoding Instructions for API information.

Function Documentation

◆ xed_attribute()

XED_DLL_EXPORT xed_attribute_enum_t xed_attribute ( unsigned int  i)

Return the i'th global attribute in a linear sequence, independent of any instruction.

This is used for scanning and printing all attributes.

◆ xed_attribute_max()

XED_DLL_EXPORT unsigned int xed_attribute_max ( void  )

Return the maximum number of defined attributes, independent of any instruction.

◆ xed_classify_avx()

XED_DLL_EXPORT xed_bool_t xed_classify_avx ( const xed_decoded_inst_t d)

True for AVX/AVX2 SIMD VEX-encoded operations.

Does not include BMI/BMI2 instructions.

◆ xed_classify_avx512()

XED_DLL_EXPORT xed_bool_t xed_classify_avx512 ( const xed_decoded_inst_t d)

True for AVX512 (EVEX-encoded) SIMD and (VEX encoded) K-mask instructions.

◆ xed_classify_avx512_maskop()

XED_DLL_EXPORT xed_bool_t xed_classify_avx512_maskop ( const xed_decoded_inst_t d)

True for AVX512 (VEX-encoded) K-mask operations.

◆ xed_classify_sse()

XED_DLL_EXPORT xed_bool_t xed_classify_sse ( const xed_decoded_inst_t d)

True for SSE/SSE2/etc.

SIMD operations. Includes AES and PCLMULQDQ

◆ xed_decode()

XED_DLL_EXPORT xed_error_enum_t xed_decode ( xed_decoded_inst_t xedd,
const xed_uint8_t *  itext,
const unsigned int  bytes 
)

This is the main interface to the decoder.

Parameters
xeddthe decoded instruction of type xed_decoded_inst_t . Mode/state sent in via xedd; See the xed_state_t
itextthe pointer to the array of instruction text bytes
bytesthe length of the itext input array. 1 to 15 bytes, anything more is ignored.
Returns
xed_error_enum_t indicating success (XED_ERROR_NONE) or failure. Note failure can be due to not enough bytes in the input array.

The maximum instruction is 15B and XED will tell you how long the actual instruction is via an API function call xed_decoded_inst_get_length(). However, it is not always safe or advisable for XED to read 15 bytes if the decode location is at the boundary of some sort of protection limit. For example, if one is decoding near the end of a page and the XED user does not want to cause extra page faults, one might send in the number of bytes that would stop at the page boundary. In this case, XED might not be able to decode the instruction and would return an error. The XED user would then have to decide if it was safe to touch the next page and try again to decode with more bytes. Also sometimes the user process does not have read access to the next page and this allows the user to prevent XED from causing process termination by limiting the memory range that XED will access.

◆ xed_decode_with_features()

XED_DLL_EXPORT xed_error_enum_t xed_decode_with_features ( xed_decoded_inst_t xedd,
const xed_uint8_t *  itext,
const unsigned int  bytes,
xed_chip_features_t features 
)

See xed_decode().

This version of the decode API adds a CPUID feature vector to support restricting decode based on both a specified chip via xed_decoded_inst_set_input_chip() and a modify-able cpuid feature vector obtained from xed_get_chip_features().

◆ xed_decoded_inst_conditionally_writes_registers()

XED_DLL_EXPORT xed_bool_t xed_decoded_inst_conditionally_writes_registers ( const xed_decoded_inst_t p)

◆ xed_decoded_inst_get_attribute()

XED_DLL_EXPORT xed_uint32_t xed_decoded_inst_get_attribute ( const xed_decoded_inst_t p,
xed_attribute_enum_t  attr 
)

Returns 1 if the attribute is defined for this instruction.

◆ xed_decoded_inst_get_attributes()

XED_DLL_EXPORT xed_attributes_t xed_decoded_inst_get_attributes ( const xed_decoded_inst_t p)

Returns the attribute bitvector.

◆ xed_decoded_inst_get_base_reg()

XED_DLL_EXPORT xed_reg_enum_t xed_decoded_inst_get_base_reg ( const xed_decoded_inst_t p,
unsigned int  mem_idx 
)

◆ xed_decoded_inst_get_branch_displacement()

XED_DLL_EXPORT xed_int32_t xed_decoded_inst_get_branch_displacement ( const xed_decoded_inst_t p)

◆ xed_decoded_inst_get_branch_displacement_width()

XED_DLL_EXPORT xed_uint_t xed_decoded_inst_get_branch_displacement_width ( const xed_decoded_inst_t p)

Result in BYTES.

◆ xed_decoded_inst_get_branch_displacement_width_bits()

XED_DLL_EXPORT xed_uint_t xed_decoded_inst_get_branch_displacement_width_bits ( const xed_decoded_inst_t p)

Result in BITS.

◆ xed_decoded_inst_get_byte()

static XED_INLINE xed_uint8_t xed_decoded_inst_get_byte ( const xed_decoded_inst_t p,
xed_uint_t  byte_index 
)
static

Read itext byte.

Read a whole byte from the normal input bytes.

◆ xed_decoded_inst_get_category()

static XED_INLINE xed_category_enum_t xed_decoded_inst_get_category ( const xed_decoded_inst_t p)
static

Return the instruction xed_category_enum_t enumeration.

◆ xed_decoded_inst_get_extension()

static XED_INLINE xed_extension_enum_t xed_decoded_inst_get_extension ( const xed_decoded_inst_t p)
static

Return the instruction xed_extension_enum_t enumeration.

◆ xed_decoded_inst_get_iclass()

static XED_INLINE xed_iclass_enum_t xed_decoded_inst_get_iclass ( const xed_decoded_inst_t p)
static

Return the instruction xed_iclass_enum_t enumeration.

◆ xed_decoded_inst_get_iform_enum()

static XED_INLINE xed_iform_enum_t xed_decoded_inst_get_iform_enum ( const xed_decoded_inst_t p)
static

Return the instruction iform enum of type xed_iform_enum_t .

◆ xed_decoded_inst_get_iform_enum_dispatch()

static XED_INLINE unsigned int xed_decoded_inst_get_iform_enum_dispatch ( const xed_decoded_inst_t p)
static

Return the instruction zero-based iform number based on masking the corresponding xed_iform_enum_t.

This value is suitable for dispatching. The maximum value for a particular iclass is provided by xed_iform_max_per_iclass() .

◆ xed_decoded_inst_get_immediate_is_signed()

XED_DLL_EXPORT xed_uint_t xed_decoded_inst_get_immediate_is_signed ( const xed_decoded_inst_t p)

Return true if the first immediate (IMM0) is signed.

◆ xed_decoded_inst_get_immediate_width()

XED_DLL_EXPORT xed_uint_t xed_decoded_inst_get_immediate_width ( const xed_decoded_inst_t p)

Return the immediate width in BYTES.

◆ xed_decoded_inst_get_immediate_width_bits()

XED_DLL_EXPORT xed_uint_t xed_decoded_inst_get_immediate_width_bits ( const xed_decoded_inst_t p)

Return the immediate width in BITS.

◆ xed_decoded_inst_get_index_reg()

XED_DLL_EXPORT xed_reg_enum_t xed_decoded_inst_get_index_reg ( const xed_decoded_inst_t p,
unsigned int  mem_idx 
)

◆ xed_decoded_inst_get_input_chip()

static XED_INLINE xed_chip_enum_t xed_decoded_inst_get_input_chip ( const xed_decoded_inst_t p)
static

Return the user-specified xed_chip_enum_t chip name, or XED_CHIP_INVALID if not set.

◆ xed_decoded_inst_get_isa_set()

static XED_INLINE xed_isa_set_enum_t xed_decoded_inst_get_isa_set ( xed_decoded_inst_t const *const  p)
static

Return the instruction xed_isa_set_enum_t enumeration.

◆ xed_decoded_inst_get_length()

static XED_INLINE xed_uint_t xed_decoded_inst_get_length ( const xed_decoded_inst_t p)
static

Return the length of the decoded instruction in bytes.

◆ xed_decoded_inst_get_machine_mode_bits()

static XED_INLINE xed_uint_t xed_decoded_inst_get_machine_mode_bits ( const xed_decoded_inst_t p)
static

Returns 16/32/64 indicating the machine mode with in bits.

This is derived from the input mode information.

◆ xed_decoded_inst_get_memop_address_width()

XED_DLL_EXPORT unsigned int xed_decoded_inst_get_memop_address_width ( const xed_decoded_inst_t p,
xed_uint_t  memop_idx 
)

Returns the addressing width in bits (16,32,64) for MEM0 (memop_idx==0) or MEM1 (memop_idx==1).

This factors in things like whether or not the reference is an implicit stack push/pop reference, the machine mode and

◆ xed_decoded_inst_get_memory_displacement()

XED_DLL_EXPORT xed_int64_t xed_decoded_inst_get_memory_displacement ( const xed_decoded_inst_t p,
unsigned int  mem_idx 
)

◆ xed_decoded_inst_get_memory_displacement_width()

XED_DLL_EXPORT xed_uint_t xed_decoded_inst_get_memory_displacement_width ( const xed_decoded_inst_t p,
unsigned int  mem_idx 
)

Result in BYTES.

◆ xed_decoded_inst_get_memory_displacement_width_bits()

XED_DLL_EXPORT xed_uint_t xed_decoded_inst_get_memory_displacement_width_bits ( const xed_decoded_inst_t p,
unsigned int  mem_idx 
)

Result in BITS.

◆ xed_decoded_inst_get_memory_operand_length()

XED_DLL_EXPORT unsigned int xed_decoded_inst_get_memory_operand_length ( const xed_decoded_inst_t p,
unsigned int  memop_idx 
)

returns bytes

◆ xed_decoded_inst_get_modrm()

XED_DLL_EXPORT xed_uint8_t xed_decoded_inst_get_modrm ( const xed_decoded_inst_t p)

Returns the modrm byte.

◆ xed_decoded_inst_get_nprefixes()

XED_DLL_EXPORT xed_uint_t xed_decoded_inst_get_nprefixes ( const xed_decoded_inst_t p)

Returns the number of legacy prefixes.

◆ xed_decoded_inst_get_operand_width()

XED_DLL_EXPORT xed_uint32_t xed_decoded_inst_get_operand_width ( const xed_decoded_inst_t p)

Returns the operand width in bits: 8/16/32/64.

This is different than the xed_operand_values_get_effective_operand_width() which only returns 16/32/64. This factors in the BYTEOP attribute when computing its return value. This function provides a information for that is only useful for (scalable) GPR-operations. Individual operands have more specific information available from xed_decoded_inst_operand_element_size_bits()

◆ xed_decoded_inst_get_reg()

XED_DLL_EXPORT xed_reg_enum_t xed_decoded_inst_get_reg ( const xed_decoded_inst_t p,
xed_operand_enum_t  reg_operand 
)

Return the specified register operand.

The specifier is of type xed_operand_enum_t .

◆ xed_decoded_inst_get_rflags_info()

XED_DLL_EXPORT const xed_simple_flag_t* xed_decoded_inst_get_rflags_info ( const xed_decoded_inst_t p)

See the comment on xed_decoded_inst_uses_rflags().

This can return 0 if the flags are really not used by this instruction.

◆ xed_decoded_inst_get_scale()

XED_DLL_EXPORT xed_uint_t xed_decoded_inst_get_scale ( const xed_decoded_inst_t p,
unsigned int  mem_idx 
)

◆ xed_decoded_inst_get_second_immediate()

static XED_INLINE xed_uint8_t xed_decoded_inst_get_second_immediate ( const xed_decoded_inst_t p)
static

Return the second immediate.

◆ xed_decoded_inst_get_seg_reg()

XED_DLL_EXPORT xed_reg_enum_t xed_decoded_inst_get_seg_reg ( const xed_decoded_inst_t p,
unsigned int  mem_idx 
)

◆ xed_decoded_inst_get_signed_immediate()

XED_DLL_EXPORT xed_int32_t xed_decoded_inst_get_signed_immediate ( const xed_decoded_inst_t p)

◆ xed_decoded_inst_get_stack_address_mode_bits()

static XED_INLINE xed_uint_t xed_decoded_inst_get_stack_address_mode_bits ( const xed_decoded_inst_t p)
static

Returns 16/32/64 indicating the stack addressing mode with in bits.

This is derived from the input mode information.

◆ xed_decoded_inst_get_unsigned_immediate()

XED_DLL_EXPORT xed_uint64_t xed_decoded_inst_get_unsigned_immediate ( const xed_decoded_inst_t p)

◆ xed_decoded_inst_get_user_data()

static XED_INLINE xed_uint64_t xed_decoded_inst_get_user_data ( xed_decoded_inst_t p)
static

Return a user data field for arbitrary use by the user after decoding.

◆ xed_decoded_inst_has_mpx_prefix()

XED_DLL_EXPORT xed_uint32_t xed_decoded_inst_has_mpx_prefix ( const xed_decoded_inst_t p)

Returns 1 if the instruction has mpx prefix.

◆ xed_decoded_inst_inst()

static XED_INLINE const xed_inst_t* xed_decoded_inst_inst ( const xed_decoded_inst_t p)
static

Return the xed_inst_t structure for this instruction.

This is the route to the basic operands form information.

◆ xed_decoded_inst_is_broadcast()

XED_DLL_EXPORT xed_bool_t xed_decoded_inst_is_broadcast ( const xed_decoded_inst_t p)

Return 1 for broadcast instructions or AVX512 load-op instructions using the broadcast feature 0 otherwise.

Logical OR of xed_decoded_inst_is_broadcast_instruction() and xed_decoded_inst_uses_embedded_broadcast().

◆ xed_decoded_inst_is_broadcast_instruction()

XED_DLL_EXPORT xed_bool_t xed_decoded_inst_is_broadcast_instruction ( const xed_decoded_inst_t p)

Return 1 for broadcast instruction.

(NOT including AVX512 load-op instructions) 0 otherwise. Just a category check.

◆ xed_decoded_inst_is_prefetch()

XED_DLL_EXPORT xed_bool_t xed_decoded_inst_is_prefetch ( const xed_decoded_inst_t p)

Returns true if the instruction is a prefetch.

◆ xed_decoded_inst_is_xacquire()

XED_DLL_EXPORT xed_uint32_t xed_decoded_inst_is_xacquire ( const xed_decoded_inst_t p)

Returns 1 if the instruction is xacquire.

◆ xed_decoded_inst_is_xrelease()

XED_DLL_EXPORT xed_uint32_t xed_decoded_inst_is_xrelease ( const xed_decoded_inst_t p)

Returns 1 if the instruction is xrelease.

◆ xed_decoded_inst_masked_vector_operation()

XED_DLL_EXPORT xed_bool_t xed_decoded_inst_masked_vector_operation ( xed_decoded_inst_t p)

Returns 1 iff the instruction uses destination-masking.

This is 0 for blend operations that use their mask field as a control.

◆ xed_decoded_inst_masking()

XED_DLL_EXPORT xed_bool_t xed_decoded_inst_masking ( const xed_decoded_inst_t p)

Returns true if the instruction uses write-masking.

◆ xed_decoded_inst_mem_read()

XED_DLL_EXPORT xed_bool_t xed_decoded_inst_mem_read ( const xed_decoded_inst_t p,
unsigned int  mem_idx 
)

◆ xed_decoded_inst_mem_written()

XED_DLL_EXPORT xed_bool_t xed_decoded_inst_mem_written ( const xed_decoded_inst_t p,
unsigned int  mem_idx 
)

◆ xed_decoded_inst_mem_written_only()

XED_DLL_EXPORT xed_bool_t xed_decoded_inst_mem_written_only ( const xed_decoded_inst_t p,
unsigned int  mem_idx 
)

◆ xed_decoded_inst_merging()

XED_DLL_EXPORT xed_bool_t xed_decoded_inst_merging ( const xed_decoded_inst_t p)

Returns true if the instruction uses write-masking with merging.

◆ xed_decoded_inst_noperands()

static XED_INLINE unsigned int xed_decoded_inst_noperands ( const xed_decoded_inst_t p)
static

Return the number of operands.

◆ xed_decoded_inst_number_of_memory_operands()

XED_DLL_EXPORT xed_uint_t xed_decoded_inst_number_of_memory_operands ( const xed_decoded_inst_t p)

◆ xed_decoded_inst_operand_action()

XED_DLL_EXPORT xed_operand_action_enum_t xed_decoded_inst_operand_action ( const xed_decoded_inst_t p,
unsigned int  operand_index 
)

Interpret the operand action in light of AVX512 masking and zeroing/merging.

If masking and merging are used together, the dest operand may also be read. If masking and merging are used together, the elemnents of dest operand register may be conditionally written (so that input values live on in the output register).

◆ xed_decoded_inst_operand_element_size_bits()

XED_DLL_EXPORT unsigned int xed_decoded_inst_operand_element_size_bits ( const xed_decoded_inst_t p,
unsigned int  operand_index 
)

Return the size of an element in bits (for SSE and AVX operands)

◆ xed_decoded_inst_operand_element_type()

XED_DLL_EXPORT xed_operand_element_type_enum_t xed_decoded_inst_operand_element_type ( const xed_decoded_inst_t p,
unsigned int  operand_index 
)

Return the type of an element of type xed_operand_element_type_enum_t (for SSE and AVX operands)

◆ xed_decoded_inst_operand_elements()

XED_DLL_EXPORT unsigned int xed_decoded_inst_operand_elements ( const xed_decoded_inst_t p,
unsigned int  operand_index 
)

Return the number of element in the operand (for SSE and AVX operands)

◆ xed_decoded_inst_operand_length()

XED_DLL_EXPORT unsigned int xed_decoded_inst_operand_length ( const xed_decoded_inst_t p,
unsigned int  operand_index 
)

Deprecated – returns the length in bytes of the operand_index'th operand.

Use xed_decoded_inst_operand_length_bits() instead.

◆ xed_decoded_inst_operand_length_bits()

XED_DLL_EXPORT unsigned int xed_decoded_inst_operand_length_bits ( const xed_decoded_inst_t p,
unsigned int  operand_index 
)

Return the length in bits of the operand_index'th operand.

◆ xed_decoded_inst_operands()

static XED_INLINE xed_operand_values_t* xed_decoded_inst_operands ( xed_decoded_inst_t p)
static

Obtain a non-constant pointer to the operands.

◆ xed_decoded_inst_operands_const()

static XED_INLINE const xed_operand_values_t* xed_decoded_inst_operands_const ( const xed_decoded_inst_t p)
static

Obtain a constant pointer to the operands.

◆ xed_decoded_inst_set_branch_displacement()

XED_DLL_EXPORT void xed_decoded_inst_set_branch_displacement ( xed_decoded_inst_t p,
xed_int32_t  disp,
xed_uint_t  length_bytes 
)

Set the branch displacement using a BYTE length.

◆ xed_decoded_inst_set_branch_displacement_bits()

XED_DLL_EXPORT void xed_decoded_inst_set_branch_displacement_bits ( xed_decoded_inst_t p,
xed_int32_t  disp,
xed_uint_t  length_bits 
)

Set the branch displacement a BITS length.

◆ xed_decoded_inst_set_immediate_signed()

XED_DLL_EXPORT void xed_decoded_inst_set_immediate_signed ( xed_decoded_inst_t p,
xed_int32_t  x,
xed_uint_t  length_bytes 
)

Set the signed immediate a BYTE length.

◆ xed_decoded_inst_set_immediate_signed_bits()

XED_DLL_EXPORT void xed_decoded_inst_set_immediate_signed_bits ( xed_decoded_inst_t p,
xed_int32_t  x,
xed_uint_t  length_bits 
)

Set the signed immediate a BITS length.

◆ xed_decoded_inst_set_immediate_unsigned()

XED_DLL_EXPORT void xed_decoded_inst_set_immediate_unsigned ( xed_decoded_inst_t p,
xed_uint64_t  x,
xed_uint_t  length_bytes 
)

Set the unsigned immediate a BYTE length.

◆ xed_decoded_inst_set_immediate_unsigned_bits()

XED_DLL_EXPORT void xed_decoded_inst_set_immediate_unsigned_bits ( xed_decoded_inst_t p,
xed_uint64_t  x,
xed_uint_t  length_bits 
)

Set the unsigned immediate a BITS length.

◆ xed_decoded_inst_set_input_chip()

static XED_INLINE void xed_decoded_inst_set_input_chip ( xed_decoded_inst_t p,
xed_chip_enum_t  chip 
)
static

Set a user-specified xed_chip_enum_t chip name for restricting decode.

◆ xed_decoded_inst_set_memory_displacement()

XED_DLL_EXPORT void xed_decoded_inst_set_memory_displacement ( xed_decoded_inst_t p,
xed_int64_t  disp,
xed_uint_t  length_bytes 
)

Set the memory displacement using a BYTE length.

◆ xed_decoded_inst_set_memory_displacement_bits()

XED_DLL_EXPORT void xed_decoded_inst_set_memory_displacement_bits ( xed_decoded_inst_t p,
xed_int64_t  disp,
xed_uint_t  length_bits 
)

Set the memory displacement a BITS length.

◆ xed_decoded_inst_set_mode()

static XED_INLINE void xed_decoded_inst_set_mode ( xed_decoded_inst_t p,
xed_machine_mode_enum_t  mmode,
xed_address_width_enum_t  stack_addr_width 
)
static

Set the machine mode and stack addressing width directly.

This is NOT a full initialization; Call xed_decoded_inst_zero() before using this if you want a clean slate.

◆ xed_decoded_inst_set_scale()

XED_DLL_EXPORT void xed_decoded_inst_set_scale ( xed_decoded_inst_t p,
xed_uint_t  scale 
)

◆ xed_decoded_inst_set_user_data()

static XED_INLINE void xed_decoded_inst_set_user_data ( xed_decoded_inst_t p,
xed_uint64_t  new_value 
)
static

Modify the user data field.

◆ xed_decoded_inst_uses_embedded_broadcast()

XED_DLL_EXPORT xed_bool_t xed_decoded_inst_uses_embedded_broadcast ( const xed_decoded_inst_t p)

Return 1 for AVX512 load-op instructions using the broadcast feature, 0 otherwise.

◆ xed_decoded_inst_uses_rflags()

XED_DLL_EXPORT xed_bool_t xed_decoded_inst_uses_rflags ( const xed_decoded_inst_t p)

This returns 1 if the flags are read or written.

This will return 0 otherwise. This will return 0 if the flags are really not used by this instruction. For some shifts/rotates, XED puts a flags operand in the operand array before it knows if the flags are used because of mode-dependent masking effects on the immediate.

◆ xed_decoded_inst_valid()

static XED_INLINE xed_bool_t xed_decoded_inst_valid ( const xed_decoded_inst_t p)
static

Return true if the instruction is valid.

◆ xed_decoded_inst_valid_for_chip()

XED_DLL_EXPORT xed_bool_t xed_decoded_inst_valid_for_chip ( xed_decoded_inst_t const *const  p,
xed_chip_enum_t  chip 
)

Indicate if this decoded instruction is valid for the specified xed_chip_enum_t chip.

◆ xed_decoded_inst_vector_length_bits()

XED_DLL_EXPORT xed_uint_t xed_decoded_inst_vector_length_bits ( xed_decoded_inst_t const *const  p)

Returns 128, 256 or 512 for operations in the VEX, EVEX (or XOP) encoding space and returns 0 for (most) nonvector operations.

This usually the content of the VEX.L or EVEX.LL field, reinterpreted. Some GPR instructions (like the BMI1/BMI2) are encoded in the VEX space and return non-zero values from this API.

◆ xed_decoded_inst_zero()

XED_DLL_EXPORT void xed_decoded_inst_zero ( xed_decoded_inst_t p)

Zero the decode structure completely.

Re-initializes all operands.

◆ xed_decoded_inst_zero_keep_mode()

XED_DLL_EXPORT void xed_decoded_inst_zero_keep_mode ( xed_decoded_inst_t p)

Zero the decode structure, but preserve the existing machine state/mode information.

Re-initializes all operands.

◆ xed_decoded_inst_zero_keep_mode_from_operands()

XED_DLL_EXPORT void xed_decoded_inst_zero_keep_mode_from_operands ( xed_decoded_inst_t p,
const xed_operand_values_t operands 
)

Zero the decode structure, but copy the existing machine state/mode information from the supplied operands pointer.

Same as xed_decoded_inst_zero_keep_mode.

◆ xed_decoded_inst_zero_set_mode()

XED_DLL_EXPORT void xed_decoded_inst_zero_set_mode ( xed_decoded_inst_t p,
const xed_state_t dstate 
)

Zero the decode structure, but set the machine state/mode information.

Re-initializes all operands.

◆ xed_decoded_inst_zeroing()

XED_DLL_EXPORT xed_bool_t xed_decoded_inst_zeroing ( const xed_decoded_inst_t p)

Returns true if the instruction uses write-masking with zeroing.

◆ xed_ild_decode()

XED_DLL_EXPORT xed_error_enum_t xed_ild_decode ( xed_decoded_inst_t xedd,
const xed_uint8_t *  itext,
const unsigned int  bytes 
)

This function just does instruction length decoding.

It does not return a fully decoded instruction.

Parameters
xeddthe decoded instruction of type xed_decoded_inst_t . Mode/state sent in via xedd; See the xed_state_t .
itextthe pointer to the array of instruction text bytes
bytesthe length of the itext input array. 1 to 15 bytes, anything more is ignored.
Returns
xed_error_enum_t indicating success (XED_ERROR_NONE) or failure. Only two failure codes are valid for this function: XED_ERROR_BUFFER_TOO_SHORT and XED_ERROR_GENERAL_ERROR. In general this function cannot tell if the instruction is valid or not. For valid instructions, XED can figure out if enough bytes were provided to decode the instruction. If not enough were provided, XED returns XED_ERROR_BUFFER_TOO_SHORT. From this function, the XED_ERROR_GENERAL_ERROR is an indication that XED could not decode the instruction's length because the instruction was so invalid that even its length may across implmentations.

◆ xed_inst_category()

static XED_INLINE xed_category_enum_t xed_inst_category ( const xed_inst_t p)
static

◆ xed_inst_cpl()

XED_DLL_EXPORT unsigned int xed_inst_cpl ( const xed_inst_t p)

xed_inst_cpl() is DEPRECATED.

Please use "xed_decoded_inst_get_attribute(xedd, XED_ATTRIBUTE_RING0)" instead. Return the current privilege level (CPL) required for execution, 0 or

  1. If the value is zero, then the instruction can only execute in ring 0.

◆ xed_inst_exception()

static XED_INLINE xed_exception_enum_t xed_inst_exception ( const xed_inst_t p)
static

Return xed_exception_enum_t if present for the specified instruction.

This is currently only used for SSE and AVX instructions.

◆ xed_inst_extension()

static XED_INLINE xed_extension_enum_t xed_inst_extension ( const xed_inst_t p)
static

◆ xed_inst_flag_info_index()

XED_DLL_EXPORT xed_uint32_t xed_inst_flag_info_index ( const xed_inst_t p)

◆ xed_inst_get_attribute()

XED_DLL_EXPORT xed_uint32_t xed_inst_get_attribute ( const xed_inst_t p,
xed_attribute_enum_t  attr 
)

Scan for the attribute attr and return 1 if it is found, 0 otherwise.

◆ xed_inst_get_attributes()

XED_DLL_EXPORT xed_attributes_t xed_inst_get_attributes ( const xed_inst_t p)

Return the attributes bit vector.

◆ xed_inst_iclass()

static XED_INLINE xed_iclass_enum_t xed_inst_iclass ( const xed_inst_t p)
static

◆ xed_inst_iform_enum()

static XED_INLINE xed_iform_enum_t xed_inst_iform_enum ( const xed_inst_t p)
static

◆ xed_inst_isa_set()

static XED_INLINE xed_isa_set_enum_t xed_inst_isa_set ( const xed_inst_t p)
static

◆ xed_inst_noperands()

static XED_INLINE unsigned int xed_inst_noperands ( const xed_inst_t p)
static

Number of instruction operands.

◆ xed_inst_operand()

XED_DLL_EXPORT const xed_operand_t* xed_inst_operand ( const xed_inst_t p,
unsigned int  i 
)

Obtain a pointer to an individual operand.

◆ xed_inst_table_base()

XED_DLL_EXPORT const xed_inst_t* xed_inst_table_base ( void  )

Return the base of instruction table.

◆ xed_norep_map()

REP/REPNE/REPE prefix and return the corresponding xed_iclass_enum_t without that prefix.

If the input instruction does not have a REP/REPNE/REPE prefix, this function returns XED_ICLASS_INVALID.

◆ xed_operand_conditional_read()

XED_DLL_EXPORT xed_uint_t xed_operand_conditional_read ( const xed_operand_t p)

If the operand has a conditional read (may also write)

◆ xed_operand_conditional_write()

XED_DLL_EXPORT xed_uint_t xed_operand_conditional_write ( const xed_operand_t p)

If the operand has a conditional write (may also read)

◆ xed_operand_imm()

static XED_INLINE xed_uint32_t xed_operand_imm ( const xed_operand_t p)
static
Parameters
pan operand template, xed_operand_t. These operands represent branch displacements, memory displacements and various immediates

◆ xed_operand_is_memory_addressing_register()

static XED_INLINE xed_uint_t xed_operand_is_memory_addressing_register ( xed_operand_enum_t  name)
static

Tests the enum for inclusion in XED_OPERAND_{BASE0,BASE1,INDEX,SEG0,SEG1}.

Parameters
namethe operand name, type xed_operand_enum_t
Returns
1 if the operand name is for a memory addressing register operand, 0 otherwise. See also xed_operand_is_register .

◆ xed_operand_is_register()

static XED_INLINE xed_uint_t xed_operand_is_register ( xed_operand_enum_t  name)
static

Tests the enum for inclusion in XED_OPERAND_REG0 through XED_OPERAND_REG15.

Parameters
namethe operand name, type xed_operand_enum_t
Returns
1 if the operand name is REG0...REG15, 0 otherwise.

Note there are other registers for memory addressing; See xed_operand_is_memory_addressing_register .

◆ xed_operand_name()

static XED_INLINE xed_operand_enum_t xed_operand_name ( const xed_operand_t p)
static

◆ xed_operand_nonterminal_name()

static XED_INLINE xed_nonterminal_enum_t xed_operand_nonterminal_name ( const xed_operand_t p)
static

◆ xed_operand_operand_visibility()

static XED_INLINE xed_operand_visibility_enum_t xed_operand_operand_visibility ( const xed_operand_t p)
static

◆ xed_operand_print()

XED_DLL_EXPORT void xed_operand_print ( const xed_operand_t p,
char *  buf,
int  buflen 
)

Print the operand p into the buffer buf, of length buflen.

Parameters
pan operand template, xed_operand_t.
bufbuffer that gets filled in
buflenmaximum buffer length

◆ xed_operand_read()

XED_DLL_EXPORT xed_uint_t xed_operand_read ( const xed_operand_t p)

If the operand is read, including conditional reads.

◆ xed_operand_read_and_written()

XED_DLL_EXPORT xed_uint_t xed_operand_read_and_written ( const xed_operand_t p)

If the operand is read-and-written, conditional reads and conditional writes.

◆ xed_operand_read_only()

XED_DLL_EXPORT xed_uint_t xed_operand_read_only ( const xed_operand_t p)

If the operand is read-only, including conditional reads.

◆ xed_operand_reg()

static XED_INLINE xed_reg_enum_t xed_operand_reg ( const xed_operand_t p)
static

Careful with this one – use xed_decoded_inst_get_reg()! This one is probably not what you think it is.

It is only used for hard-coded registers implicit in the instruction encoding. Most likely you want to get the xed_operand_enum_t and then look up the instruction using xed_decoded_inst_get_reg(). The hard-coded registers are also available that way.

Parameters
pan operand template, xed_operand_t.
Returns
the implicit or suppressed registers, type xed_reg_enum_t

◆ xed_operand_rw()

static XED_INLINE xed_operand_action_enum_t xed_operand_rw ( const xed_operand_t p)
static

DEPRECATED: Returns the raw R/W action.

There are many cases for conditional reads and writes. See xed_decoded_inst_operand_action().

◆ xed_operand_template_is_register()

static XED_INLINE xed_uint_t xed_operand_template_is_register ( const xed_operand_t p)
static

Careful with this one; See xed_operand_is_register().

Parameters
pan operand template, xed_operand_t.
Returns
1 if the operand template represents are register-type operand.

Related functions: Use xed_decoded_inst_get_reg() to get the decoded name of /// the register, xed_reg_enum_t. Use xed_operand_is_register() to test xed_operand_enum_t names.

◆ xed_operand_type()

static XED_INLINE xed_operand_type_enum_t xed_operand_type ( const xed_operand_t p)
static
Returns
The xed_operand_type_enum_t of the operand template. This is probably not what you want.

◆ xed_operand_width()

static XED_INLINE xed_operand_width_enum_t xed_operand_width ( const xed_operand_t p)
static

◆ xed_operand_width_bits()

XED_DLL_EXPORT xed_uint32_t xed_operand_width_bits ( const xed_operand_t p,
const xed_uint32_t  eosz 
)
Parameters
pan operand template, xed_operand_t.
eoszeffective operand size of the instruction, 1 | 2 | 3 for 16 | 32 | 64 bits respectively. 0 is invalid.
Returns
the actual width of operand in bits. See xed_decoded_inst_operand_length_bits() for a more general solution.

◆ xed_operand_written()

XED_DLL_EXPORT xed_uint_t xed_operand_written ( const xed_operand_t p)

If the operand is written, including conditional writes.

◆ xed_operand_written_only()

XED_DLL_EXPORT xed_uint_t xed_operand_written_only ( const xed_operand_t p)

If the operand is written-only, including conditional writes.

◆ xed_operand_xtype()

static XED_INLINE xed_operand_element_xtype_enum_t xed_operand_xtype ( const xed_operand_t p)
static
Returns
The xed_operand_element_xtype_enum_t of the operand template. This is probably not what you want.

◆ xed_rep_map()

return the corresponding xed_iclass_enum_t with a REP prefix.

If the input instruction cannot have a REP prefix, this function returns XED_ICLASS_INVALID.

◆ xed_rep_remove()

// return the corresponding xed_iclass_enum_t without that prefix.

The return value differs from the other functions in this group: If the input iclass does not have REP/REPNE/REPE prefix, the function returns the original instruction.

◆ xed_repe_map()

return the corresponding xed_iclass_enum_t with a REPE prefix.

If the input instruction cannot have have a REPE prefix, this function returns XED_ICLASS_INVALID.

◆ xed_repne_map()

and return the corresponding xed_iclass_enum_t with a REPNE prefix.

If the input instruction cannot have a REPNE prefix, this function returns XED_ICLASS_INVALID.