Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Revert http://mail-index.netbsd.org/source-changes/...
details: https://anonhg.NetBSD.org/src/rev/8e22517d8423
branches: trunk
changeset: 827747:8e22517d8423
user: bouyer <bouyer%NetBSD.org@localhost>
date: Sat Nov 11 09:10:19 2017 +0000
description:
Revert http://mail-index.netbsd.org/source-changes/2017/11/08/msg089525.html,
it breaks Xen:
http://www-soc.lip6.fr/~bouyer/NetBSD-tests/xen/HEAD/amd64/201711082340Z_anita.txt
diffstat:
sys/arch/x86/x86/cpu.c | 9 ++-------
sys/arch/x86/x86/fpu.c | 18 +++++++++++++-----
sys/arch/x86/x86/identcpu.c | 6 ++++--
sys/arch/xen/x86/cpu.c | 8 ++------
4 files changed, 21 insertions(+), 20 deletions(-)
diffs (151 lines):
diff -r 66aef06d51d6 -r 8e22517d8423 sys/arch/x86/x86/cpu.c
--- a/sys/arch/x86/x86/cpu.c Sat Nov 11 08:23:50 2017 +0000
+++ b/sys/arch/x86/x86/cpu.c Sat Nov 11 09:10:19 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.139 2017/11/08 17:52:22 maxv Exp $ */
+/* $NetBSD: cpu.c,v 1.140 2017/11/11 09:10:19 bouyer Exp $ */
/*
* Copyright (c) 2000-2012 NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.139 2017/11/08 17:52:22 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.140 2017/11/11 09:10:19 bouyer Exp $");
#include "opt_ddb.h"
#include "opt_mpbios.h" /* for MPDEBUG */
@@ -541,7 +541,6 @@
void
cpu_init(struct cpu_info *ci)
{
- extern int x86_fpu_save;
uint32_t cr4 = 0;
lcr0(rcr0() | CR0_WP);
@@ -585,10 +584,6 @@
lcr4(cr4);
}
- if (x86_fpu_save >= FPU_SAVE_FXSAVE) {
- fpuinit_mxcsr_mask();
- }
-
/* If xsave is enabled, enable all fpu features */
if (cr4 & CR4_OSXSAVE)
wrxcr(0, x86_xsave_features & XCR0_FPU);
diff -r 66aef06d51d6 -r 8e22517d8423 sys/arch/x86/x86/fpu.c
--- a/sys/arch/x86/x86/fpu.c Sat Nov 11 08:23:50 2017 +0000
+++ b/sys/arch/x86/x86/fpu.c Sat Nov 11 09:10:19 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fpu.c,v 1.25 2017/11/08 17:52:22 maxv Exp $ */
+/* $NetBSD: fpu.c,v 1.26 2017/11/11 09:10:19 bouyer Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc. All
@@ -96,7 +96,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.25 2017/11/08 17:52:22 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.26 2017/11/11 09:10:19 bouyer Exp $");
#include "opt_multiprocessor.h"
@@ -233,21 +233,23 @@
void
fpuinit_mxcsr_mask(void)
{
+#ifndef XEN
union savefpu fpusave __aligned(16);
- u_long psl;
+ u_long cr0, psl;
memset(&fpusave, 0, sizeof(fpusave));
/* Disable interrupts, and enable FPU */
psl = x86_read_psl();
x86_disable_intr();
- clts();
+ cr0 = rcr0();
+ lcr0(cr0 & ~(CR0_EM|CR0_TS));
/* Fill in the FPU area */
fxsave(&fpusave);
/* Restore previous state */
- stts();
+ lcr0(cr0);
x86_write_psl(psl);
if (fpusave.sv_xmm.fx_mxcsr_mask == 0) {
@@ -255,6 +257,12 @@
} else {
x86_fpu_mxcsr_mask = fpusave.sv_xmm.fx_mxcsr_mask;
}
+#else
+ /*
+ * XXX: Does the detection above work on Xen?
+ */
+ x86_fpu_mxcsr_mask = __INITIAL_MXCSR_MASK__;
+#endif
}
/*
diff -r 66aef06d51d6 -r 8e22517d8423 sys/arch/x86/x86/identcpu.c
--- a/sys/arch/x86/x86/identcpu.c Sat Nov 11 08:23:50 2017 +0000
+++ b/sys/arch/x86/x86/identcpu.c Sat Nov 11 09:10:19 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: identcpu.c,v 1.65 2017/11/08 17:52:22 maxv Exp $ */
+/* $NetBSD: identcpu.c,v 1.66 2017/11/11 09:10:19 bouyer Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.65 2017/11/08 17:52:22 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.66 2017/11/11 09:10:19 bouyer Exp $");
#include "opt_xen.h"
@@ -753,6 +753,8 @@
x86_fpu_save = FPU_SAVE_FXSAVE;
+ fpuinit_mxcsr_mask();
+
/* See if xsave (for AVX) is supported */
if ((ci->ci_feat_val[1] & CPUID2_XSAVE) == 0)
return;
diff -r 66aef06d51d6 -r 8e22517d8423 sys/arch/xen/x86/cpu.c
--- a/sys/arch/xen/x86/cpu.c Sat Nov 11 08:23:50 2017 +0000
+++ b/sys/arch/xen/x86/cpu.c Sat Nov 11 09:10:19 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.114 2017/11/11 06:16:52 riastradh Exp $ */
+/* $NetBSD: cpu.c,v 1.115 2017/11/11 09:10:19 bouyer Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.114 2017/11/11 06:16:52 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.115 2017/11/11 09:10:19 bouyer Exp $");
#include "opt_ddb.h"
#include "opt_multiprocessor.h"
@@ -540,10 +540,6 @@
lcr4(rcr4() | CR4_OSXMMEXCPT);
}
- if (x86_fpu_save >= FPU_SAVE_FXSAVE) {
- fpuinit_mxcsr_mask();
- }
-
atomic_or_32(&ci->ci_flags, CPUF_RUNNING);
}
Home |
Main Index |
Thread Index |
Old Index