diff options
author | jhb <jhb@FreeBSD.org> | 2002-01-15 14:17:07 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2002-01-15 14:17:07 +0000 |
commit | 873822cd833c6f125d95130a1fe85df82b78fe3b (patch) | |
tree | fba410d4bfed9e10b6146a7956f8c02ed88b4b1d | |
parent | 2aa7f13a7d0162ad396a95251dceae601862f622 (diff) | |
download | FreeBSD-src-873822cd833c6f125d95130a1fe85df82b78fe3b.zip FreeBSD-src-873822cd833c6f125d95130a1fe85df82b78fe3b.tar.gz |
- Catch up printtrap() to KSE by using curthread and testing it against
NULL rather than curproc. Without this, if we trap early before
curthread is set, we recursively panic.
- In an SMP kernel, if we trap before curthread is set, then trap is going
to recursively panic trying to bump td->td_md.md_kernnest. The trap is
fatal anyways, so to make debugging easier just call printtrap() to
dump the trap info to the console and then halt.
-rw-r--r-- | sys/alpha/alpha/trap.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/alpha/alpha/trap.c b/sys/alpha/alpha/trap.c index 99278fa..c4c402a 100644 --- a/sys/alpha/alpha/trap.c +++ b/sys/alpha/alpha/trap.c @@ -235,12 +235,12 @@ printtrap(a0, a1, a2, entry, framep, isfatal, user) printf(" pc = 0x%lx\n", framep->tf_regs[FRAME_PC]); printf(" ra = 0x%lx\n", framep->tf_regs[FRAME_RA]); printf(" sp = 0x%lx\n", framep->tf_regs[FRAME_SP]); - if (curproc != NULL && (curproc->p_flag & P_KTHREAD) == 0) + if (curthread != NULL && (curthread->td_proc->p_flag & P_KTHREAD) == 0) printf(" usp = 0x%lx\n", alpha_pal_rdusp()); - printf(" curproc = %p\n", curproc); - if (curproc != NULL) - printf(" pid = %d, comm = %s\n", curproc->p_pid, - curproc->p_comm); + printf(" curthread = %p\n", curthread); + if (curthread != NULL) + printf(" pid = %d, comm = %s\n", + curthread->td_proc->p_pid, curthread->td_proc->p_comm); printf("\n"); } @@ -275,6 +275,10 @@ trap(a0, a1, a2, entry, framep) pcpup = (struct pcpu *) alpha_pal_rdval(); td = curthread; #ifdef SMP + if (td == NULL) { + printtrap(a0, a1, a2, entry, framep, 1, 0); + cpu_halt(); + } td->td_md.md_kernnest++; cpu_critical_exit(s); #endif |