From ff9aa3a975061758e959ffc2d5802e8608155f69 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Thu, 21 Mar 2013 15:50:29 +0000 Subject: move kernel after 16MB. needed for additional growth that might come in a little while... diff from martynas who is not around now --- sys/arch/amd64/amd64/machdep.c | 20 +++++++++++++++++++- sys/arch/amd64/conf/Makefile.amd64 | 4 ++-- sys/arch/amd64/conf/kern.ldscript | 4 ++-- sys/arch/amd64/include/param.h | 6 +++--- sys/arch/amd64/include/pmap.h | 4 ++-- 5 files changed, 28 insertions(+), 10 deletions(-) diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c index 98903f6d414..c2eeeffd0b4 100644 --- a/sys/arch/amd64/amd64/machdep.c +++ b/sys/arch/amd64/amd64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.161 2013/03/02 07:02:07 guenther Exp $ */ +/* $OpenBSD: machdep.c,v 1.162 2013/03/21 15:50:27 deraadt Exp $ */ /* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */ /*- @@ -1403,6 +1403,24 @@ init_x86_64(paddr_t first_avail) uvm_page_physload(atop(seg_start), atop(seg_end), atop(seg_start), atop(seg_end), 0); } + + /* + * Now, load the memory between the end of I/O memory "hole" + * and the kernel. + */ + { + paddr_t seg_start = round_page(IOM_END); + paddr_t seg_end = trunc_page(KERNTEXTOFF - KERNBASE); + + if (seg_start < seg_end) { +#if DEBUG_MEMLOAD + printf("loading 0x%lx-0x%lx\n", seg_start, seg_end); +#endif + uvm_page_physload(atop(seg_start), atop(seg_end), + atop(seg_start), atop(seg_end), 0); + } + } + #if DEBUG_MEMLOAD printf("avail_start = 0x%lx\n", avail_start); printf("avail_end = 0x%lx\n", avail_end); diff --git a/sys/arch/amd64/conf/Makefile.amd64 b/sys/arch/amd64/conf/Makefile.amd64 index 505b237bfff..95802707931 100644 --- a/sys/arch/amd64/conf/Makefile.amd64 +++ b/sys/arch/amd64/conf/Makefile.amd64 @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.amd64,v 1.53 2012/08/28 21:03:32 pascal Exp $ +# $OpenBSD: Makefile.amd64,v 1.54 2013/03/21 15:50:28 deraadt Exp $ # For instructions on building kernels consult the config(8) and options(4) # manual pages. @@ -39,7 +39,7 @@ CMACHFLAGS+= -fno-stack-protector COPTS?= -O2 CFLAGS= ${DEBUG} ${CWARNFLAGS} ${CMACHFLAGS} ${COPTS} ${PIPE} AFLAGS= -D_LOCORE -x assembler-with-cpp ${CMACHFLAGS} -LINKFLAGS= -Ttext 0xffffffff801001e0 -e start --warn-common -nopie +LINKFLAGS= -Ttext 0xffffffff810001e0 -e start --warn-common -nopie .if ${IDENT:M-DDDB_STRUCT} DB_STRUCTINFO= db_structinfo.h diff --git a/sys/arch/amd64/conf/kern.ldscript b/sys/arch/amd64/conf/kern.ldscript index 9e9a9794c24..4258dbf5d10 100644 --- a/sys/arch/amd64/conf/kern.ldscript +++ b/sys/arch/amd64/conf/kern.ldscript @@ -1,4 +1,4 @@ -/* $OpenBSD: kern.ldscript,v 1.1 2009/08/13 13:35:54 weingart Exp $ */ +/* $OpenBSD: kern.ldscript,v 1.2 2013/03/21 15:50:28 deraadt Exp $ */ /* * Copyright (c) 2009 Tobias Weingartner @@ -36,7 +36,7 @@ PHDRS *__ALIGN_SIZE = 0x200000; */ __ALIGN_SIZE = 0x1000; -__kernel_base_virt = 0xffffffff80100000 + SIZEOF_HEADERS; +__kernel_base_virt = 0xffffffff81000000 + SIZEOF_HEADERS; __kernel_base_phys = __kernel_base_virt & 0x7fffffff; /* We use physical address to jump to kernel */ diff --git a/sys/arch/amd64/include/param.h b/sys/arch/amd64/include/param.h index f7a1017d30a..49542f1c27e 100644 --- a/sys/arch/amd64/include/param.h +++ b/sys/arch/amd64/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.18 2011/09/08 03:40:32 guenther Exp $ */ +/* $OpenBSD: param.h,v 1.19 2013/03/21 15:50:28 deraadt Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -63,10 +63,10 @@ #define NPTEPG (NBPG/(sizeof (pt_entry_t))) #define KERNBASE 0xffffffff80000000 /* start of kernel virtual space */ -#define KERNTEXTOFF (KERNBASE+0x100000) /* start of kernel text */ +#define KERNTEXTOFF (KERNBASE+0x1000000) /* start of kernel text */ #define KERNTEXTOFF_HI 0xffffffff -#define KERNTEXTOFF_LO 0x80100000 +#define KERNTEXTOFF_LO 0x81000000 #define KERNBASE_HI 0xffffffff #define KERNBASE_LO 0x80000000 diff --git a/sys/arch/amd64/include/pmap.h b/sys/arch/amd64/include/pmap.h index 302b2476a2e..a3f257fb20a 100644 --- a/sys/arch/amd64/include/pmap.h +++ b/sys/arch/amd64/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.39 2011/06/30 22:18:01 jsg Exp $ */ +/* $OpenBSD: pmap.h,v 1.40 2013/03/21 15:50:28 deraadt Exp $ */ /* $NetBSD: pmap.h,v 1.1 2003/04/26 18:39:46 fvdl Exp $ */ /* @@ -201,7 +201,7 @@ #define NKL4_KIMG_ENTRIES 1 #define NKL3_KIMG_ENTRIES 1 -#define NKL2_KIMG_ENTRIES 8 +#define NKL2_KIMG_ENTRIES 16 #define NDML4_ENTRIES 1 #define NDML3_ENTRIES 1 -- cgit v1.2.3