diff options
Diffstat (limited to 'sys/arch/mvme88k')
-rw-r--r-- | sys/arch/mvme88k/include/intr.h | 19 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/trap.c | 21 |
2 files changed, 37 insertions, 3 deletions
diff --git a/sys/arch/mvme88k/include/intr.h b/sys/arch/mvme88k/include/intr.h index 8b520af881e..28c7f9379ed 100644 --- a/sys/arch/mvme88k/include/intr.h +++ b/sys/arch/mvme88k/include/intr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: intr.h,v 1.9 2002/04/29 07:35:20 miod Exp $ */ +/* $OpenBSD: intr.h,v 1.10 2003/01/03 23:17:42 miod Exp $ */ /* * Copyright (C) 2000 Steve Murphree, Jr. * All rights reserved. @@ -92,7 +92,22 @@ int spl0(void); /* needs major cleanup - XXX nivas */ /* 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 { /* nothing */ } while (0) +#endif #if 0 spl0 is a function by itself. I really am serious about the clean up diff --git a/sys/arch/mvme88k/mvme88k/trap.c b/sys/arch/mvme88k/mvme88k/trap.c index 76bf7e8858f..5a20d6eab0b 100644 --- a/sys/arch/mvme88k/mvme88k/trap.c +++ b/sys/arch/mvme88k/mvme88k/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.36 2002/05/16 21:11:16 miod Exp $ */ +/* $OpenBSD: trap.c,v 1.37 2003/01/03 23:17:43 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -1832,3 +1832,22 @@ register struct proc *p; return (0); } + +#ifdef DIAGNOSTIC +void +splassert_check(int wantipl, const char *func) +{ + int oldipl; + + oldipl = spl(); + + if (oldipl < wantipl) { + splassert_fail(wantipl, oldipl, func); + /* + * If the splassert_ctl is set to not panic, raise the ipl + * in a feeble attempt to reduce damage. + */ + setipl(wantipl); + } +} +#endif |