diff options
author | bde <bde@FreeBSD.org> | 2001-05-22 21:20:49 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 2001-05-22 21:20:49 +0000 |
commit | 5fd5877aef9414a2f90dee01474b50bae5239284 (patch) | |
tree | a86ececbb6c0435a7b5ff76f0f5e1c2e6efc99ac /sys/kern/subr_trap.c | |
parent | 4f95148c2f75791e51d743c5c04a6a96d87089c6 (diff) | |
download | FreeBSD-src-5fd5877aef9414a2f90dee01474b50bae5239284.zip FreeBSD-src-5fd5877aef9414a2f90dee01474b50bae5239284.tar.gz |
Convert npx interrupts into traps instead of vice versa. This is much
simpler for npx exceptions that start as traps (no assembly required...)
and works better for npx exceptions that start as interrupts (there is
no longer a problem for nested interrupts).
Submitted by: original (pre-SMPng) version by luoqi
Diffstat (limited to 'sys/kern/subr_trap.c')
-rw-r--r-- | sys/kern/subr_trap.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c index 8924fa2..d11e197 100644 --- a/sys/kern/subr_trap.c +++ b/sys/kern/subr_trap.c @@ -291,7 +291,13 @@ restart: break; case T_ARITHTRAP: /* arithmetic trap */ +#ifdef DEV_NPX + ucode = npxtrap(); + if (ucode == -1) + return; +#else ucode = code; +#endif i = SIGFPE; break; @@ -1255,6 +1261,9 @@ ast(framep) { struct proc *p = CURPROC; u_quad_t sticks; +#if defined(DEV_NPX) && !defined(SMP) + int ucode; +#endif KASSERT(TRAPF_USERMODE(framep), ("ast in kernel mode")); @@ -1290,6 +1299,19 @@ ast(framep) PROC_UNLOCK(p); mtx_lock_spin(&sched_lock); } +#if defined(DEV_NPX) && !defined(SMP) + if (PCPU_GET(curpcb)->pcb_flags & PCB_NPXTRAP) { + PCPU_GET(curpcb)->pcb_flags &= ~PCB_NPXTRAP; + mtx_unlock_spin(&sched_lock); + ucode = npxtrap(); + if (ucode != -1) { + if (!mtx_owned(&Giant)) + mtx_lock(&Giant); + trapsignal(p, SIGFPE, ucode); + } + mtx_lock_spin(&sched_lock); + } +#endif if (p->p_sflag & PS_PROFPEND) { p->p_sflag &= ~PS_PROFPEND; mtx_unlock_spin(&sched_lock); |