mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-17 15:27:36 +00:00
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.
This commit is contained in:
parent
2bfaac9755
commit
90bb57afd9
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=57294
@ -165,3 +165,34 @@ GENSET(schedsoftcambio, &idelayed, 1 << SWI_CAMBIO)
|
||||
GENSET(schedsoftvm, &idelayed, 1 << SWI_VM)
|
||||
GENSET(schedsoftclock, &idelayed, 1 << SWI_CLOCK)
|
||||
|
||||
#ifdef INVARIANT_SUPPORT
|
||||
#define GENSPLASSERT(name, pri) \
|
||||
void \
|
||||
name##assert(const char *msg) \
|
||||
{ \
|
||||
u_int cpl; \
|
||||
\
|
||||
cpl = getcpl(); \
|
||||
if (cpl < ALPHA_PSL_IPL_##pri); \
|
||||
panic("%s: not %s, cpl == %#x", \
|
||||
msg, __XSTRING(name) + 3, cpl); \
|
||||
}
|
||||
#else
|
||||
#define GENSPLASSERT(name, pri)
|
||||
#endif
|
||||
|
||||
GENSPLASSERT(splbio, IO)
|
||||
GENSPLASSERT(splcam, IO)
|
||||
GENSPLASSERT(splclock, CLOCK)
|
||||
GENSPLASSERT(splhigh, HIGH)
|
||||
GENSPLASSERT(splimp, IO)
|
||||
GENSPLASSERT(splnet, IO)
|
||||
GENSPLASSERT(splsoftcam, SOFT)
|
||||
GENSPLASSERT(splsoftcambio, SOFT) /* XXX no corresponding spl for alpha */
|
||||
GENSPLASSERT(splsoftcamnet, SOFT) /* XXX no corresponding spl for alpha */
|
||||
GENSPLASSERT(splsoftclock, SOFT)
|
||||
GENSPLASSERT(splsofttty, SOFT) /* XXX no corresponding spl for alpha */
|
||||
GENSPLASSERT(splsoftvm, SOFT)
|
||||
GENSPLASSERT(splstatclock, CLOCK)
|
||||
GENSPLASSERT(spltty, IO)
|
||||
GENSPLASSERT(splvm, IO)
|
||||
|
@ -70,12 +70,6 @@ static __inline int name(void) \
|
||||
return s; \
|
||||
} else \
|
||||
return cpl; \
|
||||
} \
|
||||
\
|
||||
static __inline int \
|
||||
is_##name(void) \
|
||||
{ \
|
||||
return (getcpl() >= ALPHA_PSL_IPL_##pri); \
|
||||
}
|
||||
|
||||
SPLUP(splsoftcam, SOFT)
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -44,7 +44,6 @@
|
||||
|
||||
#include <machine/atomic.h>
|
||||
#include <machine/cpufunc.h>
|
||||
#include <machine/ipl.h>
|
||||
#include <sys/callout.h>
|
||||
|
||||
extern int securelevel; /* system security level (see init(8)) */
|
||||
@ -76,10 +75,7 @@ extern int bootverbose; /* nonzero to print verbose messages */
|
||||
|
||||
#ifdef INVARIANTS /* The option is always available */
|
||||
#define KASSERT(exp,msg) do { if (!(exp)) panic msg; } while (0)
|
||||
#define SPLSTRINGIZE(a) #a
|
||||
#define SPLASSERT(level, msg) \
|
||||
KASSERT(is_spl##level(), ("%s: not spl%s, cpl == 0x%08x\n", \
|
||||
(msg), SPLSTRINGIZE(level), cpl))
|
||||
#define SPLASSERT(level, msg) __CONCAT(__CONCAT(spl,level),assert)(msg)
|
||||
#else
|
||||
#define KASSERT(exp,msg)
|
||||
#define SPLASSERT(level, msg)
|
||||
@ -203,6 +199,10 @@ void untimeout __P((timeout_t *, void *, struct callout_handle));
|
||||
|
||||
/* Interrupt management */
|
||||
|
||||
/*
|
||||
* For the alpha arch, some of these functions are static __inline, and
|
||||
* the others should be.
|
||||
*/
|
||||
#ifdef __i386__
|
||||
void setdelayed __P((void));
|
||||
void setsoftast __P((void));
|
||||
@ -234,26 +234,6 @@ intrmask_t splsoftvm __P((void));
|
||||
intrmask_t splstatclock __P((void));
|
||||
intrmask_t spltty __P((void));
|
||||
intrmask_t splvm __P((void));
|
||||
#if defined (INVARIANT_SUPPORT)
|
||||
/*
|
||||
* The Alpha has all of these as static __inline.
|
||||
*/
|
||||
int is_splbio __P((void));
|
||||
int is_splcam __P((void));
|
||||
int is_splclock __P((void));
|
||||
int is_splhigh __P((void));
|
||||
int is_splimp __P((void));
|
||||
int is_splnet __P((void));
|
||||
int is_splsoftcam __P((void));
|
||||
int is_splsoftcambio __P((void));
|
||||
int is_splsoftcamnet __P((void));
|
||||
int is_splsoftclock __P((void));
|
||||
int is_splsofttty __P((void));
|
||||
int is_splsoftvm __P((void));
|
||||
int is_splstatclock __P((void));
|
||||
int is_spltty __P((void));
|
||||
int is_splvm __P((void));
|
||||
#endif /* INVARIANT_SUPPORT */
|
||||
void splx __P((intrmask_t ipl));
|
||||
void splz __P((void));
|
||||
#endif /* __i386__ */
|
||||
@ -262,6 +242,24 @@ void splz __P((void));
|
||||
#include <machine/ipl.h>
|
||||
#endif
|
||||
|
||||
#ifdef INVARIANT_SUPPORT
|
||||
void splbioassert __P((const char *msg));
|
||||
void splcamassert __P((const char *msg));
|
||||
void splclockassert __P((const char *msg));
|
||||
void splhighassert __P((const char *msg));
|
||||
void splimpassert __P((const char *msg));
|
||||
void splnetassert __P((const char *msg));
|
||||
void splsoftcamassert __P((const char *msg));
|
||||
void splsoftcambioassert __P((const char *msg));
|
||||
void splsoftcamnetassert __P((const char *msg));
|
||||
void splsoftclockassert __P((const char *msg));
|
||||
void splsoftttyassert __P((const char *msg));
|
||||
void splsoftvmassert __P((const char *msg));
|
||||
void splstatclockassert __P((const char *msg));
|
||||
void splttyassert __P((const char *msg));
|
||||
void splvmassert __P((const char *msg));
|
||||
#endif /* INVARIANT_SUPPORT */
|
||||
|
||||
/*
|
||||
* XXX It's not clear how "machine independent" these will be yet, but
|
||||
* they are used all over the place especially in pci drivers. We would
|
||||
|
Loading…
Reference in New Issue
Block a user