ChangeSet 1.1539.3.2, 2005/02/06 20:47:34-08:00, [EMAIL PROTECTED]

        [SPARC64]: Add missing membars for xchg() and cmpxchg().
        
        Signed-off-by: David S. Miller <[EMAIL PROTECTED]>



 system.h |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)


diff -Nru a/include/asm-sparc64/system.h b/include/asm-sparc64/system.h
--- a/include/asm-sparc64/system.h      2005-02-09 09:07:12 -08:00
+++ b/include/asm-sparc64/system.h      2005-02-09 09:07:12 -08:00
@@ -246,6 +246,7 @@
 extern __inline__ unsigned long xchg32(__volatile__ unsigned int *m, unsigned 
int val)
 {
        __asm__ __volatile__(
+"      membar          #StoreLoad | #LoadLoad\n"
 "      mov             %0, %%g5\n"
 "1:    lduw            [%2], %%g7\n"
 "      cas             [%2], %%g7, %0\n"
@@ -262,6 +263,7 @@
 extern __inline__ unsigned long xchg64(__volatile__ unsigned long *m, unsigned 
long val)
 {
        __asm__ __volatile__(
+"      membar          #StoreLoad | #LoadLoad\n"
 "      mov             %0, %%g5\n"
 "1:    ldx             [%2], %%g7\n"
 "      casx            [%2], %%g7, %0\n"
@@ -306,7 +308,8 @@
 extern __inline__ unsigned long
 __cmpxchg_u32(volatile int *m, int old, int new)
 {
-       __asm__ __volatile__("cas [%2], %3, %0\n\t"
+       __asm__ __volatile__("membar #StoreLoad | #LoadLoad\n"
+                            "cas [%2], %3, %0\n\t"
                             "membar #StoreLoad | #StoreStore"
                             : "=&r" (new)
                             : "0" (new), "r" (m), "r" (old)
@@ -318,7 +321,8 @@
 extern __inline__ unsigned long
 __cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new)
 {
-       __asm__ __volatile__("casx [%2], %3, %0\n\t"
+       __asm__ __volatile__("membar #StoreLoad | #LoadLoad\n"
+                            "casx [%2], %3, %0\n\t"
                             "membar #StoreLoad | #StoreStore"
                             : "=&r" (new)
                             : "0" (new), "r" (m), "r" (old)
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-24" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to