1 #ifndef _ASM_GENERIC_FUTEX_H
2 #define _ASM_GENERIC_FUTEX_H
4 #include <linux/futex.h>
5 #include <linux/uaccess.h>
10 * The following implementation only for uniprocessor machines.
11 * It relies on preempt_disable() ensuring mutual exclusion.
16 * arch_futex_atomic_op_inuser() - Atomic arithmetic operation with constant
17 * argument and comparison of the previous
18 * futex value with another constant.
20 * @encoded_op: encoded operation to execute
21 * @uaddr: pointer to user space address
28 arch_futex_atomic_op_inuser(int op
, u32 oparg
, int *oval
, u32 __user
*uaddr
)
37 if (unlikely(get_user(oldval
, uaddr
) != 0))
38 goto out_pagefault_enable
;
63 if (ret
== 0 && unlikely(put_user(tmp
, uaddr
) != 0))
77 * futex_atomic_cmpxchg_inatomic() - Compare and exchange the content of the
78 * uaddr with newval if the current value is
80 * @uval: pointer to store content of @uaddr
81 * @uaddr: pointer to user space address
83 * @newval: new value to store to @uaddr
90 futex_atomic_cmpxchg_inatomic(u32
*uval
, u32 __user
*uaddr
,
91 u32 oldval
, u32 newval
)
96 if (unlikely(get_user(val
, uaddr
) != 0)) {
101 if (val
== oldval
&& unlikely(put_user(newval
, uaddr
) != 0)) {
114 arch_futex_atomic_op_inuser(int op
, u32 oparg
, int *oval
, u32 __user
*uaddr
)
139 futex_atomic_cmpxchg_inatomic(u32
*uval
, u32 __user
*uaddr
,
140 u32 oldval
, u32 newval
)
145 #endif /* CONFIG_SMP */