staging: rtl8192u: remove redundant assignment to pointer crypt
[linux/fpc-iii.git] / arch / s390 / include / asm / futex.h
blob5e97a43531470d13b63b7e4379a95d741363ebb7
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>
8 #include <asm/errno.h>
10 #define __futex_atomic_op(insn, ret, oldval, newval, uaddr, oparg) \
11 asm volatile( \
12 " sacf 256\n" \
13 "0: l %1,0(%6)\n" \
14 "1:"insn \
15 "2: cs %1,%2,0(%6)\n" \
16 "3: jl 1b\n" \
17 " lhi %0,0\n" \
18 "4: sacf 768\n" \
19 EX_TABLE(0b,4b) EX_TABLE(2b,4b) EX_TABLE(3b,4b) \
20 : "=d" (ret), "=&d" (oldval), "=&d" (newval), \
21 "=m" (*uaddr) \
22 : "0" (-EFAULT), "d" (oparg), "a" (uaddr), \
23 "m" (*uaddr) : "cc");
25 static inline int arch_futex_atomic_op_inuser(int op, int oparg, int *oval,
26 u32 __user *uaddr)
28 int oldval = 0, newval, ret;
29 mm_segment_t old_fs;
31 old_fs = enable_sacf_uaccess();
32 pagefault_disable();
33 switch (op) {
34 case FUTEX_OP_SET:
35 __futex_atomic_op("lr %2,%5\n",
36 ret, oldval, newval, uaddr, oparg);
37 break;
38 case FUTEX_OP_ADD:
39 __futex_atomic_op("lr %2,%1\nar %2,%5\n",
40 ret, oldval, newval, uaddr, oparg);
41 break;
42 case FUTEX_OP_OR:
43 __futex_atomic_op("lr %2,%1\nor %2,%5\n",
44 ret, oldval, newval, uaddr, oparg);
45 break;
46 case FUTEX_OP_ANDN:
47 __futex_atomic_op("lr %2,%1\nnr %2,%5\n",
48 ret, oldval, newval, uaddr, oparg);
49 break;
50 case FUTEX_OP_XOR:
51 __futex_atomic_op("lr %2,%1\nxr %2,%5\n",
52 ret, oldval, newval, uaddr, oparg);
53 break;
54 default:
55 ret = -ENOSYS;
57 pagefault_enable();
58 disable_sacf_uaccess(old_fs);
60 if (!ret)
61 *oval = oldval;
63 return ret;
66 static inline int futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
67 u32 oldval, u32 newval)
69 mm_segment_t old_fs;
70 int ret;
72 old_fs = enable_sacf_uaccess();
73 asm volatile(
74 " sacf 256\n"
75 "0: cs %1,%4,0(%5)\n"
76 "1: la %0,0\n"
77 "2: sacf 768\n"
78 EX_TABLE(0b,2b) EX_TABLE(1b,2b)
79 : "=d" (ret), "+d" (oldval), "=m" (*uaddr)
80 : "0" (-EFAULT), "d" (newval), "a" (uaddr), "m" (*uaddr)
81 : "cc", "memory");
82 disable_sacf_uaccess(old_fs);
83 *uval = oldval;
84 return ret;
87 #endif /* _ASM_S390_FUTEX_H */