1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __ASM_SH_FUTEX_H
3 #define __ASM_SH_FUTEX_H
7 #include <linux/futex.h>
8 #include <linux/uaccess.h>
11 #if !defined(CONFIG_SMP)
12 #include <asm/futex-irq.h>
13 #elif defined(CONFIG_CPU_J2)
14 #include <asm/futex-cas.h>
15 #elif defined(CONFIG_CPU_SH4A)
16 #include <asm/futex-llsc.h>
18 #error SMP not supported on this configuration.
22 futex_atomic_cmpxchg_inatomic(u32
*uval
, u32 __user
*uaddr
,
23 u32 oldval
, u32 newval
)
25 if (!access_ok(VERIFY_WRITE
, uaddr
, sizeof(u32
)))
28 return atomic_futex_op_cmpxchg_inatomic(uval
, uaddr
, oldval
, newval
);
31 static inline int arch_futex_atomic_op_inuser(int op
, u32 oparg
, int *oval
,
34 u32 oldval
, newval
, prev
;
40 if (op
== FUTEX_OP_SET
)
43 ret
= get_user(oldval
, uaddr
);
52 newval
= oldval
+ oparg
;
55 newval
= oldval
| oparg
;
58 newval
= oldval
& ~oparg
;
61 newval
= oldval
^ oparg
;
70 ret
= futex_atomic_cmpxchg_inatomic(&prev
, uaddr
, oldval
, newval
);
71 } while (!ret
&& prev
!= oldval
);
81 #endif /* __KERNEL__ */
82 #endif /* __ASM_SH_FUTEX_H */