NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: PR/49104 CVS commit: src/sys/kern



On Jan 12, 10:50am, jarle%uninett.no@localhost (Jarle Greipsland) wrote:
-- Subject: Re: PR/49104 CVS commit: src/sys/kern

|  Unfortunately, this only fixes the second bug in PR49104, where
|  cpu_counter32 is called.  The original problem still persists,
|  i.e. where cpu_init unconditionally calls the rcr4 function.

Does this fix the problem?

Index: cpu.c
===================================================================
RCS file: /cvsroot/src/sys/arch/x86/x86/cpu.c,v
retrieving revision 1.111
diff -u -u -r1.111 cpu.c
--- cpu.c	12 May 2014 11:56:02 -0000	1.111
+++ cpu.c	12 Jan 2015 14:15:22 -0000
@@ -552,11 +552,10 @@
 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 @@
 	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)


Home | Main Index | Thread Index | Old Index