futex.h (6b57ba8ed48a3ee3d6b53294ccbf02b8cb83c604) futex.h (6bd33e1ece528f67646db33bf97406b747dafda0)
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright (c) 2006 Ralf Baechle (ralf@linux-mips.org)
4 * Copyright (c) 2018 Jim Wilson (jimw@sifive.com)
5 */
6
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright (c) 2006 Ralf Baechle (ralf@linux-mips.org)
4 * Copyright (c) 2018 Jim Wilson (jimw@sifive.com)
5 */
6
7#ifndef _ASM_RISCV_FUTEX_H
8#define _ASM_RISCV_FUTEX_H
7#ifndef _ASM_FUTEX_H
8#define _ASM_FUTEX_H
9
10#include <linux/futex.h>
11#include <linux/uaccess.h>
12#include <linux/errno.h>
13#include <asm/asm.h>
14
9
10#include <linux/futex.h>
11#include <linux/uaccess.h>
12#include <linux/errno.h>
13#include <asm/asm.h>
14
15/* We don't even really need the extable code, but for now keep it simple */
16#ifndef CONFIG_MMU
17#define __enable_user_access() do { } while (0)
18#define __disable_user_access() do { } while (0)
19#endif
20
15#define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \
16{ \
17 uintptr_t tmp; \
18 __enable_user_access(); \
19 __asm__ __volatile__ ( \
20 "1: " insn " \n" \
21 "2: \n" \
22 " .section .fixup,\"ax\" \n" \

--- 84 unchanged lines hidden (view full) ---

107 : [ov] "Jr" (oldval), [nv] "Jr" (newval), [e] "i" (-EFAULT)
108 : "memory");
109 __disable_user_access();
110
111 *uval = val;
112 return ret;
113}
114
21#define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \
22{ \
23 uintptr_t tmp; \
24 __enable_user_access(); \
25 __asm__ __volatile__ ( \
26 "1: " insn " \n" \
27 "2: \n" \
28 " .section .fixup,\"ax\" \n" \

--- 84 unchanged lines hidden (view full) ---

113 : [ov] "Jr" (oldval), [nv] "Jr" (newval), [e] "i" (-EFAULT)
114 : "memory");
115 __disable_user_access();
116
117 *uval = val;
118 return ret;
119}
120
115#endif /* _ASM_RISCV_FUTEX_H */
121#endif /* _ASM_FUTEX_H */