diff options
author | Visa Hankala <visa@cvs.openbsd.org> | 2019-09-05 05:31:39 +0000 |
---|---|---|
committer | Visa Hankala <visa@cvs.openbsd.org> | 2019-09-05 05:31:39 +0000 |
commit | 4b2b041ac8a7c0b6420ddab454af2762ad8194a3 (patch) | |
tree | 33bd2a9fe45021c9212fb42ef75f5d24b61b4390 /sys/arch | |
parent | 3b6ad0ff73e79a075e7b058bc11d904693203c69 (diff) |
Implement splassert() on mips64.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/loongson/include/intr.h | 18 | ||||
-rw-r--r-- | sys/arch/mips64/mips64/interrupt.c | 16 | ||||
-rw-r--r-- | sys/arch/octeon/include/intr.h | 18 | ||||
-rw-r--r-- | sys/arch/sgi/include/intr.h | 18 |
4 files changed, 66 insertions, 4 deletions
diff --git a/sys/arch/loongson/include/intr.h b/sys/arch/loongson/include/intr.h index c510a2b68cb..07664a637d6 100644 --- a/sys/arch/loongson/include/intr.h +++ b/sys/arch/loongson/include/intr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: intr.h,v 1.17 2019/09/05 05:06:33 visa Exp $ */ +/* $OpenBSD: intr.h,v 1.18 2019/09/05 05:31:38 visa Exp $ */ /* * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -128,8 +128,24 @@ void softintr_schedule(void *); void splinit(void); +#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 (splassert_ctl > 0) { \ + splassert_check(__wantipl, __func__); \ + } \ +} while (0) +#define splsoftassert(wantipl) splassert(wantipl) +#else #define splassert(X) #define splsoftassert(X) +#endif void register_splx_handler(void (*)(int)); int splraise(int); diff --git a/sys/arch/mips64/mips64/interrupt.c b/sys/arch/mips64/mips64/interrupt.c index 54e6bb1874a..764d887b5c5 100644 --- a/sys/arch/mips64/mips64/interrupt.c +++ b/sys/arch/mips64/mips64/interrupt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: interrupt.c,v 1.72 2019/09/05 05:06:33 visa Exp $ */ +/* $OpenBSD: interrupt.c,v 1.73 2019/09/05 05:31:38 visa Exp $ */ /* * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -247,3 +247,17 @@ spllower(int newipl) splx(newipl); return oldipl; } + +#ifdef DIAGNOSTIC +void +splassert_check(int wantipl, const char *func) +{ + struct cpu_info *ci = curcpu(); + + if (ci->ci_ipl < wantipl) + splassert_fail(wantipl, ci->ci_ipl, func); + + if (wantipl == IPL_NONE && ci->ci_intrdepth != 0) + splassert_fail(-1, ci->ci_intrdepth, func); +} +#endif diff --git a/sys/arch/octeon/include/intr.h b/sys/arch/octeon/include/intr.h index 04e0ee26923..6fd2cddb734 100644 --- a/sys/arch/octeon/include/intr.h +++ b/sys/arch/octeon/include/intr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: intr.h,v 1.21 2019/09/05 05:06:33 visa Exp $ */ +/* $OpenBSD: intr.h,v 1.22 2019/09/05 05:31:38 visa Exp $ */ /* * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -127,8 +127,24 @@ void softintr_schedule(void *); void splinit(void); +#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 (splassert_ctl > 0) { \ + splassert_check(__wantipl, __func__); \ + } \ +} while (0) +#define splsoftassert(wantipl) splassert(wantipl) +#else #define splassert(X) #define splsoftassert(X) +#endif void register_splx_handler(void (*)(int)); int splraise(int); diff --git a/sys/arch/sgi/include/intr.h b/sys/arch/sgi/include/intr.h index 67246316b15..cbd905b8fcc 100644 --- a/sys/arch/sgi/include/intr.h +++ b/sys/arch/sgi/include/intr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: intr.h,v 1.52 2019/09/05 05:06:33 visa Exp $ */ +/* $OpenBSD: intr.h,v 1.53 2019/09/05 05:31:38 visa Exp $ */ /* * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -127,8 +127,24 @@ void softintr_schedule(void *); void splinit(void); +#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 (splassert_ctl > 0) { \ + splassert_check(__wantipl, __func__); \ + } \ +} while (0) +#define splsoftassert(wantipl) splassert(wantipl) +#else #define splassert(X) #define splsoftassert(X) +#endif void register_splx_handler(void (*)(int)); int splraise(int); |