Resent-Date: Wed, 11 Nov 1998 19:15:42 +0100 (MET)
From: zippel@fh-brandenburg.de (Roman Zippel)
Subject: Re: MFC3 serial overruns
To: schwab@issan.informatik.uni-dortmund.de (Andreas Schwab)
Date: Wed, 11 Nov 1998 19:16:07 +0100 (MET)
Cc: zippel@fh-brandenburg.de, alan@cymru.net, dorchain@wirbel.com,
        linux-m68k@phil.uni-sb.de
In-Reply-To: <vyzlnliy32q.fsf@issan.cs.uni-dortmund.de> from "Andreas Schwab" at Nov 11, 98 10:46:21 am
Resent-From: linux-m68k@phil.uni-sb.de

Hi,

> I don't understand.  The "m" constraint explicitly forces the operand to
> be in memory.  I can never go in a register.  What are you trying to fix?

Hmm, I could swear I some problems, but while reproducing the problem I
found another real problem, the value should also be marked as an output
operand, so that gcc knows, that the value has changed, otherwise it might
use some some cached value, so I think that should really fixed by this
diff. :)

bye, Roman

--- linux-2.0/include/asm-m68k/atomic.h.org	Wed Aug 26 15:25:30 1998
+++ linux-2.0/include/asm-m68k/atomic.h	Wed Nov 11 16:13:34 1998
@@ -14,28 +14,28 @@
 
 static __inline__ void atomic_add(atomic_t i, atomic_t *v)
 {
-	__asm__ __volatile__("addl %1,%0" : : "m" (*v), "id" (i));
+	__asm__ __volatile__("addl %1,%0" : "=m" (*v) : "id" (i), "0" (*v));
 }
 
 static __inline__ void atomic_sub(atomic_t i, atomic_t *v)
 {
-	__asm__ __volatile__("subl %1,%0" : : "m" (*v), "id" (i));
+	__asm__ __volatile__("subl %1,%0" : "=m" (*v) : "id" (i), "0" (*v));
 }
 
 static __inline__ void atomic_inc(atomic_t *v)
 {
-	__asm__ __volatile__("addql #1,%0" : : "m" (*v));
+	__asm__ __volatile__("addql #1,%0" : "=m" (*v): "0" (*v));
 }
 
 static __inline__ void atomic_dec(atomic_t *v)
 {
-	__asm__ __volatile__("subql #1,%0" : : "m" (*v));
+	__asm__ __volatile__("subql #1,%0" : "=m" (*v): "0" (*v));
 }
 
 static __inline__ int atomic_dec_and_test(atomic_t *v)
 {
 	char c;
-	__asm__ __volatile__("subql #1,%1; seq %0" : "=d" (c) : "m" (*v));
+	__asm__ __volatile__("subql #1,%1; seq %0" : "=d" (c), "=m" (*v): "1" (*v));
 	return c != 0;
 }
 

