summaryrefslogtreecommitdiffstats
path: root/sys/sparc64
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2004-07-10 19:56:00 +0000
committermarcel <marcel@FreeBSD.org>2004-07-10 19:56:00 +0000
commit006d404cf77cb76437589bef7e0e1bb57c7bd79d (patch)
treeef114b5aee4601f2523b9d10bcaef23b379b7b6a /sys/sparc64
parent8a7d828338d290e43e0ba04946b945be561589c7 (diff)
downloadFreeBSD-src-006d404cf77cb76437589bef7e0e1bb57c7bd79d.zip
FreeBSD-src-006d404cf77cb76437589bef7e0e1bb57c7bd79d.tar.gz
Implement makectx(). The makectx() function is used by KDB to create
a PCB from a trapframe for purposes of unwinding the stack. The PCB is used as the thread context and all but the thread that entered the debugger has a valid PCB. This function can also be used to create a context for the threads running on the CPUs that have been stopped when the debugger got entered. This however is not done at the time of this commit.
Diffstat (limited to 'sys/sparc64')
-rw-r--r--sys/sparc64/include/pcb.h1
-rw-r--r--sys/sparc64/sparc64/machdep.c15
2 files changed, 16 insertions, 0 deletions
diff --git a/sys/sparc64/include/pcb.h b/sys/sparc64/include/pcb.h
index 38578d2..1f1e8dc 100644
--- a/sys/sparc64/include/pcb.h
+++ b/sys/sparc64/include/pcb.h
@@ -49,6 +49,7 @@ struct pcb {
} __aligned(64);
#ifdef _KERNEL
+void makectx(struct trapframe *, struct pcb *);
int savectx(struct pcb *pcb);
#endif
diff --git a/sys/sparc64/sparc64/machdep.c b/sys/sparc64/sparc64/machdep.c
index 3db2dd8..2bc8329 100644
--- a/sys/sparc64/sparc64/machdep.c
+++ b/sys/sparc64/sparc64/machdep.c
@@ -564,6 +564,21 @@ freebsd4_sigreturn(struct thread *td, struct freebsd4_sigreturn_args *uap)
}
#endif
+/*
+ * Construct a PCB from a trapframe. This is called from kdb_trap() where
+ * we want to start a backtrace from the function that caused us to enter
+ * the debugger. We have the context in the trapframe, but base the trace
+ * on the PCB. The PCB doesn't have to be perfect, as long as it contains
+ * enough for a backtrace.
+ */
+void
+makectx(struct trapframe *tf, struct pcb *pcb)
+{
+
+ pcb->pcb_pc = tf->tf_tpc;
+ pcb->pcb_sp = tf->tf_sp;
+}
+
int
get_mcontext(struct thread *td, mcontext_t *mc, int flags)
{
OpenPOWER on IntegriCloud