]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Fix initial x87 state after r345562.
authorkib <kib@FreeBSD.org>
Tue, 16 Apr 2019 19:46:02 +0000 (19:46 +0000)
committerkib <kib@FreeBSD.org>
Tue, 16 Apr 2019 19:46:02 +0000 (19:46 +0000)
commit7fc477c2c0055544d26514da28d5a581197cca23
tree4ef4e4948702e3e57bd7ad37cf9fe3d77d150f05
parentd6c1d3bf634345ddc54bd3f8f63b07d48604b9f4
Fix initial x87 state after r345562.

After the referenced commit, we did not set x87 and sse valid bits in
the xstate_bv bitmask for initial fpu state (stored in memory), when
using XSAVE.

The state is loaded into FPU register file to initialize the process
FPU state, and since both bits were clear, the default x87 and SSE
states were loaded.  By chance, FreeBSD ABI SSE2 state is same as FPU
initial state, so the bug is not visible for 64bit processes.  But on
i386, the precision control should be set to double (53bit mantissa),
instead of the default double extended (64bit mantissa). For 32bit
processes on amd64, kernel reloads control word with the right mask,
which only left native i386 and amd64 native but using x87 as
affected.

Fix it by setting minimal required xstate_bv mask.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
sys/amd64/amd64/fpu.c
sys/i386/i386/npx.c