summaryrefslogtreecommitdiffstats
path: root/sys/i386/isa/ipl_funcs.c
diff options
context:
space:
mode:
authorps <ps@FreeBSD.org>2000-03-19 14:55:42 +0000
committerps <ps@FreeBSD.org>2000-03-19 14:55:42 +0000
commit98dc3507a2094d6e5c76ad414570fa726e1ad895 (patch)
tree8ea07deda5714acb97e70e3a57a4f213c970b7fc /sys/i386/isa/ipl_funcs.c
parent7a6ba845319116578d4fd8a3551a85dbbf77dced (diff)
downloadFreeBSD-src-98dc3507a2094d6e5c76ad414570fa726e1ad895.zip
FreeBSD-src-98dc3507a2094d6e5c76ad414570fa726e1ad895.tar.gz
Make SPLASSERT sysctl and boot time tunable with kern.splassertmode.
The following values are understood: 0 (ignore), 1 (log), and 2 (panic). The default value is 1. Reviewed by: peter
Diffstat (limited to 'sys/i386/isa/ipl_funcs.c')
-rw-r--r--sys/i386/isa/ipl_funcs.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/sys/i386/isa/ipl_funcs.c b/sys/i386/isa/ipl_funcs.c
index 13a0743..d7ba1c4 100644
--- a/sys/i386/isa/ipl_funcs.c
+++ b/sys/i386/isa/ipl_funcs.c
@@ -28,6 +28,8 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/sysctl.h>
#include <machine/ipl.h>
#include <machine/globals.h>
#include <i386/isa/intr_machdep.h>
@@ -66,12 +68,44 @@ softclockpending(void)
}
#ifdef INVARIANT_SUPPORT
+
+#define SPLASSERT_IGNORE 0
+#define SPLASSERT_LOG 1
+#define SPLASSERT_PANIC 2
+
+static int splassertmode = SPLASSERT_LOG;
+SYSCTL_INT(_kern, OID_AUTO, splassertmode, CTLFLAG_RW,
+ &splassertmode, 0, "Set the mode of SPLASSERT");
+
+static void
+init_splassertmode(void *ignored)
+{
+ TUNABLE_INT_FETCH("kern.splassertmode", 0, splassertmode);
+}
+SYSINIT(param, SI_SUB_TUNABLES, SI_ORDER_ANY, init_splassertmode, NULL);
+
+static void
+splassertfail(char *str, const char *msg, char *name, int level)
+{
+ switch (splassertmode) {
+ case SPLASSERT_IGNORE:
+ break;
+ case SPLASSERT_LOG:
+ printf(str, msg, name, level);
+ printf("\n");
+ break;
+ case SPLASSERT_PANIC:
+ panic(str, msg, name, level);
+ break;
+ }
+}
+
#define GENSPLASSERT(NAME, MODIFIER) \
void \
NAME##assert(const char *msg) \
{ \
if ((cpl & (MODIFIER)) != (MODIFIER)) \
- panic("%s: not %s, cpl == %#x", \
+ splassertfail("%s: not %s, cpl == %#x", \
msg, __XSTRING(NAME) + 3, cpl); \
}
#else
OpenPOWER on IntegriCloud