Skip to main content

proc_save_fpstate

Function proc_save_fpstate 

Source
pub unsafe extern "C" fn proc_save_fpstate(buf: *mut byte) -> usize
Expand description

Saves the x87 floating point state into the buffer \p buf.

On x86, the buffer must be 16-byte-aligned, and it must be 512 (#DR_FPSTATE_BUF_SIZE) bytes for processors with the FXSR feature, and 108 bytes for those without (where this routine does not support 16-bit operand sizing). On ARM/AArch64, nothing needs to be saved as the SIMD/FP registers are saved together with the general-purpose registers.

\note proc_fpstate_save_size() can be used to determine the particular size needed.

When the FXSR feature is present, the fxsave format matches the bitwidth of the ISA mode of the current thread (see dr_get_isa_mode()).

The last floating-point instruction address is left in an untranslated state (i.e., it may point into the code cache).

DR does NOT save the application’s x87 floating-point or MMX state on context switches! Thus if a client performs any floating-point operations in its main routines called by DR and cannot prove that its compiler will not use x87 operations, the client must save and restore the x87 floating-point/MMX state. If the client needs to do so inside the code cache the client should implement that itself. Returns number of bytes written.