X86 Encoder Decoder
|
When you call xed_encode() to encode instruction you must pass: <ul> <li> an encode structure that includes a machine state ( #xed_state_t ) <li> a pointer to the instruction text <li> a length of the text array </ul> The class #xed_encoder_request_t includes a #xed_operand_values_t and that is where most of the information about the operands, resources etc. are stored. To add a REP or REPNE prefix to a an encoder request, set it in the encoder request directly by calling #xed_encoder_request_set_rep() or #xed_encoder_request_set_repne(). To get nondefault width operands, during encoding, you have to call #xed_encoder_request_set_effective_operand_width() . To set nondefault addressing widths, you must call #xed_encoder_request_set_effective_address_size(). To encode instructions you must set the following
in the #xed_encoder_request_t.
operand kind (XED_OPERAND_{AGEN,MEM0,MEM1,IMM0,IMM1,RELBR,PTR,REG0...REG15}
operand order
xed_encoder_request_set_operand_order(&req,operand_index, XED_OPERAND_*); where the operand_index is a sequential index starting at zero.
See An example of using the encoder for an example of using the encoder.