aboutsummaryrefslogtreecommitdiff
path: root/include/asm-sparc64/futex.h
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2006-03-28 01:00:08 -0800
committerDavid S. Miller <davem@sunset.davemloft.net>2006-03-28 01:00:08 -0800
commit6e57a3a89785692bd8d012d80f5ee210ab8e0b68 (patch)
treed55008a8c891193b1858487e1177a44f6add06fd /include/asm-sparc64/futex.h
parent329b10bb0feacb7fb9a41389313ff0a51ae56f2a (diff)
[SPARC64]: Implement futex_atomic_cmpxchg_inatomic().
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/asm-sparc64/futex.h')
-rw-r--r--include/asm-sparc64/futex.h22
1 files changed, 20 insertions, 2 deletions
diff --git a/include/asm-sparc64/futex.h b/include/asm-sparc64/futex.h
index cd340a23315..dee40206b22 100644
--- a/include/asm-sparc64/futex.h
+++ b/include/asm-sparc64/futex.h
@@ -84,9 +84,27 @@ static inline int futex_atomic_op_inuser(int encoded_op, int __user *uaddr)
}
static inline int
-futex_atomic_cmpxchg_inuser(int __user *uaddr, int oldval, int newval)
+futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
{
- return -ENOSYS;
+ __asm__ __volatile__(
+ "\n1: lduwa [%2] %%asi, %0\n"
+ "2: casa [%2] %%asi, %0, %1\n"
+ "3:\n"
+ " .section .fixup,#alloc,#execinstr\n"
+ " .align 4\n"
+ "4: ba 3b\n"
+ " mov %3, %0\n"
+ " .previous\n"
+ " .section __ex_table,\"a\"\n"
+ " .align 4\n"
+ " .word 1b, 4b\n"
+ " .word 2b, 4b\n"
+ " .previous\n"
+ : "=&r" (oldval)
+ : "r" (newval), "r" (uaddr), "i" (-EFAULT)
+ : "memory");
+
+ return oldval;
}
#endif /* !(_SPARC64_FUTEX_H) */