[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1225297937-2917-2-git-send-email-albcamus@gmail.com>
Date: Thu, 30 Oct 2008 00:32:17 +0800
From: Jike Song <albcamus@...il.com>
To: tglx@...utronix.de, mingo@...hat.com, hpa@...or.com
Cc: linux-kernel@...r.kernel.org, Jike Song <albcamus@...il.com>
Subject: [PATCH] x86: fix inline assembly constraints
In atomic_set_mask, *addr should be both read and written.
Signed-off-by: Jike Song <albcamus@...il.com>
---
arch/x86/include/asm/atomic_32.h | 8 ++++----
arch/x86/include/asm/atomic_64.h | 7 ++++---
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/arch/x86/include/asm/atomic_32.h b/arch/x86/include/asm/atomic_32.h
index ad5b9f6..23a7c7f 100644
--- a/arch/x86/include/asm/atomic_32.h
+++ b/arch/x86/include/asm/atomic_32.h
@@ -242,12 +242,12 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
/* These are x86-specific, used by some header files */
#define atomic_clear_mask(mask, addr) \
- asm volatile(LOCK_PREFIX "andl %0,%1" \
- : : "r" (~(mask)), "m" (*(addr)) : "memory")
+ asm volatile(LOCK_PREFIX "andl %1, %0" \
+ : "+m" (*(addr)) : "r" (~(mask)) : "memory")
#define atomic_set_mask(mask, addr) \
- asm volatile(LOCK_PREFIX "orl %0,%1" \
- : : "r" (mask), "m" (*(addr)) : "memory")
+ asm volatile(LOCK_PREFIX "orl %1, %0" \
+ : "+m" (*(addr)) : "r" (mask) : "memory")
/* Atomic operations are already serializing on x86 */
#define smp_mb__before_atomic_dec() barrier()
diff --git a/arch/x86/include/asm/atomic_64.h b/arch/x86/include/asm/atomic_64.h
index fa59212..31b34f3 100644
--- a/arch/x86/include/asm/atomic_64.h
+++ b/arch/x86/include/asm/atomic_64.h
@@ -451,12 +451,13 @@ static inline void atomic_or_long(unsigned long *v1, unsigned long v2)
/* These are x86-specific, used by some header files */
#define atomic_clear_mask(mask, addr) \
- asm volatile(LOCK_PREFIX "andl %0,%1" \
- : : "r" (~(mask)), "m" (*(addr)) : "memory")
+ asm volatile(LOCK_PREFIX "andl %1, %0" \
+ : "+m" (*(addr)) : "r" (~(mask)) : "memory")
#define atomic_set_mask(mask, addr) \
- asm volatile(LOCK_PREFIX "orl %0,%1" \
+ asm volatile(LOCK_PREFIX "orl %1, %0" \
: : "r" ((unsigned)(mask)), "m" (*(addr)) \
+ : "+m" (*(addr)) : "r" ((unsigned)(mask)) \
: "memory")
/* Atomic operations are already serializing on x86 */
--
1.6.0.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists