Module Name: src Committed By: matt Date: Thu Aug 13 00:07:15 UTC 2015
Modified Files: src/sys/arch/arm/arm32 [matt-nb5-mips64]: arm32_kvminit.c Log Message: Make sure the amount of direct mapped memory doesn't cross over into the mappable KVA range. To generate a diff of this commit: cvs rdiff -u -r1.22.2.3 -r1.22.2.4 src/sys/arch/arm/arm32/arm32_kvminit.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/arm/arm32/arm32_kvminit.c diff -u src/sys/arch/arm/arm32/arm32_kvminit.c:1.22.2.3 src/sys/arch/arm/arm32/arm32_kvminit.c:1.22.2.4 --- src/sys/arch/arm/arm32/arm32_kvminit.c:1.22.2.3 Mon Mar 24 07:37:39 2014 +++ src/sys/arch/arm/arm32/arm32_kvminit.c Thu Aug 13 00:07:15 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: arm32_kvminit.c,v 1.22.2.3 2014/03/24 07:37:39 matt Exp $ */ +/* $NetBSD: arm32_kvminit.c,v 1.22.2.4 2015/08/13 00:07:15 matt Exp $ */ /* * Copyright (c) 2002, 2003, 2005 Genetec Corporation. All rights reserved. @@ -122,7 +122,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: arm32_kvminit.c,v 1.22.2.3 2014/03/24 07:37:39 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: arm32_kvminit.c,v 1.22.2.4 2015/08/13 00:07:15 matt Exp $"); #include <sys/param.h> #include <sys/device.h> @@ -773,6 +773,14 @@ arm32_kernel_vm_init(vaddr_t kernel_vm_b } } + // The amount we can direct is limited by the start of the + // virtual part of the kernel address space. Don't overrun + // into it. + if (mapallmem_p && cur_pv.pv_va + cur_pv.pv_size > kernel_vm_base) { + cur_pv.pv_size = kernel_vm_base - cur_pv.pv_va; + } + + /* * Now we map the final chunk. */