summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2007-04-18 21:21:21 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2007-04-18 21:21:21 +0000
commit064bc82a99db844d1f44c9e8ac3a9b7ea6d2f5d1 (patch)
tree6692ca0a272fc76c6a76aaf60462015d3e8866bb /sys/arch
parent725a338fe8fff3bbf42df88b8059fd3a51462f7e (diff)
Use atomic operations to change the pending software interrupt mask.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/m88k/include/cpu.h23
-rw-r--r--sys/arch/m88k/m88k/m88k_machdep.c34
2 files changed, 12 insertions, 45 deletions
diff --git a/sys/arch/m88k/include/cpu.h b/sys/arch/m88k/include/cpu.h
index 697cfcfc9af..36ea3083ac0 100644
--- a/sys/arch/m88k/include/cpu.h
+++ b/sys/arch/m88k/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.19 2007/03/15 10:22:29 art Exp $ */
+/* $OpenBSD: cpu.h,v 1.20 2007/04/18 21:21:19 miod Exp $ */
/*
* Copyright (c) 1996 Nivas Madhur
* Copyright (c) 1992, 1993
@@ -54,6 +54,7 @@
#ifdef _KERNEL
+#include <machine/atomic.h>
#include <machine/pcb.h>
#include <machine/psl.h>
#include <machine/intr.h>
@@ -181,23 +182,11 @@ struct clockframe {
*/
#include <machine/intr.h>
-#define SIR_NET 1
-#define SIR_CLOCK 2
-
-#ifdef MULTIPROCESSOR
-extern void setsoftint(int);
-extern int clrsoftint(int);
-#else
-extern int ssir;
-#define setsoftint(x) (ssir |= (x))
-#define clrsoftint(x) \
-({ \
- int tmpsir = ssir & (x); \
- ssir ^= tmpsir; \
- tmpsir; \
-})
-#endif /* MULTIPROCESSOR */
+#define SIR_NET 0x01
+#define SIR_CLOCK 0x02
+extern unsigned int ssir;
+#define setsoftint(x) atomic_setbits_int(&ssir, x)
#define setsoftnet() setsoftint(SIR_NET)
#define setsoftclock() setsoftint(SIR_CLOCK)
diff --git a/sys/arch/m88k/m88k/m88k_machdep.c b/sys/arch/m88k/m88k/m88k_machdep.c
index 22e33b0df16..70b2fab384f 100644
--- a/sys/arch/m88k/m88k/m88k_machdep.c
+++ b/sys/arch/m88k/m88k/m88k_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: m88k_machdep.c,v 1.17 2006/11/22 22:47:46 miod Exp $ */
+/* $OpenBSD: m88k_machdep.c,v 1.18 2007/04/18 21:21:20 miod Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -353,37 +353,13 @@ set_cpu_number(cpuid_t number)
* Soft interrupt interface
*/
-int ssir;
+unsigned int ssir;
int netisr;
-#ifdef MULTIPROCESSOR
-
-void
-setsoftint(int sir)
-{
- __mp_lock(&sir_lock);
- ssir |= sir;
- __mp_unlock(&sir_lock);
-}
-
-int
-clrsoftint(int sir)
-{
- int tmpsir;
-
- __mp_lock(&sir_lock);
- tmpsir = ssir & sir;
- ssir ^= tmpsir;
- __mp_unlock(&sir_lock);
-
- return (tmpsir);
-}
-#endif
-
void
dosoftint()
{
- if (clrsoftint(SIR_NET)) {
+ if (ISSET(ssir, SIR_NET)) {
uvmexp.softs++;
#define DONETISR(bit, fn) \
do { \
@@ -394,11 +370,13 @@ dosoftint()
} while (0)
#include <net/netisr_dispatch.h>
#undef DONETISR
+ atomic_clearbits_int(&ssir, SIR_NET);
}
- if (clrsoftint(SIR_CLOCK)) {
+ if (ISSET(ssir, SIR_CLOCK)) {
uvmexp.softs++;
softclock();
+ atomic_clearbits_int(&ssir, SIR_CLOCK);
}
}