diff options
author | David S. Miller <davem@davemloft.net> | 2006-11-01 19:30:39 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-11-01 19:30:39 -0500 |
commit | c7fed9d75074f7c243ec8ff2c55d04de2839a6f6 (patch) | |
tree | b3392f8dc1db4707e19e260e8b2b71f5c2145eae /include/asm-sparc64/futex.h | |
parent | 3ccfc65c5004e5fe5cfbffe43b8acc686680b53e (diff) |
[SPARC64]: Fix futex_atomic_cmpxchg_inatomic implementation.
I copied the logic from ll/sc arch implementations, but that
was wrong and makes no sense at all. Just do a straight
compare-exchange instruction, just like x86.
Based upon bug reports from Dennis Gilmore and Fabio Massimo.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/asm-sparc64/futex.h')
-rw-r--r-- | include/asm-sparc64/futex.h | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/include/asm-sparc64/futex.h b/include/asm-sparc64/futex.h index dee40206b22..7392fc4a954 100644 --- a/include/asm-sparc64/futex.h +++ b/include/asm-sparc64/futex.h | |||
@@ -87,24 +87,22 @@ static inline int | |||
87 | futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval) | 87 | futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval) |
88 | { | 88 | { |
89 | __asm__ __volatile__( | 89 | __asm__ __volatile__( |
90 | "\n1: lduwa [%2] %%asi, %0\n" | 90 | "\n1: casa [%3] %%asi, %2, %0\n" |
91 | "2: casa [%2] %%asi, %0, %1\n" | 91 | "2:\n" |
92 | "3:\n" | ||
93 | " .section .fixup,#alloc,#execinstr\n" | 92 | " .section .fixup,#alloc,#execinstr\n" |
94 | " .align 4\n" | 93 | " .align 4\n" |
95 | "4: ba 3b\n" | 94 | "3: ba 2b\n" |
96 | " mov %3, %0\n" | 95 | " mov %4, %0\n" |
97 | " .previous\n" | 96 | " .previous\n" |
98 | " .section __ex_table,\"a\"\n" | 97 | " .section __ex_table,\"a\"\n" |
99 | " .align 4\n" | 98 | " .align 4\n" |
100 | " .word 1b, 4b\n" | 99 | " .word 1b, 3b\n" |
101 | " .word 2b, 4b\n" | ||
102 | " .previous\n" | 100 | " .previous\n" |
103 | : "=&r" (oldval) | 101 | : "=r" (newval) |
104 | : "r" (newval), "r" (uaddr), "i" (-EFAULT) | 102 | : "0" (newval), "r" (oldval), "r" (uaddr), "i" (-EFAULT) |
105 | : "memory"); | 103 | : "memory"); |
106 | 104 | ||
107 | return oldval; | 105 | return newval; |
108 | } | 106 | } |
109 | 107 | ||
110 | #endif /* !(_SPARC64_FUTEX_H) */ | 108 | #endif /* !(_SPARC64_FUTEX_H) */ |