Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/i386/i386 tlbflushg/i386: test for the PGE feature ...



details:   https://anonhg.NetBSD.org/src/rev/bea7af9e4019
branches:  trunk
changeset: 781269:bea7af9e4019
user:      rmind <rmind%NetBSD.org@localhost>
date:      Wed Aug 29 22:43:35 2012 +0000

description:
tlbflushg/i386: test for the PGE feature flag first, before checking the %cr4.
Add a comment explaining why need to check both and in such order.

diffstat:

 sys/arch/i386/i386/i386func.S |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (33 lines):

diff -r a5b63e0a704d -r bea7af9e4019 sys/arch/i386/i386/i386func.S
--- a/sys/arch/i386/i386/i386func.S     Wed Aug 29 22:25:05 2012 +0000
+++ b/sys/arch/i386/i386/i386func.S     Wed Aug 29 22:43:35 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i386func.S,v 1.16 2011/06/12 03:35:42 rmind Exp $      */
+/*     $NetBSD: i386func.S,v 1.17 2012/08/29 22:43:35 rmind Exp $      */
 
 /*-
  * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <machine/asm.h>
-__KERNEL_RCSID(0, "$NetBSD: i386func.S,v 1.16 2011/06/12 03:35:42 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i386func.S,v 1.17 2012/08/29 22:43:35 rmind Exp $");
 
 #include <machine/specialreg.h>
 #include <machine/segments.h>
@@ -99,9 +99,13 @@
  *
  * (the alternatives not quoted above are not an option here.)
  *
- * If PGE is not in use, we reload CR3.
+ * If PGE is not in use, we reload CR3.  Check for the PGE feature
+ * first since i486 does not have CR4.  Note: the feature flag may
+ * be present while the actual PGE functionality not yet enabled.
  */
 ENTRY(tlbflushg)
+       testl   $CPUID_PGE, _C_LABEL(cpu_feature)
+       jz      1f
        movl    %cr4, %eax
        testl   $CR4_PGE, %eax
        jz      1f



Home | Main Index | Thread Index | Old Index