Created attachment 165763 [details] fpu zero-ing diff The register file for the x86 MMU is not fully zero'd when creating the thread0 context. This leaves garbage in several of the registers. For the X87 FPU registers, they are properly tagged as empty, but the register file still contains garbage. For the XMM registers, only register 0 is actually zero'd (not the whole file). The diff attached, fully zero's the X87 registers and ALL 16 of the XMM registers. The contents of the fxsave area look something like the stuff below w/out the diff. With the diff, all of the registers are zero'd. Diff is against 10.2-R. xmm st0 = 0100000000000000ffff xmm st1 = 00f0000000000000ffff xmm st2 = 27e9000000000000ffff xmm st3 = a1e8000000000000ffff xmm st4 = 2800000000000000ffff xmm st5 = 0000000000000000ffff xmm st6 = 0a00000000000000ffff xmm st7 = 00000000000000000000 xmm xmm0 = 00000000000000000000000000000000 xmm xmm1 = 0000c842000000000000000000000000 xmm xmm2 = 075b0000000000000000000000000000 xmm xmm3 = 00000080000000000000000000000000 xmm xmm4 = 40020000000000000000000000000000 xmm xmm5 = 020000e0000000000000000000000000 xmm xmm6 = 00400000000000000000000000000000 xmm xmm7 = 3f7f0000000000000000000000000000 xmm xmm8 = 00000000000000000000000000000000 xmm xmm9 = 00000000000000000000000000000000 xmm xmma = 00000000000000000000000000000000 xmm xmmb = 00000000000000000000000000000000 xmm xmmc = 00000000000000000000000000000000 xmm xmmd = 00000000000000000000000000000000 xmm xmme = 00000000000000000000000000000000 xmm xmmf = 00000000000000000000000000000000
A commit references this bug: Author: kib Date: Tue Jan 19 08:04:02 UTC 2016 New revision: 294311 URL: https://svnweb.freebsd.org/changeset/base/294311 Log: Clear whole XMM register file instead of only XMM0. Also clear x87 registers. This brings amd64 on par with i386, providing consistent initial FPU state. Note that we do not clear any extended state, at least because kernel does not understand extended state structure and consequences of zero overwrite after fninit()/fpusave(). Submitted by: joss.upton@yahoo.com PR: 206370 MFC after: 2 weeks Changes: head/sys/amd64/amd64/fpu.c
Assign to committer.
A commit references this bug: Author: kib Date: Tue Feb 2 14:16:08 UTC 2016 New revision: 295148 URL: https://svnweb.freebsd.org/changeset/base/295148 Log: MFC r294311: Clear whole XMM register file instead of only XMM0. Also clear x87 registers. This brings amd64 on par with i386, providing consistent initial FPU state. PR: 206370 MFC r294312: Use ANSI definitions. Wrap long line. MFC r294313: Adjust i386 comment to match amd64 one after r294311. Approved by: re (gjb) Changes: _U stable/10/ stable/10/sys/amd64/amd64/fpu.c stable/10/sys/i386/isa/npx.c
Committed back in 2016.