diff options
author | kato <kato@FreeBSD.org> | 2001-05-02 13:56:50 +0000 |
---|---|---|
committer | kato <kato@FreeBSD.org> | 2001-05-02 13:56:50 +0000 |
commit | 1850f4ef406a2eb4b2a421463370880a3d3f11ca (patch) | |
tree | fbde32bc5740978830c59b9ef8e6a31d22673299 /sys/pc98 | |
parent | f3e48b3cb443658b0203a846e41b0ee0c37139c2 (diff) | |
download | FreeBSD-src-1850f4ef406a2eb4b2a421463370880a3d3f11ca.zip FreeBSD-src-1850f4ef406a2eb4b2a421463370880a3d3f11ca.tar.gz |
Merged from sys/i386/isa/npx.c revisions 1.96 and 1.97.
Diffstat (limited to 'sys/pc98')
-rw-r--r-- | sys/pc98/pc98/npx.c | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/sys/pc98/pc98/npx.c b/sys/pc98/pc98/npx.c index 30b6711..25e8dc8 100644 --- a/sys/pc98/pc98/npx.c +++ b/sys/pc98/pc98/npx.c @@ -44,11 +44,13 @@ #include <sys/bus.h> #include <sys/ipl.h> #include <sys/kernel.h> +#include <sys/lock.h> #include <sys/malloc.h> #include <sys/module.h> -#include <sys/sysctl.h> -#include <sys/proc.h> #include <sys/mutex.h> +#include <sys/mutex.h> +#include <sys/proc.h> +#include <sys/sysctl.h> #include <machine/bus.h> #include <sys/rman.h> #ifdef NPX_DEBUG @@ -773,30 +775,41 @@ npx_intr(dummy) u_short control; struct intrframe *frame; - mtx_lock(&Giant); - if (PCPU_GET(npxproc) == NULL || !npx_exists) { + if (!npx_exists) { printf("npxintr: npxproc = %p, curproc = %p, npx_exists = %d\n", PCPU_GET(npxproc), curproc, npx_exists); panic("npxintr from nowhere"); } - if (PCPU_GET(npxproc) != curproc) { - printf("npxintr: npxproc = %p, curproc = %p, npx_exists = %d\n", - PCPU_GET(npxproc), curproc, npx_exists); - panic("npxintr from non-current process"); - } - -#ifdef PC98 - outb(0xf8, 0); +#ifdef PC98 + outb(0xf8, 0); #else outb(0xf0, 0); #endif + mtx_lock_spin(&sched_lock); + if (PCPU_GET(npxproc) != curproc) { + /* + * Interrupt handling (for this or another interrupt) has + * switched npxproc from underneath us before we managed + * to handle this interrupt. Just ignore this interrupt. + * Control will eventually return to the instruction that + * caused it and it will repeat. In the npx_ex16 case, + * then we will eventually (usually soon) win the race. + * In the npx_irq13 case, we will always lose the race + * because we have switched to the IRQ13 thread. This will + * be fixed later. + */ + mtx_unlock_spin(&sched_lock); + return; + } fnstsw(&PCPU_GET(curpcb)->pcb_savefpu.sv_ex_sw); fnstcw(&control); fnclex(); + mtx_unlock_spin(&sched_lock); /* * Pass exception to process. */ + mtx_lock(&Giant); frame = (struct intrframe *)&dummy; /* XXX */ if ((ISPL(frame->if_cs) == SEL_UPL) || (frame->if_eflags & PSL_VM)) { /* |