Module Name:    src
Committed By:   christos
Date:           Mon Jan 12 16:34:39 UTC 2015

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

Log Message:
PR/49104: Jarle Greipsland: Don't touch cr4 in cpus that don't have it.
XXX: pullup-7


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 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.112 src/sys/arch/x86/x86/cpu.c:1.113
--- src/sys/arch/x86/x86/cpu.c:1.112	Mon Dec  8 10:22:47 2014
+++ src/sys/arch/x86/x86/cpu.c	Mon Jan 12 11:34:39 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.112 2014/12/08 15:22:47 msaitoh Exp $	*/
+/*	$NetBSD: cpu.c,v 1.113 2015/01/12 16:34:39 christos Exp $	*/
 
 /*-
  * Copyright (c) 2000-2012 NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.112 2014/12/08 15:22:47 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.113 2015/01/12 16:34:39 christos Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mpbios.h"		/* for MPDEBUG */
@@ -551,11 +551,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.
@@ -580,7 +579,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