summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2012-03-23 00:15:42 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2012-03-23 00:15:42 +0100
commitd87d897ae7890ed7a58ec65c0c60a2258747e3c1 (patch)
treec875529d136c3322175c301f300dc43167ba2a6c
parent809f7720aa0c1704e821ce31b147765c9676f0e6 (diff)
Fix boot with big values of _start
When _start is not close to 0, just using init_alloc_aligned() is not enough to know how much should be duplicated between linear and virtual mappings. Just mapping everything that can be is not very costly and should just work when it can work. * i386/i386at/model_dep.c (i386at_init) [VM_MIN_KERNEL_ADDRESS != LINEAR_MIN_KERNEL_ADDRESS]: Extend `nb_direct' to VM_MIN_KERNEL_ADDRESS - LINEAR_MIN_KERNEL_ADDRESS.
-rw-r--r--i386/i386at/model_dep.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/i386/i386at/model_dep.c b/i386/i386at/model_dep.c
index 1fc1bf9c..ef2d672a 100644
--- a/i386/i386at/model_dep.c
+++ b/i386/i386at/model_dep.c
@@ -319,7 +319,7 @@ i386at_init(void)
/* XXX move to intel/pmap.h */
extern pt_entry_t *kernel_page_dir;
int nb_direct, i;
- vm_offset_t addr;
+ vm_offset_t addr, delta;
/*
* Initialize the PIC prior to any possible call to an spl.
@@ -389,8 +389,10 @@ i386at_init(void)
* page-level write protection works in kernel mode.
*/
#if VM_MIN_KERNEL_ADDRESS != LINEAR_MIN_KERNEL_ADDRESS
- init_alloc_aligned(0, &addr);
- nb_direct = (addr + NPTES * PAGE_SIZE - 1) / (NPTES * PAGE_SIZE);
+ delta = 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(LINEAR_MIN_KERNEL_ADDRESS) + i];