Decoding Instructions


Detailed Description

To decode an instruction you are required to provide
  1. a machine state (operating mode and addressing widths)
  2. a pointer to the instruction text array of bytes
  3. a length of the text array

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().


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...

xed_inst_t Attribute access

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.
XED_DLL_EXPORT unsigned int xed_attribute_max ()
 Return the maximum number of defined attributes, independent of any instruction.
static XED_INLINE 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.
static XED_INLINE xed_uint32_t xed_inst_get_attributes (const xed_inst_t *p)
 Return the attributes bit vector.

xed_decoded_inst_t Operand Field Details

XED_DLL_EXPORT xed_bool_t xed_decoded_inst_conditionally_writes_registers (const xed_decoded_inst_t *p)
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_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.
XED_DLL_EXPORT xed_uint_t xed_decoded_inst_get_branch_displacement_width_bits (const xed_decoded_inst_t *p)
 Result in BITS.
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_DLL_EXPORT xed_uint_t xed_decoded_inst_get_immediate_width (const xed_decoded_inst_t *p)
 Return the immediate width in BYTES.
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_DLL_EXPORT xed_reg_enum_t xed_decoded_inst_get_index_reg (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.
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_DLL_EXPORT unsigned int xed_decoded_inst_get_memory_operand_length (const xed_decoded_inst_t *p, unsigned int memop_idx)
static XED_INLINE 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.
XED_DLL_EXPORT const xed_simple_flag_txed_decoded_inst_get_rflags_info (const xed_decoded_inst_t *p)
XED_DLL_EXPORT xed_uint_t xed_decoded_inst_get_scale (const xed_decoded_inst_t *p, unsigned int mem_idx)
static XED_INLINE xed_uint8_t xed_decoded_inst_get_second_immediate (const xed_decoded_inst_t *p)
 Return the second immediate.
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_int32_t xed_decoded_inst_get_signed_immediate (const xed_decoded_inst_t *p)
XED_DLL_EXPORT xed_uint64_t xed_decoded_inst_get_unsigned_immediate (const xed_decoded_inst_t *p)
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_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_uint_t xed_decoded_inst_number_of_memory_operands (const xed_decoded_inst_t *p)
XED_DLL_EXPORT xed_bool_t xed_decoded_inst_uses_rflags (const xed_decoded_inst_t *p)

xed_decoded_inst_t Printers

XED_DLL_EXPORT void xed_decoded_inst_dump (const xed_decoded_inst_t *p, char *buf, int buflen)
 Print out all the information about the decoded instruction to the buffer buf whose length is maximally buflen.
XED_DLL_EXPORT xed_bool_t xed_decoded_inst_dump_att_format (const xed_decoded_inst_t *p, char *buf, int buflen, xed_uint64_t runtime_address)
 Print the instructions with the destination operand on the right, with several exceptions (bound, invlpga, enter, and other instructions with two immediate operands).
XED_DLL_EXPORT xed_bool_t xed_decoded_inst_dump_att_format_context (const xed_decoded_inst_t *p, char *buf, int buflen, xed_uint64_t runtime_address, void *context)
 Print the instructions with the destination operand on the right, with several exceptions (bound, invlpga, enter, and other instructions with two immediate operands).
XED_DLL_EXPORT xed_bool_t xed_decoded_inst_dump_intel_format (const xed_decoded_inst_t *p, char *buf, int buflen, xed_uint64_t runtime_address)
 Print the instructions with the destination on the left.
XED_DLL_EXPORT xed_bool_t xed_decoded_inst_dump_intel_format_context (const xed_decoded_inst_t *p, char *buf, int buflen, xed_uint64_t runtime_address, void *context)
 Print the instructions with the destination on the left.
XED_DLL_EXPORT xed_bool_t xed_decoded_inst_dump_xed_format (const xed_decoded_inst_t *p, char *buf, int buflen, xed_uint64_t runtime_address)

modes

static XED_INLINE xed_uint_t xed_decoded_inst_get_address_mode (const xed_decoded_inst_t *p)
static XED_INLINE xed_uint_t xed_decoded_inst_get_mode (const xed_decoded_inst_t *p)
static XED_INLINE xed_uint_t xed_decoded_inst_get_stack_address_mode (const xed_decoded_inst_t *p)

xed_decoded_inst_t High-level accessors

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_DLL_EXPORT xed_uint32_t xed_decoded_inst_get_attributes (const xed_decoded_inst_t *p)
 Returns the attribute bitvector.
static XED_INLINE xed_category_enum_t xed_decoded_inst_get_category (const xed_decoded_inst_t *p)
 Return the instruction category enumeration.
static XED_INLINE xed_extension_enum_t xed_decoded_inst_get_extension (const xed_decoded_inst_t *p)
 Return the instruction extension enumeration.
static XED_INLINE xed_iclass_enum_t xed_decoded_inst_get_iclass (const xed_decoded_inst_t *p)
 Return the instruction class enumeration.
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.
static XED_INLINE xed_bool_t xed_decoded_inst_valid (const xed_decoded_inst_t *p)
 Return true if the instruction is valid.

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 .
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.
static XED_INLINE xed_uint_t xed_decoded_inst_get_old_iform (const xed_decoded_inst_t *p)
 DEPRECATED Return the instruction iform number.
XED_DLL_EXPORT xed_uint32_t xed_iform_max_per_iclass (xed_iclass_enum_t iclass)
 Return the maximum number of iforms for a particular iclass.

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.

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.
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.

xed_decoded_inst_t Operands: Number and Length

static XED_INLINE unsigned int xed_decoded_inst_noperands (const xed_decoded_inst_t *p)
 Return the number of operands.
XED_DLL_EXPORT unsigned int xed_decoded_inst_operand_length (const xed_decoded_inst_t *p, unsigned int operand_index)
 Return the length in bytes of the operand_index'th operand.

xed_decoded_inst_t Operands array access

static XED_INLINE xed_operand_values_txed_decoded_inst_operands (xed_decoded_inst_t *p)
 Obtain a non-constant pointer to the 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.

xed_decoded_inst_t Modification

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_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_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_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_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_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_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_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_DLL_EXPORT void xed_decoded_inst_set_scale (xed_decoded_inst_t *p, xed_uint_t scale)

xed_decoded_inst_t Initialization

XED_DLL_EXPORT void xed_decoded_inst_zero (xed_decoded_inst_t *p)
 Zero the decode structure completely.
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.
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.
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.

xed_inst_t Template Instruction Information

XED_DLL_EXPORT unsigned int xed_inst_cpl (const xed_inst_t *p)
 Return the current privilege level (CPL).
static XED_INLINE unsigned int xed_inst_noperands (const xed_inst_t *p)
 Number of instruction operands.
static XED_INLINE const xed_operand_txed_inst_operand (const xed_inst_t *p, unsigned int i)
 Obtain a pointer to an individual operand.

xed_inst_t Template Operand Read/Written

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_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_DLL_EXPORT xed_uint_t xed_operand_read (const xed_operand_t *p)
 If the operand is read, including conditional reads.
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_DLL_EXPORT xed_uint_t xed_operand_read_only (const xed_operand_t *p)
 If the operand is read-only, including conditional reads.
static XED_INLINE xed_operand_action_enum_t xed_operand_rw (const xed_operand_t *p)
 Returns the raw R/W action.
XED_DLL_EXPORT xed_uint_t xed_operand_written (const xed_operand_t *p)
 If the operand is written, including conditional writes.
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_inst_t Template Operands Access

static XED_INLINE xed_uint32_t xed_operand_imm (const xed_operand_t *p)
static XED_INLINE xed_operand_enum_t xed_operand_name (const xed_operand_t *p)
static XED_INLINE xed_nonterminal_enum_t xed_operand_nonterminal_name (const xed_operand_t *p)
static XED_INLINE xed_operand_visibility_enum_t xed_operand_operand_visibility (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.
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.
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().
static XED_INLINE xed_operand_type_enum_t xed_operand_type (const xed_operand_t *p)
static XED_INLINE xed_operand_width_enum_t xed_operand_width (const xed_operand_t *p)

xed_inst_t Template Operand Enum Name Classification

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}.
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.

Typedefs

typedef XED_DLL_EXPORT xed_decoded_inst_s xed_decoded_inst_t
 The main container for instructions.
typedef XED_DLL_EXPORT 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.
typedef XED_DLL_EXPORT xed_operand_s xed_operand_t
 Constant information about an individual generic operand, like an operand template, describing the operand properties.

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.


Typedef Documentation

typedef struct XED_DLL_EXPORT xed_decoded_inst_s 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.

typedef struct XED_DLL_EXPORT 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.

typedef struct XED_DLL_EXPORT 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_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_DLL_EXPORT unsigned int xed_attribute_max  ) 
 

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

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:
xedd the decoded instruction of type xed_decoded_inst_t . Mode/state sent in via xedd; See the xed_state_t
itext the pointer to the array of instruction text bytes
bytes the length of the itext input array. 1 to 15 bytes, anything more is ignored.
Returns:
xed_error_enum_t indiciating 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_DLL_EXPORT xed_bool_t xed_decoded_inst_conditionally_writes_registers const xed_decoded_inst_t p  ) 
 

