summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Koehler <gkoehler@cvs.openbsd.org>2022-02-07 22:28:16 +0000
committerGeorge Koehler <gkoehler@cvs.openbsd.org>2022-02-07 22:28:16 +0000
commita376d7d0fa8ed83660d7d34914c2dead4c839b02 (patch)
tree8a45954d5326c68095df6f91b0d5bd7749b85567
parent8776ad1ff72c5194f6598db936f5b7ddf07db5d7 (diff)
Allow "ddb{1}> trace" through interrupt on macppc
If cpu0 sends PPC_IPI_DDB to cpu1, then cpu1 stops on its interrupt stack. Teach ININTSTK to allow traces through all interrupt stacks, not only cpu0's. ININTSTK now works by looping for all cpus. It doesn't remember which cpu owns the stack. A macppc has at most 4 cpus. ok kettenis@ miod@
-rw-r--r--sys/arch/powerpc/ddb/db_trace.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/sys/arch/powerpc/ddb/db_trace.c b/sys/arch/powerpc/ddb/db_trace.c
index 82913cb719a..e9351e93f6c 100644
--- a/sys/arch/powerpc/ddb/db_trace.c
+++ b/sys/arch/powerpc/ddb/db_trace.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*
@@ -104,14 +104,27 @@ db_save_regs(struct trapframe *frame)
/* 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.