summaryrefslogtreecommitdiff
path: root/sys/arch/socppc/socppc/db_interface.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/socppc/socppc/db_interface.c')
-rw-r--r--sys/arch/socppc/socppc/db_interface.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/sys/arch/socppc/socppc/db_interface.c b/sys/arch/socppc/socppc/db_interface.c
new file mode 100644
index 00000000000..02a44a53a76
--- /dev/null
+++ b/sys/arch/socppc/socppc/db_interface.c
@@ -0,0 +1,44 @@
+/* $OpenBSD: db_interface.c,v 1.1 2008/05/10 12:02:21 kettenis Exp $ */
+/* $NetBSD: db_interface.c,v 1.12 2001/07/22 11:29:46 wiz Exp $ */
+
+#include <sys/param.h>
+#include <sys/proc.h>
+#include <sys/systm.h>
+
+#include <dev/cons.h>
+
+#include <machine/db_machdep.h>
+#include <ddb/db_extern.h>
+
+int ddb_trap_glue(struct trapframe *frame); /* called from locore */
+
+void
+Debugger()
+{
+ ddb_trap();
+}
+
+int
+ddb_trap_glue(struct trapframe *frame)
+{
+ if (!(frame->srr1 & PSL_PR)
+ && (frame->exc == EXC_TRC
+ || (frame->exc == EXC_PGM && (frame->srr1 & 0x20000))
+ || frame->exc == EXC_BPT)) {
+
+ bcopy(frame->fixreg, DDB_REGS->tf.fixreg,
+ 32 * sizeof(u_int32_t));
+ DDB_REGS->tf.srr0 = frame->srr0;
+ DDB_REGS->tf.srr1 = frame->srr1;
+
+ cnpollc(TRUE);
+ db_trap(T_BREAKPOINT, 0);
+ cnpollc(FALSE);
+
+ bcopy(DDB_REGS->tf.fixreg, frame->fixreg,
+ 32 * sizeof(u_int32_t));
+
+ return 1;
+ }
+ return 0;
+}