summaryrefslogtreecommitdiff
path: root/sys/arch/sparc64
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2002-05-21 16:15:54 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2002-05-21 16:15:54 +0000
commitc381a6f4a50ec9730de45076f46455375486140e (patch)
tree5347d0c1f7f30d77114c5d41a7e98e24eba995dc /sys/arch/sparc64
parentb5f01573c3733d613294f1ebe3673f26a7a2acdc (diff)
Implement splassert just like it's on sparc.
This also requires a change to rename {PIL,IPL}_IMP to {PIL,IPL}_VM. XXX - We should get rid of PIL_*.
Diffstat (limited to 'sys/arch/sparc64')
-rw-r--r--sys/arch/sparc64/include/intr.h4
-rw-r--r--sys/arch/sparc64/include/psl.h24
-rw-r--r--sys/arch/sparc64/sparc64/intr.c15
3 files changed, 35 insertions, 8 deletions
diff --git a/sys/arch/sparc64/include/intr.h b/sys/arch/sparc64/include/intr.h
index 70dccdd829c..5257cace260 100644
--- a/sys/arch/sparc64/include/intr.h
+++ b/sys/arch/sparc64/include/intr.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: intr.h,v 1.3 2002/03/14 03:16:00 millert Exp $ */
+/* $OpenBSD: intr.h,v 1.4 2002/05/21 16:15:53 art Exp $ */
/* $NetBSD: intr.h,v 1.8 2001/01/14 23:50:30 thorpej Exp $ */
/*-
@@ -46,7 +46,7 @@
#define IPL_NET PIL_NET /* network */
#define IPL_SOFTSERIAL 4 /* serial */
#define IPL_TTY PIL_TTY /* terminal */
-#define IPL_IMP PIL_IMP /* memory allocation */
+#define IPL_VM PIL_VM /* memory allocation */
#define IPL_AUDIO PIL_AUD /* audio */
#define IPL_CLOCK PIL_CLOCK /* clock */
#define IPL_SERIAL PIL_SER /* serial */
diff --git a/sys/arch/sparc64/include/psl.h b/sys/arch/sparc64/include/psl.h
index 8e9447cb65e..9a35380949c 100644
--- a/sys/arch/sparc64/include/psl.h
+++ b/sys/arch/sparc64/include/psl.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: psl.h,v 1.5 2002/04/29 07:35:23 miod Exp $ */
+/* $OpenBSD: psl.h,v 1.6 2002/05/21 16:15:53 art Exp $ */
/* $NetBSD: psl.h,v 1.20 2001/04/13 23:30:05 thorpej Exp $ */
/*
@@ -86,7 +86,7 @@
#define PIL_TTY 6
#define PIL_LPT 6
#define PIL_NET 6
-#define PIL_IMP 7
+#define PIL_VM 7
#define PIL_CLOCK 10
#define PIL_FD 11
#define PIL_SER 12
@@ -262,8 +262,22 @@ static __inline void splx(int);
#endif
static __inline u_int64_t getver(void);
-/* 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
/*
* GCC pseudo-functions for manipulating privileged registers
@@ -390,7 +404,7 @@ SPLHOLD(spllpt, PIL_LPT)
/*
* Memory allocation (must be as high as highest network, tty, or disk device)
*/
-SPLHOLD(splvm, PIL_IMP)
+SPLHOLD(splvm, PIL_VM)
#define splimp splvm
SPLHOLD(splclock, PIL_CLOCK)
diff --git a/sys/arch/sparc64/sparc64/intr.c b/sys/arch/sparc64/sparc64/intr.c
index df0256a27e4..da278979deb 100644
--- a/sys/arch/sparc64/sparc64/intr.c
+++ b/sys/arch/sparc64/sparc64/intr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: intr.c,v 1.8 2002/03/14 01:26:45 millert Exp $ */
+/* $OpenBSD: intr.c,v 1.9 2002/05/21 16:15:53 art Exp $ */
/* $NetBSD: intr.c,v 1.39 2001/07/19 23:38:11 eeh Exp $ */
/*
@@ -344,3 +344,16 @@ softintr_schedule(cookie)
send_softint(-1, ih->ih_pil, ih);
}
+
+void
+splassert_check(int wantipl, const char *func)
+{
+ int oldipl;
+
+ __asm __volatile("rdpr %%pil,%0" : "=r" (oldipl));
+
+ if (oldipl < wantipl) {
+ splassert_fail(wantipl, oldipl, func);
+ }
+}
+