diff options
author | Owain Ainsworth <oga@cvs.openbsd.org> | 2009-04-19 17:50:19 +0000 |
---|---|---|
committer | Owain Ainsworth <oga@cvs.openbsd.org> | 2009-04-19 17:50:19 +0000 |
commit | c9eacd92073efd8ad00f150bc65934fcd0b10192 (patch) | |
tree | 0e2fadfa6ebfd904b43cbfa2fec78227912aca41 /sys/arch/i386/include | |
parent | daf87eb28ec0bc166d6dcff7f6e3701e8bf82852 (diff) |
Switch the softinterrupt code on x86 over to mutexes instead of
simplelocks + splhigh().
First part of making it possible to make mpsafe softinterrupts.
"oh yes, definitely" miod@
Diffstat (limited to 'sys/arch/i386/include')
-rw-r--r-- | sys/arch/i386/include/intr.h | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/sys/arch/i386/include/intr.h b/sys/arch/i386/include/intr.h index 812af4d74d1..fd5f02fa4af 100644 --- a/sys/arch/i386/include/intr.h +++ b/sys/arch/i386/include/intr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: intr.h,v 1.37 2009/03/15 19:40:40 miod Exp $ */ +/* $OpenBSD: intr.h,v 1.38 2009/04/19 17:50:18 oga Exp $ */ /* $NetBSD: intr.h,v 1.5 1996/05/13 06:11:28 mycroft Exp $ */ /* @@ -36,6 +36,7 @@ #include <machine/intrdefs.h> #ifndef _LOCORE +#include <sys/mutex.h> #include <machine/cpu.h> extern volatile u_int32_t lapic_tpr; /* Current interrupt priority level. */ @@ -170,23 +171,11 @@ struct i386_soft_intrhand { struct i386_soft_intr { TAILQ_HEAD(, i386_soft_intrhand) - softintr_q; - int softintr_ssir; - struct simplelock softintr_slock; + softintr_q; + int softintr_ssir; + struct mutex softintr_lock; }; -#define i386_softintr_lock(si, s) \ -do { \ - (s) = splhigh(); \ - simple_lock(&si->softintr_slock); \ -} while (/*CONSTCOND*/ 0) - -#define i386_softintr_unlock(si, s) \ -do { \ - simple_unlock(&si->softintr_slock); \ - splx((s)); \ -} while (/*CONSTCOND*/ 0) - void *softintr_establish(int, void (*)(void *), void *); void softintr_disestablish(void *); void softintr_init(void); @@ -196,15 +185,14 @@ void softintr_dispatch(int); do { \ struct i386_soft_intrhand *__sih = (arg); \ struct i386_soft_intr *__si = __sih->sih_intrhead; \ - int __s; \ \ - i386_softintr_lock(__si, __s); \ + mtx_enter(&__si->softintr_lock); \ if (__sih->sih_pending == 0) { \ TAILQ_INSERT_TAIL(&__si->softintr_q, __sih, sih_q); \ __sih->sih_pending = 1; \ softintr(__si->softintr_ssir); \ } \ - i386_softintr_unlock(__si, __s); \ + mtx_leave(&__si->softintr_lock); \ } while (/*CONSTCOND*/ 0) #endif /* _LOCORE */ |