summaryrefslogtreecommitdiffstats
path: root/sys/alpha
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/alpha
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/alpha')
-rw-r--r--sys/alpha/alpha/machdep.c23
-rw-r--r--sys/alpha/include/pcb.h1
2 files changed, 24 insertions, 0 deletions
diff --git a/sys/alpha/alpha/machdep.c b/sys/alpha/alpha/machdep.c
index 005e56e..82c856d 100644
--- a/sys/alpha/alpha/machdep.c
+++ b/sys/alpha/alpha/machdep.c
@@ -1989,6 +1989,29 @@ alpha_pa_access(vm_offset_t pa)
#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_context[0] = tf->tf_regs[FRAME_S0];
+ pcb->pcb_context[1] = tf->tf_regs[FRAME_S1];
+ pcb->pcb_context[2] = tf->tf_regs[FRAME_S2];
+ pcb->pcb_context[3] = tf->tf_regs[FRAME_S3];
+ pcb->pcb_context[4] = tf->tf_regs[FRAME_S4];
+ pcb->pcb_context[5] = tf->tf_regs[FRAME_S5];
+ pcb->pcb_context[6] = tf->tf_regs[FRAME_S6];
+ pcb->pcb_context[7] = tf->tf_regs[FRAME_PC];
+ pcb->pcb_context[8] = tf->tf_regs[FRAME_PS];
+ pcb->pcb_hw.apcb_ksp = tf->tf_regs[FRAME_SP];
+}
+
int
fill_regs(td, regs)
struct thread *td;
diff --git a/sys/alpha/include/pcb.h b/sys/alpha/include/pcb.h
index 982e97b..4375ef2 100644
--- a/sys/alpha/include/pcb.h
+++ b/sys/alpha/include/pcb.h
@@ -58,6 +58,7 @@ struct pcb {
};
#ifdef _KERNEL
+void makectx(struct trapframe *, struct pcb *);
void savectx(struct pcb *);
#endif
OpenPOWER on IntegriCloud