summaryrefslogtreecommitdiffstats
path: root/sys/amd64
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2016-02-02 14:16:07 +0000
committerkib <kib@FreeBSD.org>2016-02-02 14:16:07 +0000
commitbac8688b17d735d252ec75a94df67384938f3f9b (patch)
tree120c7e477f273fc3239b5e7255ff0b3cc38dde49 /sys/amd64
parent14120d1fb726f9e2342c6cee6cf264a14ccf6cea (diff)
downloadFreeBSD-src-bac8688b17d735d252ec75a94df67384938f3f9b.zip
FreeBSD-src-bac8688b17d735d252ec75a94df67384938f3f9b.tar.gz
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)
Diffstat (limited to 'sys/amd64')
-rw-r--r--sys/amd64/amd64/fpu.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/sys/amd64/amd64/fpu.c b/sys/amd64/amd64/fpu.c
index f30c073..d9c967c 100644
--- a/sys/amd64/amd64/fpu.c
+++ b/sys/amd64/amd64/fpu.c
@@ -318,13 +318,15 @@ fpuinitstate(void *arg __unused)
cpu_mxcsr_mask = 0xFFBF;
/*
- * The fninit instruction does not modify XMM registers. The
- * fpusave call dumped the garbage contained in the registers
- * after reset to the initial state saved. Clear XMM
- * registers file image to make the startup program state and
- * signal handler XMM register content predictable.
+ * The fninit instruction does not modify XMM registers or x87
+ * registers (MM/ST). The fpusave call dumped the garbage
+ * contained in the registers after reset to the initial state
+ * saved. Clear XMM and x87 registers file image to make the
+ * startup program state and signal handler XMM/x87 register
+ * content predictable.
*/
- bzero(&fpu_initialstate->sv_xmm[0], sizeof(struct xmmacc));
+ bzero(fpu_initialstate->sv_fp, sizeof(fpu_initialstate->sv_fp));
+ bzero(fpu_initialstate->sv_xmm, sizeof(fpu_initialstate->sv_xmm));
/*
* Create a table describing the layout of the CPU Extended
@@ -375,7 +377,7 @@ fpuexit(struct thread *td)
}
int
-fpuformat()
+fpuformat(void)
{
return (_MC_FPFMT_XMM);
@@ -661,7 +663,8 @@ fpudna(void)
* fpu_initialstate, to ignite the XSAVEOPT
* tracking engine.
*/
- bcopy(fpu_initialstate, curpcb->pcb_save, cpu_max_ext_state_size);
+ bcopy(fpu_initialstate, curpcb->pcb_save,
+ cpu_max_ext_state_size);
fpurestore(curpcb->pcb_save);
if (curpcb->pcb_initial_fpucw != __INITIAL_FPUCW__)
fldcw(curpcb->pcb_initial_fpucw);
@@ -676,7 +679,7 @@ fpudna(void)
}
void
-fpudrop()
+fpudrop(void)
{
struct thread *td;
OpenPOWER on IntegriCloud