void dump_operand(const xed_operand_t* op) { printf("%s ", xed_operand_enum_t2str(xed_operand_name(op))); printf("%s ", xed_operand_visibility_enum_t2str(xed_operand_operand_visibility(op))); printf("%s ", xed_operand_action_enum_t2str(xed_operand_rw(op))); printf("%s ", xed_operand_type_enum_t2str(xed_operand_type(op))); printf("%s ", xed_operand_element_xtype_enum_t2str(xed_operand_xtype(op))); if (xed_operand_type(op) == XED_OPERAND_TYPE_NT_LOOKUP_FN) printf("%s ", xed_nonterminal_enum_t2str(xed_operand_nonterminal_name(op))); if (xed_operand_type(op) == XED_OPERAND_TYPE_REG) printf("%s ", xed_reg_enum_t2str(xed_operand_reg(op))); }
void print_operands(xed_decoded_inst_t* xedd) { unsigned int i = 0; xed_inst_t const* const xi = xed_decoded_inst_inst(xedd); const unsigned int noperands = xed_inst_noperands(xi); for( i=0; i < noperands ; i++) { xed_operand_t const* op = xed_inst_operand(xi,i); xed_operand_enum_t op_name = xed_operand_name(op); if (xed_operand_is_register(op_name)) { xed_reg_enum_t reg = xed_decoded_inst_get_reg(xedd,op_name); xed_operand_action_enum_t rw = xed_operand_rw(op); printf("%2d: %5s %5s\n", i, xed_reg_enum_t2str(reg), xed_operand_action_enum_t2str(rw)); } } }