XED_DLL_EXPORT void xed_decoded_inst_dump const xed_decoded_inst_t p,
char *  buf,
int  buflen
 

Print out all the information about the decoded instruction to the buffer buf whose length is maximally buflen.

XED_DLL_EXPORT xed_bool_t xed_decoded_inst_dump_att_format const xed_decoded_inst_t p,
char *  buf,
int  buflen,
xed_uint64_t  runtime_address
 

Print the instructions with the destination operand on the right, with several exceptions (bound, invlpga, enter, and other instructions with two immediate operands).

Also use instruction name suffixes to indicate operation width. Several instructions names are different as well. Recommendation: buflen must be more than 16 bytes, preferably at least 100 bytes.

Parameters:
p a xed_decoded_inst_t for a decoded instruction
buf a buffer to write the disassembly in to.
buflen maximum length of the disassembly buffer
runtime_address the address of the instruction being disassembled
Returns:
Returns 0 if the disassembly fails, 1 otherwise.

XED_DLL_EXPORT xed_bool_t xed_decoded_inst_dump_att_format_context const xed_decoded_inst_t p,
char *  buf,
int  buflen,
xed_uint64_t  runtime_address,
void *  context
 

Print the instructions with the destination operand on the right, with several exceptions (bound, invlpga, enter, and other instructions with two immediate operands).

