X86 Encoder Decoder
|
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().