Module Name: src Committed By: ryo Date: Fri Dec 7 18:46:28 UTC 2018
Modified Files: src/sys/arch/aarch64/aarch64: trap.c Log Message: add simple stack overflow checker for debugging To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/aarch64/aarch64/trap.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/aarch64/aarch64/trap.c diff -u src/sys/arch/aarch64/aarch64/trap.c:1.11 src/sys/arch/aarch64/aarch64/trap.c:1.12 --- src/sys/arch/aarch64/aarch64/trap.c:1.11 Fri Oct 12 01:28:57 2018 +++ src/sys/arch/aarch64/aarch64/trap.c Fri Dec 7 18:46:27 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.11 2018/10/12 01:28:57 ryo Exp $ */ +/* $NetBSD: trap.c,v 1.12 2018/12/07 18:46:27 ryo Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include <sys/cdefs.h> -__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.11 2018/10/12 01:28:57 ryo Exp $"); +__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.12 2018/12/07 18:46:27 ryo Exp $"); #include "opt_arm_intr_impl.h" #include "opt_compat_netbsd32.h" @@ -296,6 +296,15 @@ interrupt(struct trapframe *tf) { struct cpu_info * const ci = curcpu(); +#ifdef STACKCHECKS + struct lwp *l = curlwp; + void *sp = (void *)reg_sp_read(); + if (l->l_addr >= sp) { + panic("lwp/interrupt stack overflow detected." + " lwp=%p, sp=%p, l_addr=%p", l, sp, l->l_addr); + } +#endif + /* enable traps */ daif_enable(DAIF_D|DAIF_A);