Module Name:    src
Committed By:   snj
Date:           Mon Jan 12 21:06:42 UTC 2015

Modified Files:
        src/sys/arch/x86/x86 [netbsd-7]: cpu.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #414):
        sys/arch/x86/x86/cpu.c: revision 1.113
PR/49104: Jarle Greipsland: Don't touch cr4 in cpus that don't have it.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.111.2.1 src/sys/arch/x86/x86/cpu.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/cpu.c
diff -u src/sys/arch/x86/x86/cpu.c:1.111 src/sys/arch/x86/x86/cpu.c:1.111.2.1
--- src/sys/arch/x86/x86/cpu.c:1.111	Mon May 12 11:56:02 2014
+++ src/sys/arch/x86/x86/cpu.c	Mon Jan 12 21:06:41 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.111 2014/05/12 11:56:02 joerg Exp $	*/
+/*	$NetBSD: cpu.c,v 1.111.2.1 2015/01/12 21:06:41 snj Exp $	*/
 
 /*-
  * Copyright (c) 2000-2012 NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.111 2014/05/12 11:56:02 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.111.2.1 2015/01/12 21:06:41 snj Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mpbios.h"		/* for MPDEBUG */
@@ -552,11 +552,10 @@ cpu_childdetached(device_t self, device_
 void
 cpu_init(struct cpu_info *ci)
 {
-	uint32_t cr4;
+	uint32_t cr4 = 0;
 
 	lcr0(rcr0() | CR0_WP);
 
-	cr4 = rcr4();
 	/*
 	 * On a P6 or above, enable global TLB caching if the
 	 * hardware supports it.
@@ -581,7 +580,10 @@ cpu_init(struct cpu_info *ci)
 	if (cpu_feature[1] & CPUID2_XSAVE)
 		cr4 |= CR4_OSXSAVE;
 
-	lcr4(cr4);
+	if (cr4) {
+		cr4 |= rcr4();
+		lcr4(cr4);
+	}
 
 	/* If xsave is enabled, enable all fpu features */
 	if (cr4 & CR4_OSXSAVE)

Reply via email to