* 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. */
| 2745 | * enough for a backtrace. |
| 2746 | */ |
| 2747 | void |
| 2748 | makectx(struct trapframe *tf, struct pcb *pcb) |
| 2749 | { |
| 2750 | |
| 2751 | pcb->pcb_edi = tf->tf_edi; |
| 2752 | pcb->pcb_esi = tf->tf_esi; |
| 2753 | pcb->pcb_ebp = tf->tf_ebp; |
| 2754 | pcb->pcb_ebx = tf->tf_ebx; |
| 2755 | pcb->pcb_eip = tf->tf_eip; |
| 2756 | pcb->pcb_esp = (ISPL(tf->tf_cs)) ? tf->tf_esp : (int)(tf + 1) - 8; |
| 2757 | pcb->pcb_gs = rgs(); |
| 2758 | } |
| 2759 | |
| 2760 | int |
| 2761 | ptrace_set_pc(struct thread *td, u_long addr) |