summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorrin <rin@NetBSD.org>2023-06-17 11:28:13 +0000
committerrin <rin@NetBSD.org>2023-06-17 11:28:13 +0000
commit9c93b80db5c60f443128a6790d4b83a82625981b (patch)
tree1c4aa3a2d4f9d495f9624d9004d51f0f88f18e70 /sys/arch
parent3dbece4a7cf3a51710e04d2613a2c02271bb0d85 (diff)
Panic if kernel image is not fit within its VA range,
rather than silently freeze later.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/evbarm/nslu2/nslu2_machdep.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/arch/evbarm/nslu2/nslu2_machdep.c b/sys/arch/evbarm/nslu2/nslu2_machdep.c
index 8fc0f8ea04a..6959610be4c 100644
--- a/sys/arch/evbarm/nslu2/nslu2_machdep.c
+++ b/sys/arch/evbarm/nslu2/nslu2_machdep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: nslu2_machdep.c,v 1.39 2023/06/17 11:24:20 rin Exp $ */
+/* $NetBSD: nslu2_machdep.c,v 1.40 2023/06/17 11:28:13 rin Exp $ */
/*-
* Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -94,7 +94,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nslu2_machdep.c,v 1.39 2023/06/17 11:24:20 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nslu2_machdep.c,v 1.40 2023/06/17 11:28:13 rin Exp $");
#include "opt_arm_debug.h"
#include "opt_console.h"
@@ -630,6 +630,9 @@ initarm(void *arg)
logical += pmap_map_chunk(l1pagetable, KERNEL_BASE + logical,
physical_start + logical, totalsize - textsize,
VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
+
+ if (KERNEL_BASE + logical >= KERNEL_VM_BASE)
+ panic("VA for kernel image exhausted.");
}
#ifdef VERBOSE_INIT_ARM