Also use instruction name suffixes to indicate operation width. Several instructions names are different as well. buflen must be at least 100 bytes.

Parameters:
p a xed_decoded_inst_t for a decoded instruction
buf a buffer to write the disassembly in to.
buflen maximum length of the disassembly buffer
runtime_address the address of the instruction being disassembled
context A void* used only for the call back routine for symbolic disassembly if one is registered.
Returns:
Returns 0 if the disassembly fails, 1 otherwise.

XED_DLL_EXPORT xed_bool_t xed_decoded_inst_dump_intel_format const xed_decoded_inst_t p,
char *  buf,
int  buflen,
xed_uint64_t  runtime_address
 

Print the instructions with the destination on the left.

Use PTR qualifiers for memory access widths. Recommendation: buflen must be more than 16 bytes, preferably at least 100 bytes.

Parameters:
p a xed_decoded_inst_t for a decoded instruction
buf a buffer to write the disassembly in to.
buflen maximum length of the disassembly buffer
runtime_address the address of the instruction being disassembled
Returns:
Returns 0 if the disassembly fails, 1 otherwise.

XED_DLL_EXPORT xed_bool_t xed_decoded_inst_dump_intel_format_context const xed_decoded_inst_t p,
char *  buf,
int  buflen,
xed_uint64_t  runtime_address,
void *  context
 

Print the instructions with the destination on the left.

Use PTR qualifiers for memory access widths. Recommendation: buflen must be more than 16 bytes, preferably at least 100 bytes.

Parameters:
p a xed_decoded_inst_t for a decoded instruction
buf a buffer to write the disassembly in to.
buflen maximum length of the disassembly buffer
runtime_address the address of the instruction being disassembled
context A void* used only for the call back routine for symbolic disassembly if one is registered.
Returns:
Returns 0 if the disassembly fails, 1 otherwise.

XED_DLL_EXPORT xed_bool_t xed_decoded_inst_dump_xed_format const xed_decoded_inst_t p,
char *  buf,
int  buflen,
xed_uint64_t  runtime_address
 

Parameters:
p a xed_decoded_inst_t for a decoded instruction
buf a buffer to write the disassembly in to.
buflen maximum length of the disassembly buffer
runtime_address the address of the instruction being disassembled
Returns:
Returns 0 if the disassembly fails, 1 otherwise.

static XED_INLINE xed_uint_t xed_decoded_inst_get_address_mode const xed_decoded_inst_t p  )  [static]
 

