diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2004-05-23 00:06:02 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2004-05-23 00:06:02 +0000 |
commit | 8e2fdea3617d321901f4109e7ca50b86f4e91b83 (patch) | |
tree | a1a31aba81eb54e3e796030dec178a984866bce0 /sys | |
parent | db5404f3ae88bd9265fab3417ce85642a37829b6 (diff) |
workaround gcc brokenness by outlining spl functions.
finally solves vfs corruption. hint and ok art@, ok deraadt@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/i386/i386/machdep.c | 58 | ||||
-rw-r--r-- | sys/arch/i386/include/intr.h | 80 |
2 files changed, 60 insertions, 78 deletions
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index 2a7a6db3ac3..da608741a17 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.292 2004/05/19 18:17:00 tedu Exp $ */ +/* $OpenBSD: machdep.c,v 1.293 2004/05/23 00:06:01 tedu Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -3914,5 +3914,57 @@ splassert_check(int wantipl, const char *func) } #endif -/* If SMALL_KERNEL this results in an out of line definition of splx. */ -SPLX_OUTLINED_BODY +/* + * Software interrupt registration + * + * We hand-code this to ensure that it's atomic. + */ +void +softintr(mask) + int mask; +{ + __asm __volatile("orl %1, %0" : "=m"(ipending) : "ir" (mask)); + +} + +/* + * Raise current interrupt priority level, and return the old one. + */ +int +splraise(ncpl) + int ncpl; +{ + int ocpl = cpl; + + if (ncpl > ocpl) + cpl = ncpl; + return (ocpl); +} + +/* + * Restore an old interrupt priority level. If any thereby unmasked + * interrupts are pending, call Xspllower() to process them. + */ +void \ +splx(ncpl) \ + int ncpl; \ +{ \ + cpl = ncpl; \ + if (ipending & IUNMASK(ncpl)) \ + Xspllower(); \ +} + +/* + * Same as splx(), but we return the old value of spl, for the + * benefit of some splsoftclock() callers. + */ +int +spllower(ncpl) + int ncpl; +{ + int ocpl = cpl; + + splx(ncpl); + return (ocpl); +} + diff --git a/sys/arch/i386/include/intr.h b/sys/arch/i386/include/intr.h index d149d5bcab0..00ba2cea665 100644 --- a/sys/arch/i386/include/intr.h +++ b/sys/arch/i386/include/intr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: intr.h,v 1.19 2003/04/17 03:42:14 drahn Exp $ */ +/* $OpenBSD: intr.h,v 1.20 2004/05/23 00:06:01 tedu Exp $ */ /* $NetBSD: intr.h,v 1.5 1996/05/13 06:11:28 mycroft Exp $ */ /* @@ -108,10 +108,10 @@ int iunmask[NIPL]; /* Bitmasks telling what interrupts are accepted. */ extern void Xspllower(void); -static __inline int splraise(int); -static __inline int spllower(int); -#define SPLX_DECL void splx(int); -static __inline void softintr(int); +int splraise(int); +int spllower(int); +void splx(int); +void softintr(int); /* SPL asserts */ #ifdef DIAGNOSTIC @@ -132,63 +132,6 @@ void splassert_check(int, const char *); #endif /* - * Raise current interrupt priority level, and return the old one. - */ -static __inline int -splraise(ncpl) - int ncpl; -{ - int ocpl = cpl; - - if (ncpl > ocpl) - cpl = ncpl; - __asm __volatile("":::"memory"); - return (ocpl); -} - -/* - * Restore an old interrupt priority level. If any thereby unmasked - * interrupts are pending, call Xspllower() to process them. - */ -#define SPLX_BODY \ -void \ -splx(ncpl) \ - int ncpl; \ -{ \ - __asm __volatile("":::"memory"); \ - cpl = ncpl; \ - if (ipending & IUNMASK(ncpl)) \ - Xspllower(); \ -} - -/* If SMALL_KERNEL make splx out of line, otherwise inline it. */ -#ifdef SMALL_KERNEL -#define SPLX_INLINED_BODY -#define SPLX_OUTLINED_BODY SPLX_BODY -SPLX_DECL -#else -#define SPLX_INLINED_BODY static __inline SPLX_BODY -#define SPLX_OUTLINED_BODY -static __inline SPLX_DECL -#endif - -SPLX_INLINED_BODY - -/* - * Same as splx(), but we return the old value of spl, for the - * benefit of some splsoftclock() callers. - */ -static __inline int -spllower(ncpl) - int ncpl; -{ - int ocpl = cpl; - - splx(ncpl); - return (ocpl); -} - -/* * Hardware interrupt masks */ #define splbio() splraise(IPL_BIO) @@ -217,19 +160,6 @@ spllower(ncpl) #define splhigh() splraise(IPL_HIGH) #define spl0() spllower(IPL_NONE) -/* - * Software interrupt registration - * - * We hand-code this to ensure that it's atomic. - */ -static __inline void -softintr(mask) - int mask; -{ - __asm __volatile("orl %1, %0" : "=m"(ipending) : "ir" (mask)); - -} - #define setsoftast() (astpending = 1) #define setsoftclock() softintr(1 << SIR_CLOCK) #define setsoftnet() softintr(1 << SIR_NET) |