summaryrefslogtreecommitdiff
path: root/sys/arch/amd64
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2018-07-09 12:58:44 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2018-07-09 12:58:44 +0000
commita8b088af2940490a9c39f2006e54bd9743c30d6e (patch)
tree762e2d9f0eb58b7d633bc51e71fa909a0a516bd5 /sys/arch/amd64
parent9c82a920fc3bd8495058710133523190be2eb8f0 (diff)
Rest the FPU's fcw and mxcsr before initializing the "FPU reset state" area
problem discovered on bluhm@'s old opteron ok deraadt@ kettenis@
Diffstat (limited to 'sys/arch/amd64')
-rw-r--r--sys/arch/amd64/amd64/cpu.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/arch/amd64/amd64/cpu.c b/sys/arch/amd64/amd64/cpu.c
index 12489c05a7e..4ad2069c0d7 100644
--- a/sys/arch/amd64/amd64/cpu.c
+++ b/sys/arch/amd64/amd64/cpu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.c,v 1.123 2018/06/19 19:29:52 kettenis Exp $ */
+/* $OpenBSD: cpu.c,v 1.124 2018/07/09 12:58:43 guenther Exp $ */
/* $NetBSD: cpu.c,v 1.1 2003/04/26 18:39:26 fvdl Exp $ */
/*-
@@ -571,6 +571,9 @@ cpu_init(struct cpu_info *ci)
/* Give proc0 a clean FPU save area */
sfp = &proc0.p_addr->u_pcb.pcb_savefpu;
memset(sfp, 0, fpu_save_len);
+ sfp->fp_fxsave.fx_fcw = __INITIAL_NPXCW__;
+ sfp->fp_fxsave.fx_mxcsr = __INITIAL_MXCSR__;
+ fpureset();
if (xsave_mask) {
/* must not use xsaveopt here */
xsave(sfp, xsave_mask);