summaryrefslogtreecommitdiff
path: root/i386
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2012-03-24 02:56:40 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2012-03-24 02:56:40 +0100
commit2ec0334d36910ff59727f1c6b3efc6648209020a (patch)
tree1dd3dc1df9acf57abcf8f5b522d9bafe1feb2453 /i386
parent264b750cc2d576beadfd74bcde45ac75edc4aab9 (diff)
Separate INIT_VM_MIN_KERNEL_ADDRESS from VM_MIN_KERNEL_ADDRESS
The former is the initial value set by the bootloader. It may not be the same as what Mach will set up. * i386/i386/vm_param.h (INIT_VM_MIN_KERNEL_ADDRESS): New macro. * i386/i386at/model_dep.c (i386at_init): Use INIT_VM_MIN_KERNEL_ADDRESS instead of VM_MIN_KERNEL_ADDRESS.
Diffstat (limited to 'i386')
-rw-r--r--i386/i386/vm_param.h2
-rw-r--r--i386/i386at/model_dep.c18
2 files changed, 11 insertions, 9 deletions
diff --git a/i386/i386/vm_param.h b/i386/i386/vm_param.h
index 49ba663..4974c33 100644
--- a/i386/i386/vm_param.h
+++ b/i386/i386/vm_param.h
@@ -32,8 +32,10 @@
/* The kernel address space is usually 1GB, usually starting at virtual address 0. */
#ifdef MACH_XEN
#define VM_MIN_KERNEL_ADDRESS 0xC0000000UL
+#define INIT_VM_MIN_KERNEL_ADDRESS VM_MIN_KERNEL_ADDRESS
#else /* MACH_XEN */
#define VM_MIN_KERNEL_ADDRESS 0x00000000UL
+#define INIT_VM_MIN_KERNEL_ADDRESS 0x00000000UL
#endif /* MACH_XEN */
#ifdef MACH_XEN
diff --git a/i386/i386at/model_dep.c b/i386/i386at/model_dep.c
index 01d515d..bbdf9dc 100644
--- a/i386/i386at/model_dep.c
+++ b/i386/i386at/model_dep.c
@@ -381,20 +381,17 @@ i386at_init(void)
pmap_bootstrap();
/*
- * Turn paging on.
* We'll have to temporarily install a direct mapping
* between physical memory and low linear memory,
* until we start using our new kernel segment descriptors.
- * Also, set the WP bit so that on 486 or better processors
- * page-level write protection works in kernel mode.
*/
-#if VM_MIN_KERNEL_ADDRESS != LINEAR_MIN_KERNEL_ADDRESS
- delta = VM_MIN_KERNEL_ADDRESS - LINEAR_MIN_KERNEL_ADDRESS;
+#if INIT_VM_MIN_KERNEL_ADDRESS != LINEAR_MIN_KERNEL_ADDRESS
+ delta = INIT_VM_MIN_KERNEL_ADDRESS - LINEAR_MIN_KERNEL_ADDRESS;
if ((vm_offset_t)(-delta) < delta)
delta = (vm_offset_t)(-delta);
nb_direct = delta >> PDESHIFT;
for (i = 0; i < nb_direct; i++)
- kernel_page_dir[lin2pdenum(VM_MIN_KERNEL_ADDRESS) + i] =
+ kernel_page_dir[lin2pdenum(INIT_VM_MIN_KERNEL_ADDRESS) + i] =
kernel_page_dir[lin2pdenum(LINEAR_MIN_KERNEL_ADDRESS) + i];
#endif
@@ -416,7 +413,10 @@ i386at_init(void)
set_cr3((unsigned)_kvtophys(kernel_page_dir));
#endif /* PAE */
#ifndef MACH_HYP
- /* already set by Hypervisor */
+ /* Turn paging on.
+ * Also set the WP bit so that on 486 or better processors
+ * page-level write protection works in kernel mode.
+ */
set_cr0(get_cr0() | CR0_PG | CR0_WP);
set_cr0(get_cr0() & ~(CR0_CD | CR0_NW));
if (CPU_HAS_FEATURE(CPU_FEATURE_PGE))
@@ -443,7 +443,7 @@ i386at_init(void)
ldt_init();
ktss_init();
-#if VM_MIN_KERNEL_ADDRESS != LINEAR_MIN_KERNEL_ADDRESS
+#if INIT_VM_MIN_KERNEL_ADDRESS != LINEAR_MIN_KERNEL_ADDRESS
/* Get rid of the temporary direct mapping and flush it out of the TLB. */
for (i = 0 ; i < nb_direct; i++) {
#ifdef MACH_XEN
@@ -454,7 +454,7 @@ i386at_init(void)
#endif /* MACH_PSEUDO_PHYS */
printf("couldn't unmap frame %d\n", i);
#else /* MACH_XEN */
- kernel_page_dir[lin2pdenum(VM_MIN_KERNEL_ADDRESS) + i] = 0;
+ kernel_page_dir[lin2pdenum(INIT_VM_MIN_KERNEL_ADDRESS) + i] = 0;
#endif /* MACH_XEN */
}
#endif