diff options
Diffstat (limited to 'sys/alpha')
-rw-r--r-- | sys/alpha/alpha/machdep.c | 23 | ||||
-rw-r--r-- | sys/alpha/include/pcb.h | 1 |
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 |