From 2433a8616e3fef74c7d015d4416875ed22561c50 Mon Sep 17 00:00:00 2001 From: maxv Date: Tue, 15 Nov 2016 15:00:55 +0000 Subject: [PATCH] Initialize kern_end in amd64 instead of x86. --- sys/arch/amd64/amd64/machdep.c | 12 ++++++++---- sys/arch/i386/i386/machdep.c | 6 ++++-- sys/arch/x86/x86/x86_machdep.c | 8 ++------ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c index 52089407e040..783c32b65e14 100644 --- a/sys/arch/amd64/amd64/machdep.c +++ b/sys/arch/amd64/amd64/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.230 2016/08/27 16:17:16 maxv Exp $ */ +/* $NetBSD: machdep.c,v 1.231 2016/11/15 15:00:56 maxv Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011 @@ -111,7 +111,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.230 2016/08/27 16:17:16 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.231 2016/11/15 15:00:56 maxv Exp $"); /* #define XENDEBUG_LOW */ @@ -1540,7 +1540,9 @@ init_x86_64(paddr_t first_avail) int x; #ifndef XEN int ist; -#endif /* !XEN */ +#endif + + KASSERT(first_avail % PAGE_SIZE == 0); #ifdef XEN KASSERT(HYPERVISOR_shared_info != NULL); @@ -1609,11 +1611,13 @@ init_x86_64(paddr_t first_avail) */ pmap_bootstrap(VM_MIN_KERNEL_ADDRESS); + /* End of the virtual space we have created so far. */ + kern_end = KERNBASE + first_avail; + #ifndef XEN /* Internalize the physical pages into the VM system. */ init_x86_vm(first_avail); #else /* XEN */ - kern_end = KERNBASE + first_avail; physmem = xen_start_info.nr_pages; uvm_page_physload(atop(avail_start), diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index d717217f9ba0..75e1c271908c 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.763 2016/11/11 11:34:51 maxv Exp $ */ +/* $NetBSD: machdep.c,v 1.764 2016/11/15 15:00:55 maxv Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009 @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.763 2016/11/11 11:34:51 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.764 2016/11/15 15:00:55 maxv Exp $"); #include "opt_beep.h" #include "opt_compat_ibcs2.h" @@ -1141,6 +1141,8 @@ init386(paddr_t first_avail) extern u_char biostramp_image[]; #endif + KASSERT(first_avail % PAGE_SIZE == 0); + #ifdef XEN XENPRINTK(("HYPERVISOR_shared_info %p (%x)\n", HYPERVISOR_shared_info, xen_start_info.shared_info)); diff --git a/sys/arch/x86/x86/x86_machdep.c b/sys/arch/x86/x86/x86_machdep.c index 93bffbbbfeb8..5cb9468eba4b 100644 --- a/sys/arch/x86/x86/x86_machdep.c +++ b/sys/arch/x86/x86/x86_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: x86_machdep.c,v 1.75 2016/08/01 16:07:39 maxv Exp $ */ +/* $NetBSD: x86_machdep.c,v 1.76 2016/11/15 15:00:56 maxv Exp $ */ /*- * Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi, @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.75 2016/08/01 16:07:39 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.76 2016/11/15 15:00:56 maxv Exp $"); #include "opt_modular.h" #include "opt_physmem.h" @@ -849,14 +849,10 @@ init_x86_vm(paddr_t pa_kend) x86_freelists[i].freelist = VM_FREELIST_DEFAULT; } - /* Make sure the end of the space used by the kernel is rounded. */ - pa_kend = round_page(pa_kend); - #ifdef amd64 extern vaddr_t kern_end; extern vaddr_t module_start, module_end; - kern_end = KERNBASE + pa_kend; module_start = kern_end; module_end = KERNBASE + NKL2_KIMG_ENTRIES * NBPD_L2; #endif