diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2010-04-22 21:03:18 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2010-04-22 21:03:18 +0000 |
commit | 5bf63a74dab57d24ac16f3fda888839fbc864249 (patch) | |
tree | 01f7c19865c29033ab8b980edaa252bb425500f6 /sys/arch | |
parent | 77a0f9836f97c78b20d395f1d6f6eb51b3201990 (diff) |
De-inline atomic_setbits_int and atomic_clearbits_int, on arm these functions
are emulated by disabling interrupts which requires a lot more header files
than a simple atomic operation should be need. ok deraadt@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/arm/arm/cpu.c | 25 | ||||
-rw-r--r-- | sys/arch/arm/include/atomic.h | 24 |
2 files changed, 27 insertions, 22 deletions
diff --git a/sys/arch/arm/arm/cpu.c b/sys/arch/arm/arm/cpu.c index 8c69b988d9f..e20c3756b4a 100644 --- a/sys/arch/arm/arm/cpu.c +++ b/sys/arch/arm/arm/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.10 2009/05/08 02:57:32 drahn Exp $ */ +/* $OpenBSD: cpu.c,v 1.11 2010/04/22 21:03:17 drahn Exp $ */ /* $NetBSD: cpu.c,v 1.56 2004/04/14 04:01:49 bsh Exp $ */ @@ -653,4 +653,27 @@ cpu_alloc_idlepcb(struct cpu_info *ci) } #endif /* MULTIPROCESSOR */ +/* + * eventually it would be interesting to have these functions + * support the V6/V7+ atomic instructions ldrex/strex if available + * on the CPU. + */ +void +atomic_setbits_int(__volatile unsigned int *uip, unsigned int v) +{ + int oldirqstate; + oldirqstate = disable_interrupts(I32_bit|F32_bit); + *uip |= v; + restore_interrupts(oldirqstate); +} + +void +atomic_clearbits_int(__volatile unsigned int *uip, unsigned int v) +{ + int oldirqstate; + oldirqstate = disable_interrupts(I32_bit|F32_bit); + *uip &= ~v; + restore_interrupts(oldirqstate); +} + /* End of cpu.c */ diff --git a/sys/arch/arm/include/atomic.h b/sys/arch/arm/include/atomic.h index a6a27b36b72..ebdc3ade1c6 100644 --- a/sys/arch/arm/include/atomic.h +++ b/sys/arch/arm/include/atomic.h @@ -1,4 +1,4 @@ -/* $OpenBSD: atomic.h,v 1.6 2010/04/21 03:03:25 deraadt Exp $ */ +/* $OpenBSD: atomic.h,v 1.7 2010/04/22 21:03:17 drahn Exp $ */ /* Public Domain */ @@ -7,31 +7,13 @@ #if defined(_KERNEL) -#include <arm/armreg.h> -#include <arm/cpufunc.h> - /* * on pre-v6 arm processors, it is necessary to disable interrupts if * in the kernel and atomic updates are necessary without full mutexes */ -static __inline void -atomic_setbits_int(__volatile unsigned int *uip, unsigned int v) -{ - int oldirqstate; - oldirqstate = disable_interrupts(I32_bit|F32_bit); - *uip |= v; - restore_interrupts(oldirqstate); -} - -static __inline void -atomic_clearbits_int(__volatile unsigned int *uip, unsigned int v) -{ - int oldirqstate; - oldirqstate = disable_interrupts(I32_bit|F32_bit); - *uip &= ~v; - restore_interrupts(oldirqstate); -} +void atomic_setbits_int(__volatile unsigned int *, unsigned int); +void atomic_clearbits_int(__volatile unsigned int *, unsigned int); #endif /* defined(_KERNEL) */ #endif /* __ARM_ATOMIC_H__ */ |