summaryrefslogtreecommitdiff
path: root/i386/i386at
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2009-11-22 20:08:27 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2009-11-22 20:22:06 +0100
commit493ea92815e8180fcf396ee95a0552112e8b0472 (patch)
tree2dd436191404367f6c13fe14e51c13078933d618 /i386/i386at
parentfe1cd7b8e6b5cc7f090debf7c251820fba86ccad (diff)
Do not assume that VM_MIN_KERNEL_ADDRESS is 0
* i386/i386/vm_param.h (VM_MAX_KERNEL_ADDRESS): Add VM_MIN_KERNEL_ADDRESS. (kvtolin): Subtract VM_MIN_KERNEL_ADDRESS. (lintokv): Add VM_MIN_KERNEL_ADDRESS. * i386/i386at/model_dep.c (mem_size_init): Subtract VM_MIN_KERNEL_ADDRESS in computation of phys_last_addr. (i386at_init): Use VM_MIN_KERNEL_ADDRESS instead of 0 as argument of lin2pdenum.
Diffstat (limited to 'i386/i386at')
-rw-r--r--i386/i386at/model_dep.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/i386/i386at/model_dep.c b/i386/i386at/model_dep.c
index 3929293..7dfeb1c 100644
--- a/i386/i386at/model_dep.c
+++ b/i386/i386at/model_dep.c
@@ -236,8 +236,8 @@ mem_size_init(void)
/* Reserve 1/6 of the memory address space for virtual mappings.
* Yes, this loses memory. Blame i386. */
- if (phys_last_addr > (VM_MAX_KERNEL_ADDRESS / 6) * 5) {
- phys_last_addr = (VM_MAX_KERNEL_ADDRESS / 6) * 5;
+ if (phys_last_addr > ((VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) / 6) * 5) {
+ phys_last_addr = ((VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) / 6) * 5;
printf("Truncating memory size to %dMiB\n", (phys_last_addr - phys_first_addr) / (1024 * 1024));
}
@@ -321,10 +321,10 @@ i386at_init(void)
* Also, set the WP bit so that on 486 or better processors
* page-level write protection works in kernel mode.
*/
- kernel_page_dir[lin2pdenum(0)] =
+ kernel_page_dir[lin2pdenum(VM_MIN_KERNEL_ADDRESS)] =
kernel_page_dir[lin2pdenum(LINEAR_MIN_KERNEL_ADDRESS)];
#if PAE
- kernel_page_dir[lin2pdenum(0) + 1] =
+ kernel_page_dir[lin2pdenum(VM_MIN_KERNEL_ADDRESS) + 1] =
kernel_page_dir[lin2pdenum(LINEAR_MIN_KERNEL_ADDRESS) + 1];
set_cr3((unsigned)kernel_pmap->pdpbase);
if (!CPU_HAS_FEATURE(CPU_FEATURE_PAE))
@@ -348,9 +348,9 @@ i386at_init(void)
ktss_init();
/* Get rid of the temporary direct mapping and flush it out of the TLB. */
- kernel_page_dir[lin2pdenum(0)] = 0;
+ kernel_page_dir[lin2pdenum(VM_MIN_KERNEL_ADDRESS)] = 0;
#if PAE
- kernel_page_dir[lin2pdenum(0) + 1] = 0;
+ kernel_page_dir[lin2pdenum(VM_MIN_KERNEL_ADDRESS) + 1] = 0;
#endif /* PAE */
flush_tlb();