Definition at line 152 of file xed-decoded-inst.h.

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_DLL_EXPORT xed_uint32_t xed_decoded_inst_get_attributes const xed_decoded_inst_t p  ) 
 

Returns the attribute bitvector.

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_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.

XED_DLL_EXPORT xed_uint_t xed_decoded_inst_get_branch_displacement_width_bits const xed_decoded_inst_t p  ) 
 

Result in BITS.

static XED_INLINE xed_category_enum_t xed_decoded_inst_get_category const xed_decoded_inst_t p  )  [static]
 

Return the instruction category enumeration.

Definition at line 182 of file xed-decoded-inst.h.

static XED_INLINE xed_extension_enum_t xed_decoded_inst_get_extension const xed_decoded_inst_t p  )  [static]
 

Return the instruction extension enumeration.

Definition at line 188 of file xed-decoded-inst.h.

static XED_INLINE xed_iclass_enum_t xed_decoded_inst_get_iclass const xed_decoded_inst_t p  )  [static]
 

Return the instruction class enumeration.

Definition at line 194 of file xed-decoded-inst.h.

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 .

Definition at line 213 of file xed-decoded-inst.h.

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() .

Definition at line 224 of file xed-decoded-inst.h.

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_DLL_EXPORT xed_uint_t xed_decoded_inst_get_immediate_width const xed_decoded_inst_t p  ) 
 

Return the immediate width in BYTES.

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_DLL_EXPORT xed_reg_enum_t xed_decoded_inst_get_index_reg const xed_decoded_inst_t p,
unsigned int  mem_idx
 

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.

Definition at line 138 of file xed-decoded-inst.h.

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.

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_DLL_EXPORT unsigned int xed_decoded_inst_get_memory_operand_length const xed_decoded_inst_t p,
unsigned int  memop_idx
 

static XED_INLINE xed_uint_t xed_decoded_inst_get_mode const xed_decoded_inst_t p  )  [static]
 

Definition at line 148 of file xed-decoded-inst.h.

static XED_INLINE xed_uint_t xed_decoded_inst_get_old_iform const xed_decoded_inst_t p  )  [static]
 

DEPRECATED Return the instruction iform number.

The iform is zero-based number of the different instances of each iclass.

Definition at line 240 of file xed-decoded-inst.h.

static XED_INLINE xed_reg_enum_t xed_decoded_inst_get_reg const xed_decoded_inst_t p,
xed_operand_enum_t  reg_operand
[static]
 

Return the specified register operand.

The specifier is of type xed_operand_enum_t .

Definition at line 388 of file xed-decoded-inst.h.

XED_DLL_EXPORT const xed_simple_flag_t* xed_decoded_inst_get_rflags_info const xed_decoded_inst_t p  ) 
 

XED_DLL_EXPORT xed_uint_t xed_decoded_inst_get_scale const xed_decoded_inst_t p,
unsigned int  mem_idx
 

static XED_INLINE xed_uint8_t xed_decoded_inst_get_second_immediate const xed_decoded_inst_t p  )  [static]
 

Return the second immediate.

Definition at line 382 of file xed-decoded-inst.h.

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_int32_t xed_decoded_inst_get_signed_immediate const xed_decoded_inst_t p  ) 
 

static XED_INLINE xed_uint_t xed_decoded_inst_get_stack_address_mode const xed_decoded_inst_t p  )  [static]
 

Definition at line 156 of file xed-decoded-inst.h.

XED_DLL_EXPORT xed_uint64_t xed_decoded_inst_get_unsigned_immediate const xed_decoded_inst_t p  ) 
 

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.

Definition at line 458 of file xed-decoded-inst.h.

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.

Definition at line 175 of file xed-decoded-inst.h.

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_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
 

static XED_INLINE unsigned int xed_decoded_inst_noperands const xed_decoded_inst_t p  )  [static]
 

Return the number of operands.

Definition at line 257 of file xed-decoded-inst.h.

XED_DLL_EXPORT xed_uint_t xed_decoded_inst_number_of_memory_operands const xed_decoded_inst_t p  ) 
 

XED_DLL_EXPORT unsigned int xed_decoded_inst_operand_length const xed_decoded_inst_t p,
unsigned int  operand_index
 

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

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.

Definition at line 111 of file xed-decoded-inst.h.

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.

