[Midnightbsd-cvs] src [9339] trunk/sys/amd64/amd64/fpu.c: The check to ensure that xstate_bv always has XFEATURE_ENABLED_X87 and

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Mar 4 11:10:30 EST 2017


Revision: 9339
          http://svnweb.midnightbsd.org/src/?rev=9339
Author:   laffer1
Date:     2017-03-04 11:10:30 -0500 (Sat, 04 Mar 2017)
Log Message:
-----------
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.

Obtained from: FreeBSD

Modified Paths:
--------------
    trunk/sys/amd64/amd64/fpu.c

Modified: trunk/sys/amd64/amd64/fpu.c
===================================================================
--- trunk/sys/amd64/amd64/fpu.c	2017-03-04 16:09:35 UTC (rev 9338)
+++ trunk/sys/amd64/amd64/fpu.c	2017-03-04 16:10:30 UTC (rev 9339)
@@ -743,9 +743,6 @@
 	 */
 	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);
 



More information about the Midnightbsd-cvs mailing list