summaryrefslogtreecommitdiffstats
path: root/include/asm-m68k/atomic.h
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1997-04-29 21:13:14 +0000
committer <ralf@linux-mips.org>1997-04-29 21:13:14 +0000
commit19c9bba94152148523ba0f7ef7cffe3d45656b11 (patch)
tree40b1cb534496a7f1ca0f5c314a523c69f1fee464 /include/asm-m68k/atomic.h
parent7206675c40394c78a90e74812bbdbf8cf3cca1be (diff)
Import of Linux/MIPS 2.1.36
Diffstat (limited to 'include/asm-m68k/atomic.h')
-rw-r--r--include/asm-m68k/atomic.h22
1 files changed, 16 insertions, 6 deletions
diff --git a/include/asm-m68k/atomic.h b/include/asm-m68k/atomic.h
index 8ea909203..b57cc9cb0 100644
--- a/include/asm-m68k/atomic.h
+++ b/include/asm-m68k/atomic.h
@@ -10,33 +10,43 @@
* We do not have SMP m68k systems, so we don't have to deal with that.
*/
-typedef int atomic_t;
+typedef struct { int counter; } atomic_t;
+#define ATOMIC_INIT { 0 }
-static __inline__ void atomic_add(atomic_t i, atomic_t *v)
+#define atomic_read(v) ((v)->counter)
+#define atomic_set(v, i) (((v)->counter) = i)
+
+static __inline__ void atomic_add(int i, atomic_t *v)
{
__asm__ __volatile__("addl %1,%0" : : "m" (*v), "id" (i));
}
-static __inline__ void atomic_sub(atomic_t i, atomic_t *v)
+static __inline__ void atomic_sub(int i, atomic_t *v)
{
__asm__ __volatile__("subl %1,%0" : : "m" (*v), "id" (i));
}
-static __inline__ void atomic_inc(atomic_t *v)
+static __inline__ void atomic_inc(volatile atomic_t *v)
{
__asm__ __volatile__("addql #1,%0" : : "m" (*v));
}
-static __inline__ void atomic_dec(atomic_t *v)
+static __inline__ void atomic_dec(volatile atomic_t *v)
{
__asm__ __volatile__("subql #1,%0" : : "m" (*v));
}
-static __inline__ int atomic_dec_and_test(atomic_t *v)
+static __inline__ int atomic_dec_and_test(volatile atomic_t *v)
{
char c;
__asm__ __volatile__("subql #1,%1; seq %0" : "=d" (c) : "m" (*v));
return c != 0;
}
+#define atomic_clear_mask(mask, v) \
+ __asm__ __volatile__("andl %1,%0" : : "m" (*v), "id" (~(mask)))
+
+#define atomic_set_mask(mask, v) \
+ __asm__ __volatile__("orl %1,%0" : : "m" (*v), "id" (mask));
+
#endif /* __ARCH_M68K_ATOMIC __ */