|
|
A new extended LWP status structure in /usr/include/sys/procfs.h (see proc(4)) has been added to Release 7.1.1 to support extended floating point operations:
typedef struct lwpxstatus lwpxstatus_t;The extended lwpxstatus structure is identical to the existing lwpstatus structure except that it has an element for a 512-byte extended floating point save area appended to the end:
__fpxregset_t pr_fpxregset;
The pr_context
element of lwpstatus is still of type
ucontext_t to maintain the existing offsets in the
lwpstatus structure.
If the system supports fxsave and fxrstor,
/proc will use the lwpxstatus_t extended LWP
status structure.
If the pr_context.uc_flags
element of the extended
lwpstatus
structure has the UC_FP flag set, then both the
i387 floating point state and the extended floating point state will
contain valid data.
A new ioctl(2) command in /usr/include/sys/procfs.h allows setting of the extended floating point state:
#define PCSFPXREG 19
Applications that want to manipulate floating point state using procfs on systems that support fxsave and fxrstor should use PCSFPXREG exclusively. Using PCSFPREG (instead of PCSFPXREG) will save the floating point state in the kernel using the i387 format and the contents of the extended floating point registers will be undefined.
Note that setting the floating point state will not actually affect the register contents on the CPU until a floating point or Pentium III Streaming SIMD extended floating point instruction is executed. This is because the kernel only restores the floating point register state when it is needed.