diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2009-03-04 19:37:16 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2009-03-04 19:37:16 +0000 |
commit | ce7eb9bc42780d9563daa8f7713629c83fdb6d98 (patch) | |
tree | 92dc30d214a6c9272892cb2b9fa8db63825d5b16 /sys/arch | |
parent | e76369dccd027f5c27487502290777d6368227ff (diff) |
Introduce atomic_clear_int() as an MD atomic operation to perform atomic
exchange with zero; use it in the soft interrupt code to make it simpler
and faster.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/m88k/include/atomic.h | 13 | ||||
-rw-r--r-- | sys/arch/m88k/m88k/m88k_machdep.c | 11 |
2 files changed, 15 insertions, 9 deletions
diff --git a/sys/arch/m88k/include/atomic.h b/sys/arch/m88k/include/atomic.h index 6dba1393f5a..86b6edec9da 100644 --- a/sys/arch/m88k/include/atomic.h +++ b/sys/arch/m88k/include/atomic.h @@ -1,4 +1,4 @@ -/* $OpenBSD: atomic.h,v 1.6 2009/02/20 20:40:01 miod Exp $ */ +/* $OpenBSD: atomic.h,v 1.7 2009/03/04 19:37:14 miod Exp $ */ /* Public Domain */ @@ -42,5 +42,16 @@ atomic_clearbits_int(__volatile unsigned int *uip, unsigned int v) #endif /* MULTIPROCESSOR */ +static __inline__ unsigned int +atomic_clear_int(__volatile unsigned int *uip) +{ + u_int oldval; + + oldval = 0; + __asm__ __volatile__ + ("xmem %0, %2, r0" : "+r"(oldval), "+m"(*uip) : "r"(uip)); + return oldval; +} + #endif /* defined(_KERNEL) */ #endif /* __M88K_ATOMIC_H__ */ diff --git a/sys/arch/m88k/m88k/m88k_machdep.c b/sys/arch/m88k/m88k/m88k_machdep.c index f592cead357..c824731bce7 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.47 2009/03/04 05:59:08 miod Exp $ */ +/* $OpenBSD: m88k_machdep.c,v 1.48 2009/03/04 19:37:15 miod Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -359,28 +359,23 @@ dosoftint() struct cpu_info *ci = curcpu(); int sir, n; - if ((sir = ci->ci_softintr) == 0) + if ((sir = atomic_clear_int(&ci->ci_softintr)) == 0) return; #ifdef MULTIPROCESSOR __mp_lock(&kernel_lock); #endif - atomic_clearbits_int(&ci->ci_softintr, sir); uvmexp.softs++; if (ISSET(sir, SIR_NET)) { - while ((n = netisr) != 0) { - atomic_clearbits_int(&netisr, n); - + while ((n = atomic_clear_int(&netisr)) != 0) { #define DONETISR(bit, fn) \ do { \ if (n & (1 << bit)) \ fn(); \ } while (0) - #include <net/netisr_dispatch.h> - #undef DONETISR } } |