Definition at line 105 of file xed-decoded-inst.h.

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_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_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_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_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_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_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_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_DLL_EXPORT void xed_decoded_inst_set_scale xed_decoded_inst_t p,
xed_uint_t  scale
 

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.

Definition at line 463 of file xed-decoded-inst.h.

XED_DLL_EXPORT xed_bool_t xed_decoded_inst_uses_rflags const xed_decoded_inst_t p  ) 
 

static XED_INLINE xed_bool_t xed_decoded_inst_valid const xed_decoded_inst_t p  )  [static]
 

Return true if the instruction is valid.

Definition at line 170 of file xed-decoded-inst.h.

XED_DLL_EXPORT void xed_decoded_inst_zero xed_decoded_inst_t p  ) 
 

Zero the decode structure completely.

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.

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.

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.

XED_DLL_EXPORT xed_uint32_t xed_iform_max_per_iclass xed_iclass_enum_t  iclass  ) 
 

Return the maximum number of iforms for a particular iclass.

This function returns valid data as soon as global data is initialized. (This function does not require a decoded instruction as input).

XED_DLL_EXPORT unsigned int xed_inst_cpl const xed_inst_t p  ) 
 

Return the current privilege level (CPL).

static XED_INLINE xed_uint32_t xed_inst_get_attribute const xed_inst_t p,
xed_attribute_enum_t  attr
[static]
 

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

Definition at line 303 of file xed-inst.h.

static XED_INLINE xed_uint32_t xed_inst_get_attributes const xed_inst_t p  )  [static]
 

Return the attributes bit vector.

Definition at line 311 of file xed-inst.h.

static XED_INLINE unsigned int xed_inst_noperands const xed_inst_t p  )  [static]
 

Number of instruction operands.

Definition at line 282 of file xed-inst.h.

static XED_INLINE const xed_operand_t* xed_inst_operand const xed_inst_t p,
unsigned int  i
[static]
 

Obtain a pointer to an individual operand.

Definition at line 288 of file xed-inst.h.

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_DLL_EXPORT xed_uint_t xed_operand_conditional_write const xed_operand_t p  ) 
 

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

static XED_INLINE xed_uint32_t xed_operand_imm const xed_operand_t p  )  [static]
 

Parameters:
p an operand template, xed_operand_t. These operands represent branch displacements, memory displacements and various immediates

Definition at line 146 of file xed-inst.h.

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:
name the 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 .

Definition at line 174 of file xed-inst.h.

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:
name the 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 .

Definition at line 166 of file xed-inst.h.

static XED_INLINE xed_operand_enum_t xed_operand_name const xed_operand_t p  )  [static]
 

Definition at line 84 of file xed-inst.h.

static XED_INLINE xed_nonterminal_enum_t xed_operand_nonterminal_name const xed_operand_t p  )  [static]
 

Definition at line 110 of file xed-inst.h.

static XED_INLINE xed_operand_visibility_enum_t xed_operand_operand_visibility const xed_operand_t p  )  [static]
 

Definition at line 90 of file xed-inst.h.

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:
p an operand template, xed_operand_t.
buf buffer that gets filled in
buflen maximum buffer length

XED_DLL_EXPORT xed_uint_t xed_operand_read const xed_operand_t p  ) 
 

If the operand is read, including conditional reads.

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_DLL_EXPORT xed_uint_t xed_operand_read_only const xed_operand_t p  ) 
 

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

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:
p an operand template, xed_operand_t.
Returns:
the hard-wired (implicit or suppressed) registers, type xed_reg_enum_t

Definition at line 123 of file xed-inst.h.

static XED_INLINE xed_operand_action_enum_t xed_operand_rw const xed_operand_t p  )  [static]
 

Returns the raw R/W action.

There are many cases for conditional reads and writes.

Definition at line 189 of file xed-inst.h.

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:
p an 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.

Definition at line 139 of file xed-inst.h.

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.

Definition at line 98 of file xed-inst.h.

static XED_INLINE xed_operand_width_enum_t xed_operand_width const xed_operand_t p  )  [static]
 

Definition at line 104 of file xed-inst.h.

XED_DLL_EXPORT xed_uint_t xed_operand_written const xed_operand_t p  ) 
 

If the operand is written, including conditional writes.

XED_DLL_EXPORT xed_uint_t xed_operand_written_only const xed_operand_t p  ) 
 

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


Generated on Thu May 15 03:15:09 2008 for XED2 by  doxygen 1.4.6