1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_S390_FUTEX_H
3 #define _ASM_S390_FUTEX_H
5 #include <linux/uaccess.h>
6 #include <linux/futex.h>
7 #include <asm/mmu_context.h>
10 #define __futex_atomic_op(insn, ret, oldval, newval, uaddr, oparg) \
15 "2: cs %1,%2,0(%6)\n" \
19 EX_TABLE(0b,4b) EX_TABLE(2b,4b) EX_TABLE(3b,4b) \
20 : "=d" (ret), "=&d" (oldval), "=&d" (newval), \
22 : "0" (-EFAULT), "d" (oparg), "a" (uaddr), \
25 static inline int arch_futex_atomic_op_inuser(int op
, int oparg
, int *oval
,
28 int oldval
= 0, newval
, ret
;
32 __futex_atomic_op("lr %2,%5\n",
33 ret
, oldval
, newval
, uaddr
, oparg
);
36 __futex_atomic_op("lr %2,%1\nar %2,%5\n",
37 ret
, oldval
, newval
, uaddr
, oparg
);
40 __futex_atomic_op("lr %2,%1\nor %2,%5\n",
41 ret
, oldval
, newval
, uaddr
, oparg
);
44 __futex_atomic_op("lr %2,%1\nnr %2,%5\n",
45 ret
, oldval
, newval
, uaddr
, oparg
);
48 __futex_atomic_op("lr %2,%1\nxr %2,%5\n",
49 ret
, oldval
, newval
, uaddr
, oparg
);
61 static inline int futex_atomic_cmpxchg_inatomic(u32
*uval
, u32 __user
*uaddr
,
62 u32 oldval
, u32 newval
)
71 EX_TABLE(0b
,2b
) EX_TABLE(1b
,2b
)
72 : "=d" (ret
), "+d" (oldval
), "=m" (*uaddr
)
73 : "0" (-EFAULT
), "d" (newval
), "a" (uaddr
), "m" (*uaddr
)
79 #endif /* _ASM_S390_FUTEX_H */