pub unsafe extern "C" fn instrlist_encode_to_copy(
drcontext: *mut c_void,
ilist: *mut instrlist_t,
copy_pc: *mut byte,
final_pc: *mut byte,
max_pc: *mut byte,
has_instr_jmp_targets: bool_,
) -> *mut byteExpand description
Encodes each instruction in \p ilist in turn in contiguous memory starting \p copy_pc in preparation for copying to \p final_pc. Any pc-relative instruction is encoded as though the instruction list were located at \p final_pc. This allows for direct copying of the encoded bytes to \p final_pc without re-relativization.
Returns the pc after all of the encodings, or NULL if any one of the encodings failed.
Uses the x86/x64 mode stored in each instr, not the mode of the current thread.
In order for instr_t operands to be encoded properly, \p has_instr_jmp_targets must be true. If \p has_instr_jmp_targets is true, the offset field of each instr_t in ilist will be overwritten, and if any instr_t targets are not in \p ilist, they must have their offset fields set with their offsets relative to pc.
If \p max_pc is non-NULL, computes the total size required to encode the instruction list before performing any encoding. If the whole list will not fit starting at \p copy_pc without exceeding \p max_pc, returns NULL without encoding anything. Otherwise encodes as normal. Note that x86 instructions can occupy up to 17 bytes each, so if \p max_pc is NULL, the caller should ensure the target location has enough room to avoid overflow.