-/* $OpenBSD: db_trace.c,v 1.18 2022/01/28 18:37:40 gkoehler Exp $ */
+/* $OpenBSD: db_trace.c,v 1.19 2022/02/07 22:28:15 gkoehler Exp $ */
/* $NetBSD: db_trace.c,v 1.15 1996/02/22 23:23:41 gwr Exp $ */
/*
/* from locore.S */
extern vaddr_t trapexit;
-extern vaddr_t esym;
#define INTSTK (8*1024) /* 8K interrupt stack */
#define INKERNEL(va) (((vaddr_t)(va)) >= VM_MIN_KERNEL_ADDRESS && \
((vaddr_t)(va)) < VM_MAX_KERNEL_ADDRESS)
-#define ININTSTK(va) (((vaddr_t)(va)) >= round_page(esym) && \
- ((vaddr_t)(va)) < (round_page(esym) + INTSTK))
+#define ININTSTK(va) db_in_interrupt_stack((vaddr_t)(va))
+
+int
+db_in_interrupt_stack(vaddr_t va)
+{
+ struct cpu_info *ci;
+ CPU_INFO_ITERATOR cii;
+ vaddr_t stack;
+
+ CPU_INFO_FOREACH(cii, ci) {
+ stack = (vaddr_t)ci->ci_intstk;
+ if (va >= stack - INTSTK && va < stack)
+ return 1;
+ }
+ return 0;
+}
/*
* Frame tracing.