summaryrefslogtreecommitdiffstats
path: root/sys/arch/powerpc64/powerpc64/trap.c
diff options
context:
space:
mode:
authorgkoehler <gkoehler@openbsd.org>2020-05-27 22:22:04 +0000
committergkoehler <gkoehler@openbsd.org>2020-05-27 22:22:04 +0000
commit6fbfd68bf4c3af11810e73047433de96c37dc484 (patch)
tree5c31f8a420288a8c9f445142412da3e95e587a4d /sys/arch/powerpc64/powerpc64/trap.c
parentDo not call process_queued_listen_addrs() for every included file (diff)
downloadwireguard-openbsd-6fbfd68bf4c3af11810e73047433de96c37dc484.tar.xz
wireguard-openbsd-6fbfd68bf4c3af11810e73047433de96c37dc484.zip
Enter ddb at a trap instruction or with db_enter().
Tell make that trap_subr.S needs assym.h. Fill in opal_cngetc() so I can type at the "ddb>" prompt. Add enough code to trap_subr.S to "c" continue from ddb. Give registers to ddb. Try to load symbols from initrd. ok kettenis@
Diffstat (limited to 'sys/arch/powerpc64/powerpc64/trap.c')
-rw-r--r--sys/arch/powerpc64/powerpc64/trap.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/sys/arch/powerpc64/powerpc64/trap.c b/sys/arch/powerpc64/powerpc64/trap.c
index 091acdfc15a..7f37d556d7c 100644
--- a/sys/arch/powerpc64/powerpc64/trap.c
+++ b/sys/arch/powerpc64/powerpc64/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.2 2020/05/22 15:34:43 kettenis Exp $ */
+/* $OpenBSD: trap.c,v 1.3 2020/05/27 22:22:04 gkoehler Exp $ */
/*
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
@@ -19,10 +19,22 @@
#include <sys/param.h>
#include <sys/systm.h>
+#ifdef DDB
+#include <machine/db_machdep.h>
+#endif
#include <machine/trap.h>
void
trap(struct trapframe *frame)
{
+#ifdef DDB
+ /* At a trap instruction, enter the debugger. */
+ if (frame->exc == EXC_PGM && (frame->srr1 & EXC_PGM_TRAP)) {
+ db_ktrap(T_BREAKPOINT, frame);
+ frame->srr0 += 4; /* Step to next instruction. */
+ return;
+ }
+#endif
+
panic("trap type %lx at lr %lx", frame->exc, frame->lr);
}