patch-2.1.16 linux/include/asm-ppc/atomic.h

Next file: linux/include/asm-ppc/bitops.h
Previous file: linux/include/asm-i386/string.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.15/linux/include/asm-ppc/atomic.h linux/include/asm-ppc/atomic.h
@@ -6,5 +6,17 @@
 #define _ASM_PPC_ATOMIC_H_
 
 typedef int atomic_t;
+/*
+ * 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)
+
+#define atomic_dec_return(v) ({atomic_sub(1,(v));(v);})
+#define atomic_inc_return(v) ({atomic_add(1,(v));(v);})
+
+#define atomic_inc(v) atomic_add(1,(v))
+#define atomic_dec(v) atomic_sub(1,(v))
 #endif
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov