From a8b088af2940490a9c39f2006e54bd9743c30d6e Mon Sep 17 00:00:00 2001 From: Philip Guenther Date: Mon, 9 Jul 2018 12:58:44 +0000 Subject: Rest the FPU's fcw and mxcsr before initializing the "FPU reset state" area problem discovered on bluhm@'s old opteron ok deraadt@ kettenis@ --- sys/arch/amd64/amd64/cpu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sys/arch/amd64') 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); -- cgit v1.2.3