* are disabled.
*/
#define DEBUG_ENABLE_IPC_WARNINGS 0
+#define DEBUG_STACKTRACE 1
/* It's interesting to measure the time spent withing locked regions, because
* this is the time that the system is deaf to interrupts.
saved_proc->p_reg.cs, saved_proc->p_reg.pc,
saved_proc->p_reg.ss, saved_proc->p_reg.sp);
kprintf("edi = 0x%x\n", saved_proc->p_reg.di);
+
+#if DEBUG_STACKTRACE
+ stacktrace(saved_proc);
+#endif
}
#endif
panic("exception in a kernel task", NO_NUM);
}
+#if DEBUG_STACKTRACE
+/*===========================================================================*
+ * stacktrace *
+ *===========================================================================*/
+PUBLIC void stacktrace(proc)
+struct proc *proc;
+{
+ reg_t bp, v_bp, v_pc, v_hbp;
+
+ v_bp = proc->p_reg.fp;
+
+ kprintf("stacktrace: ");
+ while(v_bp) {
+ phys_bytes p;
+ if(!(p = umap_local(proc, D, v_bp, sizeof(v_bp)))) {
+ kprintf("(bad bp %lx)", v_bp);
+ break;
+ }
+ phys_copy(p+sizeof(v_pc), vir2phys(&v_pc), sizeof(v_pc));
+ phys_copy(p, vir2phys(&v_hbp), sizeof(v_hbp));
+ kprintf("0x%lx ", (unsigned long) v_pc);
+ if(v_hbp != 0 && v_hbp <= v_bp) {
+ kprintf("(bad hbp %lx)", v_hbp);
+ break;
+ }
+ v_bp = v_hbp;
+ }
+ kprintf("\n");
+}
+#endif
+
/* exception.c */
_PROTOTYPE( void exception, (unsigned vec_nr) );
+#if DEBUG_STACK_TRACE
+_PROTOTYPE( void stacktrace, (struct proc *) );
+#endif
/* i8259.c */
_PROTOTYPE( void intr_init, (int mine) );