summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/arm/arm/cpu.c25
-rw-r--r--sys/arch/arm/include/atomic.h24
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__ */