summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2007-04-18 21:21:19 +0000
committermiod <miod@openbsd.org>2007-04-18 21:21:19 +0000
commitb6fc70419385e22fcd9269a49d532dec34d54d85 (patch)
tree8a907372131e6931e4391877b0673a4bed927b8c
parentPass arguments to DPRINTF in the right order. (diff)
downloadwireguard-openbsd-b6fc70419385e22fcd9269a49d532dec34d54d85.tar.xz
wireguard-openbsd-b6fc70419385e22fcd9269a49d532dec34d54d85.zip
Use atomic operations to change the pending software interrupt mask.
-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);
}
}