Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/x86/x86 Mmh, check the highest leaf before calling ...
details: https://anonhg.NetBSD.org/src/rev/2b1875c82c7e
branches: trunk
changeset: 999417:2b1875c82c7e
user: maxv <maxv%NetBSD.org@localhost>
date: Sat Jun 01 06:54:28 2019 +0000
description:
Mmh, check the highest leaf before calling x86_cpuid(), otherwise on old
CPUs we might be getting garbage. While here fix a typo.
Likely fixes PR/54256.
diffstat:
sys/arch/x86/x86/spectre.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diffs (38 lines):
diff -r 4bc1fa747d62 -r 2b1875c82c7e sys/arch/x86/x86/spectre.c
--- a/sys/arch/x86/x86/spectre.c Sat Jun 01 05:55:45 2019 +0000
+++ b/sys/arch/x86/x86/spectre.c Sat Jun 01 06:54:28 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: spectre.c,v 1.28 2019/05/18 08:54:38 maxv Exp $ */
+/* $NetBSD: spectre.c,v 1.29 2019/06/01 06:54:28 maxv Exp $ */
/*
* Copyright (c) 2018-2019 NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.28 2019/05/18 08:54:38 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.29 2019/06/01 06:54:28 maxv Exp $");
#include "opt_spectre.h"
@@ -673,6 +673,10 @@
return;
}
+ if (cpuid_level < 7) {
+ return;
+ }
+
x86_cpuid(0x7, descs);
if (descs[3] & CPUID_SEF_ARCH_CAP) {
msr = rdmsr(MSR_IA32_ARCH_CAPABILITIES);
@@ -850,7 +854,7 @@
#endif
/*
- * Microarchectural Data Sampling.
+ * Microarchitectural Data Sampling.
*
* cpu0 is the one that detects the method and sets the global
* variable.
Home |
Main Index |
Thread Index |
Old Index