45 inline std::vector<std::uint8_t>
generate(xed_decoded_inst_t* inst,
51 std::vector<std::uint8_t> new_inst_bytes;
53 std::uint32_t inst_len = {};
54 std::uint8_t inst_buff[XED_MAX_INSTRUCTION_BYTES];
55 xed_encoder_request_t req;
57 xed_state_t istate{XED_MACHINE_MODE_LONG_64, XED_ADDRESS_WIDTH_64b};
58 xed_encoder_request_zero_set_mode(&req, &istate);
59 xed_encoder_request_set_effective_operand_width(&req, 64);
60 xed_encoder_request_set_iclass(&req, XED_ICLASS_PUSHFQ);
61 xed_encode(&req, inst_buff,
sizeof(inst_buff), &inst_len);
62 new_inst_bytes.insert(new_inst_bytes.end(), inst_buff, inst_buff + inst_len);
64 for (
auto cnt = 0u; cnt < num_transforms; ++cnt) {
66 0, std::numeric_limits<std::int32_t>::max());
70 auto transform_bytes = itr->second->native(inst, imm);
71 new_inst_bytes.insert(new_inst_bytes.end(), transform_bytes.begin(),
72 transform_bytes.end());
78 xed_encoder_request_zero_set_mode(&req, &istate);
79 xed_encoder_request_set_effective_operand_width(&req, 64);
80 xed_encoder_request_set_iclass(&req, XED_ICLASS_POPFQ);
81 xed_encode(&req, inst_buff,
sizeof(inst_buff), &inst_len);
82 new_inst_bytes.insert(new_inst_bytes.end(), inst_buff, inst_buff + inst_len);
87 return new_inst_bytes;
meta data about a relocation for a symbol
void add_transform(std::pair< obf::transform::transform_t *, std::uint32_t > entry)
adds a transformation to be applied to the relocation prior to writing it into the symbol.
std::vector< std::pair< obf::transform::transform_t *, std::uint32_t > > & get_transforms()
gets the vector of transformation.