diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2002-05-22 18:43:46 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2002-05-22 18:43:46 +0000 |
commit | ff7ba5ee5e176055bde5d43421ec1cf66569ec36 (patch) | |
tree | cbf17ac6f1661eed2107fc2c44a25802d07396cf | |
parent | 041a77905509f056c270536af97c21d430bc392d (diff) |
Implement splassert. Even simpler than on the sparc.
-rw-r--r-- | sys/arch/i386/i386/machdep.c | 12 | ||||
-rw-r--r-- | sys/arch/i386/include/intr.h | 19 |
2 files changed, 28 insertions, 3 deletions
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index adcc155d3e9..765983ddd8c 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.207 2002/05/18 19:39:01 mickey Exp $ */ +/* $OpenBSD: machdep.c,v 1.208 2002/05/22 18:43:45 art Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -3390,5 +3390,15 @@ _bus_dmamem_alloc_range(t, size, alignment, boundary, segs, nsegs, rsegs, return (0); } +#ifdef DIAGNOSTIC +void +splassert_check(int wantipl, const char *func) +{ + if (cpl < wantipl) { + splassert_fail(wantipl, cpl, func); + } +} +#endif + /* If SMALL_KERNEL this results in an out of line definition of splx. */ SPLX_OUTLINED_BODY diff --git a/sys/arch/i386/include/intr.h b/sys/arch/i386/include/intr.h index 368b86a6c5e..a08d6b63364 100644 --- a/sys/arch/i386/include/intr.h +++ b/sys/arch/i386/include/intr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: intr.h,v 1.14 2002/04/29 07:35:18 miod Exp $ */ +/* $OpenBSD: intr.h,v 1.15 2002/05/22 18:43:45 art Exp $ */ /* $NetBSD: intr.h,v 1.5 1996/05/13 06:11:28 mycroft Exp $ */ /* @@ -112,7 +112,22 @@ static __inline int spllower(int); static __inline void softintr(int); /* SPL asserts */ -#define splassert(wantipl) /* nothing */ +#ifdef DIAGNOSTIC +/* + * Although this function is implemented in MI code, it must be in this MD + * header because we don't want this header to include MI includes. + */ +void splassert_fail(int, int, const char *); +extern int splassert_ctl; +void splassert_check(int, const char *); +#define splassert(__wantipl) do { \ + if (__predict_false(splassert_ctl > 0)) { \ + splassert_check(__wantipl, __func__); \ + } \ +} while (0) +#else +#define splassert(wantipl) do { /* nada */ } while (0) +#endif /* * Raise current interrupt priority level, and return the old one. |