patch-1.3.96 linux/include/asm-m68k/atomic.h

Next file: linux/include/asm-m68k/bitops.h
Previous file: linux/include/asm-m68k/atariints.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.95/linux/include/asm-m68k/atomic.h linux/include/asm-m68k/atomic.h
@@ -24,7 +24,7 @@
 	__asm__ __volatile__(
 		"addl %1,%0"
 		:"=m" (__atomic_fool_gcc(v))
-		:"ir" (i), "m" (__atomic_fool_gcc(v)));
+		:"ir" (i), "0" (__atomic_fool_gcc(v)));
 }
 
 static __inline__ void atomic_sub(atomic_t i, atomic_t *v)
@@ -32,7 +32,7 @@
 	__asm__ __volatile__(
 		"subl  %1,%0"
 		:"=m" (__atomic_fool_gcc(v))
-		:"ir" (i), "m" (__atomic_fool_gcc(v)));
+		:"ir" (i), "0" (__atomic_fool_gcc(v)));
 }
 
 static __inline__ void atomic_inc(atomic_t *v)
@@ -40,7 +40,7 @@
 	__asm__ __volatile__(
 		"addql #1,%0"
 		:"=m" (__atomic_fool_gcc(v))
-		:"m" (__atomic_fool_gcc(v)));
+		:"0" (__atomic_fool_gcc(v)));
 }
 
 static __inline__ void atomic_dec(atomic_t *v)
@@ -48,16 +48,17 @@
 	__asm__ __volatile__(
 		"subql #1,%0"
 		:"=m" (__atomic_fool_gcc(v))
-		:"m" (__atomic_fool_gcc(v)));
+		:"0" (__atomic_fool_gcc(v)));
 }
 
 static __inline__ int atomic_dec_and_test(atomic_t *v)
 {
+	char c;
 	__asm__ __volatile__(
-		"subql #1,%0"
-		:"=m" (__atomic_fool_gcc(v))
-		:"m" (__atomic_fool_gcc(v)));
-	return (*v <= 0);
+		"subql #1,%0; seq %1"
+		:"=m" (__atomic_fool_gcc(v)), "=d" (c)
+		:"0" (__atomic_fool_gcc(v)));
+	return c != 0;
 }
 
 #endif /* __ARCH_M68K_ATOMIC __ */

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