From df86224d9addb1084174a1a13dfa8415e128a3fc Mon Sep 17 00:00:00 2001 From: Mike Belopuhov Date: Wed, 25 Oct 2017 22:29:42 +0000 Subject: Initialize processor extended state in fpu_kernel_enter Tested by a few; OK visa, sthen --- sys/arch/amd64/amd64/fpu.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sys/arch/amd64/amd64/fpu.c b/sys/arch/amd64/amd64/fpu.c index 9660c374674..07e16a0efb6 100644 --- a/sys/arch/amd64/amd64/fpu.c +++ b/sys/arch/amd64/amd64/fpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fpu.c,v 1.38 2017/10/14 04:44:43 jsg Exp $ */ +/* $OpenBSD: fpu.c,v 1.39 2017/10/25 22:29:41 mikeb Exp $ */ /* $NetBSD: fpu.c,v 1.1 2003/04/26 18:39:28 fvdl Exp $ */ /*- @@ -347,7 +347,7 @@ void fpu_kernel_enter(void) { struct cpu_info *ci = curcpu(); - uint32_t cw; + struct savefpu *sfp; int s; /* @@ -376,10 +376,11 @@ fpu_kernel_enter(void) /* Initialize the FPU */ fninit(); - cw = __INITIAL_NPXCW__; - fldcw(&cw); - cw = __INITIAL_MXCSR__; - ldmxcsr(&cw); + sfp = &proc0.p_addr->u_pcb.pcb_savefpu; + memset(&sfp->fp_fxsave, 0, sizeof(sfp->fp_fxsave)); + sfp->fp_fxsave.fx_fcw = __INITIAL_NPXCW__; + sfp->fp_fxsave.fx_mxcsr = __INITIAL_MXCSR__; + fxrstor(&sfp->fp_fxsave); } void -- cgit v1.2.3