Module Name:    src
Committed By:   riastradh
Date:           Thu Jul 28 09:14:23 UTC 2022

Modified Files:
        src/sys/arch/arm/arm32: arm32_machdep.c

Log Message:
arm32: Refactor splhigh and restore in dosoftints.

No functional change intended.  splhigh always returns ci->ci_cpl,
which should not be changing at this point.  Makes the bracketing by
splhigh/splx clearer.


To generate a diff of this commit:
cvs rdiff -u -r1.143 -r1.144 src/sys/arch/arm/arm32/arm32_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/arm32/arm32_machdep.c
diff -u src/sys/arch/arm/arm32/arm32_machdep.c:1.143 src/sys/arch/arm/arm32/arm32_machdep.c:1.144
--- src/sys/arch/arm/arm32/arm32_machdep.c:1.143	Sat Mar 12 09:16:05 2022
+++ src/sys/arch/arm/arm32/arm32_machdep.c	Thu Jul 28 09:14:23 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: arm32_machdep.c,v 1.143 2022/03/12 09:16:05 skrll Exp $	*/
+/*	$NetBSD: arm32_machdep.c,v 1.144 2022/07/28 09:14:23 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.143 2022/03/12 09:16:05 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.144 2022/07/28 09:14:23 riastradh Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_arm_start.h"
@@ -663,15 +663,16 @@ dosoftints(void)
 	struct cpu_info * const ci = curcpu();
 	const int opl = ci->ci_cpl;
 	const uint32_t softiplmask = SOFTIPLMASK(opl);
+	int s;
 
-	splhigh();
+	s = splhigh();
+	KASSERT(s == opl);
 	for (;;) {
 		u_int softints = ci->ci_softints & softiplmask;
 		KASSERT((softints != 0) == ((ci->ci_softints >> opl) != 0));
 		KASSERT(opl == IPL_NONE || (softints & (1 << (opl - IPL_SOFTCLOCK))) == 0);
 		if (softints == 0) {
-			splx(opl);
-			return;
+			break;
 		}
 #define	DOSOFTINT(n) \
 		if (ci->ci_softints & (1 << (IPL_SOFT ## n - IPL_SOFTCLOCK))) { \
@@ -687,6 +688,7 @@ dosoftints(void)
 		DOSOFTINT(CLOCK);
 		panic("dosoftints wtf (softints=%u?, ipl=%d)", softints, opl);
 	}
+	splx(s);
 }
 #endif /* !__HAVE_PIC_FAST_SOFTINTS */
 #endif /* __HAVE_FAST_SOFTINTS */

Reply via email to