Module Name:    src
Committed By:   nonaka
Date:           Thu Jul 13 00:44:14 UTC 2017

Modified Files:
        src/sys/arch/x86/x86: lapic.c

Log Message:
PR/52266: Before access MSR[APICBASE], need to check if APIC is present.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/x86/x86/lapic.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/x86/lapic.c
diff -u src/sys/arch/x86/x86/lapic.c:1.59 src/sys/arch/x86/x86/lapic.c:1.60
--- src/sys/arch/x86/x86/lapic.c:1.59	Sat Jul  8 14:35:33 2017
+++ src/sys/arch/x86/x86/lapic.c	Thu Jul 13 00:44:14 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: lapic.c,v 1.59 2017/07/08 14:35:33 nonaka Exp $	*/
+/*	$NetBSD: lapic.c,v 1.60 2017/07/13 00:44:14 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2008 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lapic.c,v 1.59 2017/07/08 14:35:33 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lapic.c,v 1.60 2017/07/13 00:44:14 nonaka Exp $");
 
 #include "acpica.h"
 #include "ioapic.h"
@@ -237,7 +237,8 @@ lapic_is_x2apic(void)
 {
 	uint64_t msr;
 
-	if (rdmsr_safe(MSR_APICBASE, &msr) == EFAULT)
+	if (!ISSET(cpu_feature[0], CPUID_APIC) ||
+	    rdmsr_safe(MSR_APICBASE, &msr) == EFAULT)
 		return false;
 	return (msr & (APICBASE_EN | APICBASE_EXTD)) ==
 	    (APICBASE_EN | APICBASE_EXTD);

Reply via email to