summaryrefslogtreecommitdiffstats
path: root/sys/ia64
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/ia64
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/ia64')
-rw-r--r--sys/ia64/ia64/machdep.c17
-rw-r--r--sys/ia64/include/pcb.h6
2 files changed, 22 insertions, 1 deletions
diff --git a/sys/ia64/ia64/machdep.c b/sys/ia64/ia64/machdep.c
index ca75d2c..5c39d05 100644
--- a/sys/ia64/ia64/machdep.c
+++ b/sys/ia64/ia64/machdep.c
@@ -1017,6 +1017,23 @@ 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_special = tf->tf_special;
+ pcb->pcb_special.__spare = ~0UL; /* XXX see unwind.c */
+ save_callee_saved(&pcb->pcb_preserved);
+ save_callee_saved_fp(&pcb->pcb_preserved_fp);
+}
+
int
get_mcontext(struct thread *td, mcontext_t *mc, int flags)
{
diff --git a/sys/ia64/include/pcb.h b/sys/ia64/include/pcb.h
index 23d7e50..d018127 100644
--- a/sys/ia64/include/pcb.h
+++ b/sys/ia64/include/pcb.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2003 Doug Rabson
+ * Copyright (c) 2003,2004 Marcel Moolenaar
* Copyright (c) 2000 Doug Rabson
* All rights reserved.
*
@@ -59,6 +59,10 @@ struct pcb {
#ifdef _KERNEL
#define savectx(p) swapctx(p, NULL)
+
+struct trapframe;
+
+void makectx(struct trapframe *, struct pcb *);
void restorectx(struct pcb *) __dead2;
int swapctx(struct pcb *old, struct pcb *new);
OpenPOWER on IntegriCloud