Skip to main content

dr_save_arith_flags_to_xax

Function dr_save_arith_flags_to_xax 

Source
pub unsafe extern "C" fn dr_save_arith_flags_to_xax(
    drcontext: *mut c_void,
    ilist: *mut instrlist_t,
    where_: *mut instr_t,
)
Expand description

Inserts into \p ilist prior to \p where meta-instruction(s) to save the 6 arithmetic flags into xax. This currently uses DynamoRIO’s “lahf ; seto al” code sequence, which is faster and easier than pushf. If the caller wishes to use xax between saving and restoring these flags, they must save and restore xax, potentially using dr_save_reg()/dr_restore_reg(). If the caller needs to save both the current value of xax and the flags stored to xax by this routine, they must use separate spill slots, or they will overwrite the original xax value in memory. \note X86-only

\warning Clobbers xax; the caller must ensure xax is dead or saved at \p where.