summaryrefslogtreecommitdiffstats
path: root/sys/i386/isa/ipl_funcs.c
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>2000-02-17 18:37:45 +0000
committerbde <bde@FreeBSD.org>2000-02-17 18:37:45 +0000
commit170be2ce1212108cbc237b9dd81ad3396b179438 (patch)
treed98182bfc8ac4f8da10ad87ef136059fdf068230 /sys/i386/isa/ipl_funcs.c
parentd7cc86703addd25740b7f34e29d45ffdfa11947c (diff)
downloadFreeBSD-src-170be2ce1212108cbc237b9dd81ad3396b179438.zip
FreeBSD-src-170be2ce1212108cbc237b9dd81ad3396b179438.tar.gz
Don't include <machine/ipl.h> in <sys/systm.h> in the i386 case. This
fixes some namespace pollution in general and breakage of modules that aren't in the sys tree in particular (<machine/ipl.h> includes further headers that aren't installed under /usr/include). Reimplemented SPLASSERT() so that it is more machine independent and less bloated and doesn't require the <machine/ipl.h> include spam. In particular, don't assume that `cpl' can be printed using %08x format. The alpha arch doesn't even have `cpl'. SPLASSERT() was harmless on alphas because it isn't actually used.
Diffstat (limited to 'sys/i386/isa/ipl_funcs.c')
-rw-r--r--sys/i386/isa/ipl_funcs.c63
1 files changed, 32 insertions, 31 deletions
diff --git a/sys/i386/isa/ipl_funcs.c b/sys/i386/isa/ipl_funcs.c
index 14d74c9..13a0743 100644
--- a/sys/i386/isa/ipl_funcs.c
+++ b/sys/i386/isa/ipl_funcs.c
@@ -26,7 +26,7 @@
* $FreeBSD$
*/
-#include <sys/types.h>
+#include <sys/param.h>
#include <sys/systm.h>
#include <machine/ipl.h>
#include <machine/globals.h>
@@ -67,27 +67,29 @@ softclockpending(void)
#ifdef INVARIANT_SUPPORT
#define GENSPLASSERT(NAME, MODIFIER) \
-int \
-is_##NAME(void) \
+void \
+NAME##assert(const char *msg) \
{ \
- return ((cpl & (MODIFIER)) == (MODIFIER)); \
+ if ((cpl & (MODIFIER)) != (MODIFIER)) \
+ panic("%s: not %s, cpl == %#x", \
+ msg, __XSTRING(NAME) + 3, cpl); \
}
#else
-#define GENSPLASSERT(NAME, MODIFIER)
+#define GENSPLASSERT(NAME, MODIFIER)
#endif
#ifndef SMP
-#define GENSPL(NAME, OP, MODIFIER, PC) \
-unsigned NAME(void) \
-{ \
- unsigned x; \
- \
- x = cpl; \
- cpl OP MODIFIER; \
- return (x); \
-} \
-GENSPLASSERT(NAME, MODIFIER)
+#define GENSPL(NAME, OP, MODIFIER, PC) \
+GENSPLASSERT(NAME, MODIFIER) \
+unsigned NAME(void) \
+{ \
+ unsigned x; \
+ \
+ x = cpl; \
+ cpl OP MODIFIER; \
+ return (x); \
+}
void
spl0(void)
@@ -167,6 +169,7 @@ splq(intrmask_t mask)
#ifdef INTR_SPL
#define GENSPL(NAME, OP, MODIFIER, PC) \
+GENSPLASSERT(NAME, MODIFIER) \
unsigned NAME(void) \
{ \
unsigned x, y; \
@@ -198,25 +201,23 @@ unsigned NAME(void) \
IFCPL_UNLOCK(); \
\
return (x); \
-} \
-GENSPLASSERT(NAME, MODIFIER)
-
+}
#else /* INTR_SPL */
-#define GENSPL(NAME, OP, MODIFIER, PC) \
-unsigned NAME(void) \
-{ \
- unsigned x; \
- \
- IFCPL_LOCK(); \
- x = cpl; \
- cpl OP MODIFIER; \
- IFCPL_UNLOCK(); \
- \
- return (x); \
-} \
-GENSPLASSERT(NAME, MODIFIER)
+#define GENSPL(NAME, OP, MODIFIER, PC) \
+GENSPLASSERT(NAME, MODIFIER) \
+unsigned NAME(void) \
+{ \
+ unsigned x; \
+ \
+ IFCPL_LOCK(); \
+ x = cpl; \
+ cpl OP MODIFIER; \
+ IFCPL_UNLOCK(); \
+ \
+ return (x); \
+}
#endif /* INTR_SPL */
OpenPOWER on IntegriCloud