From d87d897ae7890ed7a58ec65c0c60a2258747e3c1 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Fri, 23 Mar 2012 00:15:42 +0100 Subject: 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. --- i386/i386at/model_dep.c | 8 +++++--- 1 file 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]; -- cgit v1.2.3