From 2ec0334d36910ff59727f1c6b3efc6648209020a Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sat, 24 Mar 2012 02:56:40 +0100 Subject: 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. --- i386/i386at/model_dep.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'i386/i386at') 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 -- cgit v1.2.3