patch-1.3.99 linux/include/asm-m68k/atomic.h
Next file: linux/include/asm-m68k/bitops.h
Previous file: linux/include/asm-i386/locks.h
Back to the patch index
Back to the overall index
- Lines: 60
- Date:
Mon May 6 12:44:32 1996
- Orig file:
v1.3.98/linux/include/asm-m68k/atomic.h
- Orig date:
Sat Apr 27 15:19:59 1996
diff -u --recursive --new-file v1.3.98/linux/include/asm-m68k/atomic.h linux/include/asm-m68k/atomic.h
@@ -10,54 +10,32 @@
* We do not have SMP m68k systems, so we don't have to deal with that.
*/
-/*
- * Make sure gcc doesn't try to be clever and move things around
- * on us. We need to use _exactly_ the address the user gave us,
- * not some alias that contains the same information.
- */
-#define __atomic_fool_gcc(x) (*(struct { int a[100]; } *)x)
-
typedef int atomic_t;
static __inline__ void atomic_add(atomic_t i, atomic_t *v)
{
- __asm__ __volatile__(
- "addl %1,%0"
- :"=m" (__atomic_fool_gcc(v))
- :"ir" (i), "0" (__atomic_fool_gcc(v)));
+ __asm__ __volatile__("addl %1,%0" : : "m" (*v), "id" (i));
}
static __inline__ void atomic_sub(atomic_t i, atomic_t *v)
{
- __asm__ __volatile__(
- "subl %1,%0"
- :"=m" (__atomic_fool_gcc(v))
- :"ir" (i), "0" (__atomic_fool_gcc(v)));
+ __asm__ __volatile__("subl %1,%0" : : "m" (*v), "id" (i));
}
static __inline__ void atomic_inc(atomic_t *v)
{
- __asm__ __volatile__(
- "addql #1,%0"
- :"=m" (__atomic_fool_gcc(v))
- :"0" (__atomic_fool_gcc(v)));
+ __asm__ __volatile__("addql #1,%0" : : "m" (*v));
}
static __inline__ void atomic_dec(atomic_t *v)
{
- __asm__ __volatile__(
- "subql #1,%0"
- :"=m" (__atomic_fool_gcc(v))
- :"0" (__atomic_fool_gcc(v)));
+ __asm__ __volatile__("subql #1,%0" : : "m" (*v));
}
static __inline__ int atomic_dec_and_test(atomic_t *v)
{
char c;
- __asm__ __volatile__(
- "subql #1,%0; seq %1"
- :"=m" (__atomic_fool_gcc(v)), "=d" (c)
- :"0" (__atomic_fool_gcc(v)));
+ __asm__ __volatile__("subql #1,%1; seq %0" : "=d" (c) : "m" (*v));
return c != 0;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov
with Sam's (original) version of this