[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-hurd] Re: Problems with oskit-mach
From: |
Roland McGrath |
Subject: |
[Bug-hurd] Re: Problems with oskit-mach |
Date: |
Sun, 17 Sep 2000 22:17:48 -0400 (EDT) |
> [T]he bit must not be enabled before paging
> is enabled via CR0.PG. Program correctness may be affected by reversing this
> sequence, and processor performance will be impacted.
Ok, we should move the setting of the bit.
> The other, cleaner, option that I see is to combine the pmap_bootstrap and
> the paging_enable function. This seems acceptable and a bit more elegant
> to me. This would also allow us to move the setting of the WP into a
> function. On the other hand, paging_enable is an oskit function.
There are many cleanups that would be ultimately desireable in a bunch of
this code, but I'll let that all wait until I can put the hacking into
really doing it all reasonably. I would be inclined to move that stuff
into pmap_bootstrap, but it would still be a kludge because the clearing of
the temporary direct mapping has to go after other initialization stuff.
For now, I've just done the minimal change that ought to work. I am not
set up to check code in to subversions right now (no kerberos where I am).
Someone who can should check this change in to the oskit-branch of gnumach.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnumach/ChangeLog,v
retrieving revision 1.69.2.2
diff -b -u -r1.69.2.2 ChangeLog
--- ChangeLog 2000/03/21 02:47:43 1.69.2.2
+++ ChangeLog 2000/09/18 02:01:11
@@ -1,3 +1,10 @@
+2000-09-17 Roland McGrath <roland@gateway.sf.frob.com>
+
+ * oskit/x86/main.c (main): Set CR4_PGE bit here, after paging_enable.
+ * i386/intel/pmap.c (pmap_bootstrap): Not here, since it's before
+ paging is enabled, and that is verboten. Still check the feature
+ flag and initialize kernel_pte_global here.
+
2000-03-20 Roland McGrath <roland@baalperazim.frob.com>
* Makefile.in (oskit-kern%.o): Pattern rule replaces oskit-kernel.o
Index: i386/intel/pmap.c
===================================================================
RCS file: /cvs/gnumach/i386/intel/pmap.c,v
retrieving revision 1.3.2.1
diff -b -u -r1.3.2.1 pmap.c
--- i386/intel/pmap.c 1999/11/25 23:15:42 1.3.2.1
+++ i386/intel/pmap.c 2000/09/18 02:01:15
@@ -670,7 +670,6 @@
* The processor supports the "global" bit to avoid flushing
* kernel TLB entries, if we turn it on.
*/
- set_cr4 (get_cr4 () | CR4_PGE);
kernel_pte_global = INTEL_PTE_GLOBAL;
}
Index: oskit/x86/main.c
===================================================================
RCS file: /cvs/gnumach/oskit/x86/Attic/main.c,v
retrieving revision 1.1.2.1
diff -b -u -r1.1.2.1 main.c
--- oskit/x86/main.c 1999/11/25 23:28:00 1.1.2.1
+++ oskit/x86/main.c 2000/09/18 02:01:16
@@ -90,6 +90,17 @@
paging_enable((oskit_addr_t) kernel_page_dir);
set_cr0 (get_cr0 () | CR0_WP);
+ if (base_cpuid.feature_flags & CPUF_PAGE_GLOBAL_EXT) {
+ /*
+ * The processor supports the "global" bit to avoid flushing kernel TLB
+ * entries, if we turn it on. pmap_bootstrap checks this feature flag
+ * and begins use the global bit in page table entries. But according
+ * to the x86 specs we cannot set this bit before we do enable_paging
+ * above; setting CR4_PGE first doesn't work on some processors, in fact.
+ */
+ set_cr4 (get_cr4 () | CR4_PGE);
+ }
+
/*
* Initialize and activate the real i386 protected-mode structures.
*/