summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjsg <jsg@openbsd.org>2015-05-10 05:42:46 +0000
committerjsg <jsg@openbsd.org>2015-05-10 05:42:46 +0000
commita5b7bc8b7dfdd48b2ec27aa6a6edd4fc4add5def (patch)
treec3569fe7c47d4c0f999539233176ba6ca090aeaa /sys
parentA new version from the original author of math.sed that does exponents (diff)
downloadwireguard-openbsd-a5b7bc8b7dfdd48b2ec27aa6a6edd4fc4add5def.tar.xz
wireguard-openbsd-a5b7bc8b7dfdd48b2ec27aa6a6edd4fc4add5def.zip
limit physical memory to (paddr_t)-PAGE_SIZE (0xfffff000)
novena has 4GB of physical memory and it's u-boot tells us memstart: 0x10000000 memsize: 0xf0000000 which would previously cause an overflow leading to "panic: initarm: out of memory" tweak from and ok miod@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/armv7/armv7/armv7_machdep.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/arch/armv7/armv7/armv7_machdep.c b/sys/arch/armv7/armv7/armv7_machdep.c
index d538bfc51a6..fabb406e4d3 100644
--- a/sys/arch/armv7/armv7/armv7_machdep.c
+++ b/sys/arch/armv7/armv7/armv7_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: armv7_machdep.c,v 1.18 2015/01/18 10:17:42 jsg Exp $ */
+/* $OpenBSD: armv7_machdep.c,v 1.19 2015/05/10 05:42:46 jsg Exp $ */
/* $NetBSD: lubbock_machdep.c,v 1.2 2003/07/15 00:25:06 lukem Exp $ */
/*
@@ -461,11 +461,13 @@ initarm(void *arg0, void *arg1, void *arg2)
* XXX pmap_bootstrap() needs an enema.
*/
physical_start = bootconfig.dram[0].address;
- physical_end = physical_start + (bootconfig.dram[0].pages * PAGE_SIZE);
+ physical_end = MIN((uint64_t)physical_start +
+ (bootconfig.dram[0].pages * PAGE_SIZE), (paddr_t)-PAGE_SIZE);
{
physical_freestart = (((unsigned long)esym - KERNEL_TEXT_BASE +0xfff) & ~0xfff) + memstart;
- physical_freeend = memstart+memsize;
+ physical_freeend = MIN((uint64_t)memstart+memsize,
+ (paddr_t)-PAGE_SIZE);
}
physmem = (physical_end - physical_start) / PAGE_SIZE;