5bd2b3d73a
mostly meets the guidelines set by the Intel SDM: 1. We use XRSTOR and XSAVE from the same CPL using the same linear address for the store area 2. Contrary to the recommendations, we cannot zero the FPU save area for a new thread, since fork semantic requires the copy of the previous state. This advice seemingly contradicts to the advice from the item 6. 3. We do use XSAVEOPT in the context switch code only, and the area for XSAVEOPT already always contains the data saved by XSAVE. 4. We do not modify the save area between XRSTOR, when the area is loaded into FPU context, and XSAVE. We always spit the fpu context into save area and start emulation when directly writing into FPU context. 5. We do not use segmented addressing to access save area, or rather, always address it using %ds basing. 6. XSAVEOPT can be only executed in the area which was previously loaded with XRSTOR, since context switch code checks for FPU use by outgoing thread before saving, and thread which stopped emulation forcibly get context loaded with XRSTOR. 7. The PCB cannot be paged out while FPU emulation is turned off, since stack of the executing thread is never swapped out. The context switch code is patched to issue XSAVEOPT instead of XSAVE if supported. This approach eliminates one conditional in the context switch code, which would be needed otherwise. For user-visible machine context to have proper data, fpugetregs() checks for unsaved extension blocks and manually copies pristine FPU state into them, according to the description provided by CPUID leaf 0xd. MFC after: 1 month |
||
---|---|---|
.. | ||
_align.h | ||
_inttypes.h | ||
_limits.h | ||
_stdint.h | ||
_types.h | ||
apicreg.h | ||
apm_bios.h | ||
bus.h | ||
endian.h | ||
float.h | ||
fpu.h | ||
legacyvar.h | ||
mca.h | ||
mptable.h | ||
pci_cfgreg.h | ||
psl.h | ||
ptrace.h | ||
reg.h | ||
segments.h | ||
setjmp.h | ||
specialreg.h | ||
stdarg.h | ||
sysarch.h | ||
trap.h | ||
vdso.h |