saved_proc in exception() may be NULL
If an exception happens in kernel while the kernel is booting and no processes are running yet, saved_proc == NULL and priting any process related information results in dumping rubish. This check is mostly useful when debugging kernel stuff. Should _never_ happen on a production kernel.
This commit is contained in:
parent
42f0bf7dda
commit
50473107c2
@ -163,16 +163,25 @@ struct proc *t;
|
|||||||
else
|
else
|
||||||
kprintf("\n%s\n", ep->msg);
|
kprintf("\n%s\n", ep->msg);
|
||||||
kprintf("k_reenter = %d ", k_reenter);
|
kprintf("k_reenter = %d ", k_reenter);
|
||||||
|
|
||||||
|
/* TODO should we enable this only when compiled for some debug mode? */
|
||||||
|
if (saved_proc) {
|
||||||
kprintf("process %d (%s), ", proc_nr(saved_proc), saved_proc->p_name);
|
kprintf("process %d (%s), ", proc_nr(saved_proc), saved_proc->p_name);
|
||||||
kprintf("pc = %u:0x%x\n", (unsigned) saved_proc->p_reg.cs,
|
kprintf("pc = %u:0x%x\n", (unsigned) saved_proc->p_reg.cs,
|
||||||
(unsigned) saved_proc->p_reg.pc);
|
(unsigned) saved_proc->p_reg.pc);
|
||||||
kprintf(
|
kprintf("vec_nr= %d, trap_errno= 0x%lx, eip= 0x%lx, "
|
||||||
"vec_nr= %d, trap_errno= 0x%lx, eip= 0x%lx, cs= 0x%x, eflags= 0x%lx\n",
|
"cs= 0x%x, eflags= 0x%lx\n",
|
||||||
vec_nr, (unsigned long)trap_errno,
|
vec_nr, (unsigned long)trap_errno,
|
||||||
(unsigned long)old_eip, old_cs, (unsigned long)old_eflags);
|
(unsigned long)old_eip, old_cs,
|
||||||
|
(unsigned long)old_eflags);
|
||||||
proc_stacktrace(saved_proc);
|
proc_stacktrace(saved_proc);
|
||||||
|
|
||||||
minix_panic("exception in a kernel task", saved_proc->p_endpoint);
|
minix_panic("exception in a kernel task", saved_proc->p_endpoint);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* in an early stage of boot process we don't have processes yet */
|
||||||
|
minix_panic("exception in kernel while booting", NO_NUM);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user