instr_encode

Function instr_encode 

Source
pub unsafe extern "C" fn instr_encode(
    drcontext: *mut c_void,
    instr: *mut instr_t,
    pc: *mut byte,
) -> *mut byte
Expand description

Encodes \p instr into the memory at \p pc. Uses the x86/x64 mode stored in instr, not the mode of the current thread. Returns the pc after the encoded instr, or NULL if the encoding failed. If instr is a cti with an instr_t target, the offset fields of instr and of the target must be set with the respective offsets of each instr_t! (instrlist_encode does this automatically, if the target is in the list). x86 instructions can occupy up to 17 bytes, so the caller should ensure the target location has enough room to avoid overflow. \note: In Thumb mode, some instructions have different behavior depending on whether they are in an IT block. To correctly encode such instructions, they should be encoded within an instruction list with the corresponding IT instruction using instrlist_encode().