summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMike Belopuhov <mikeb@cvs.openbsd.org>2017-10-25 22:29:42 +0000
committerMike Belopuhov <mikeb@cvs.openbsd.org>2017-10-25 22:29:42 +0000
commitdf86224d9addb1084174a1a13dfa8415e128a3fc (patch)
treee27475914d6695c2d00e7c55aa86b6ae8fb230c1 /sys
parent209083e57d13fe86d37965a509daf2c7e43c1c5f (diff)
Initialize processor extended state in fpu_kernel_enter
Tested by a few; OK visa, sthen
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/amd64/amd64/fpu.c13
1 files 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