summaryrefslogtreecommitdiffstats
path: root/sys/arch/beagle/dev/intc.c
diff options
context:
space:
mode:
authordrahn <drahn@openbsd.org>2010-06-01 03:11:43 +0000
committerdrahn <drahn@openbsd.org>2010-06-01 03:11:43 +0000
commit406f43a02379008ded39fe6576b8b9e11d359895 (patch)
treeda25bbaacb7b147284e19418ffe86077ca16a519 /sys/arch/beagle/dev/intc.c
parentFix some code hidden in DIAGNOSTIC. (diff)
downloadwireguard-openbsd-406f43a02379008ded39fe6576b8b9e11d359895.tar.xz
wireguard-openbsd-406f43a02379008ded39fe6576b8b9e11d359895.zip
Fix splassert code, (previously hidden in DIAGNOSTIC).
Diffstat (limited to 'sys/arch/beagle/dev/intc.c')
-rw-r--r--sys/arch/beagle/dev/intc.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/sys/arch/beagle/dev/intc.c b/sys/arch/beagle/dev/intc.c
index 71518f14b0f..27df50c37e1 100644
--- a/sys/arch/beagle/dev/intc.c
+++ b/sys/arch/beagle/dev/intc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: intc.c,v 1.1 2009/05/08 03:13:26 drahn Exp $ */
+/* $OpenBSD: intc.c,v 1.2 2010/06/01 03:11:43 drahn Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
*
@@ -499,3 +499,21 @@ void intc_test(void)
printf("done\n");
}
#endif
+
+#ifdef DIAGNOSTIC
+void
+intc_splassert_check(int wantipl, const char *func)
+{
+ int oldipl = current_ipl_level;
+
+ 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.
+ */
+ intc_setipl(wantipl);
+ }
+}
+#endif
+