The check to ensure that xstate_bv always has XFEATURE_ENABLED_X87 and

XFEATURE_ENABLED_SSE bits set is not needed.  CPU correctly handles
any bitmask which is subset of the enabled bits in %XCR0.

More, CPU instructions XSAVE and XSAVEOPT could write the mask without
e.g. XFEATURE_ENABLED_SSE, after the VZEROALL.  The check prevents the
restoration of the otherwise valid FPU save area.

In collaboration with:	jhb
MFC after:	1 week
This commit is contained in:
kib 2013-05-01 20:03:50 +00:00
parent 3c0b1df064
commit f2ccbf32fb

View File

@ -743,9 +743,6 @@ fpusetxstate(struct thread *td, char *xfpustate, size_t xfpustate_size)
*/
if (bv & ~xsave_mask)
return (EINVAL);
if ((bv & (XFEATURE_ENABLED_X87 | XFEATURE_ENABLED_SSE)) !=
(XFEATURE_ENABLED_X87 | XFEATURE_ENABLED_SSE))
return (EINVAL);
hdr = (struct xstate_hdr *)(get_pcb_user_save_td(td) + 1);