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 PR/49104: Jarle Greipsland: Don't touch cr4...



details:   https://anonhg.NetBSD.org/src/rev/d152a0469d52
branches:  trunk
changeset: 335540:d152a0469d52
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Jan 12 16:34:39 2015 +0000

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

diffstat:

 sys/arch/x86/x86/cpu.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (43 lines):

diff -r 6cf2e500e12c -r d152a0469d52 sys/arch/x86/x86/cpu.c
--- a/sys/arch/x86/x86/cpu.c    Mon Jan 12 14:17:08 2015 +0000
+++ b/sys/arch/x86/x86/cpu.c    Mon Jan 12 16:34:39 2015 +0000
@@ -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 @@
 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 @@
        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