1 /* SPDX-License-Identifier: GPL-2.0 */
3 * User space memory access functions
5 * Copyright (C) 1999, 2002 Niibe Yutaka
6 * Copyright (C) 2003 - 2008 Paul Mundt
9 * MIPS implementation version 1.15 by
10 * Copyright (C) 1996, 1997, 1998 by Ralf Baechle
13 #ifndef __ASM_SH_UACCESS_32_H
14 #define __ASM_SH_UACCESS_32_H
16 #define __get_user_size(x,ptr,size,retval) \
21 __get_user_asm(x, ptr, retval, "b"); \
24 __get_user_asm(x, ptr, retval, "w"); \
27 __get_user_asm(x, ptr, retval, "l"); \
30 __get_user_unknown(); \
36 #define __get_user_asm(x, addr, err, insn) \
38 __asm__ __volatile__( \
40 "mov." insn " %2, %1\n\t" \
42 ".section .fixup,\"ax\"\n" \
51 ".section __ex_table,\"a\"\n\t" \
54 :"=&r" (err), "=&r" (x) \
55 :"m" (__m(addr)), "i" (-EFAULT), "0" (err)); })
57 #define __get_user_asm(x, addr, err, insn) \
59 __asm__ __volatile__ ( \
60 "mov." insn " %1, %0\n\t" \
65 #endif /* CONFIG_MMU */
67 extern void __get_user_unknown(void);
69 #define __put_user_size(x,ptr,size,retval) \
74 __put_user_asm(x, ptr, retval, "b"); \
77 __put_user_asm(x, ptr, retval, "w"); \
80 __put_user_asm(x, ptr, retval, "l"); \
83 __put_user_u64(x, ptr, retval); \
86 __put_user_unknown(); \
91 #define __put_user_asm(x, addr, err, insn) \
93 __asm__ __volatile__ ( \
95 "mov." insn " %1, %2\n\t" \
97 ".section .fixup,\"ax\"\n" \
105 ".section __ex_table,\"a\"\n\t" \
109 : "r" (x), "m" (__m(addr)), "i" (-EFAULT), \
115 #define __put_user_asm(x, addr, err, insn) \
117 __asm__ __volatile__ ( \
118 "mov." insn " %0, %1\n\t" \
120 : "r" (x), "m" (__m(addr)) \
124 #endif /* CONFIG_MMU */
126 #if defined(CONFIG_CPU_LITTLE_ENDIAN)
127 #define __put_user_u64(val,addr,retval) \
129 __asm__ __volatile__( \
132 "mov.l %S1,%T2\n\t" \
134 ".section .fixup,\"ax\"\n" \
142 ".section __ex_table,\"a\"\n\t" \
146 : "r" (val), "m" (__m(addr)), "i" (-EFAULT), "0" (retval) \
149 #define __put_user_u64(val,addr,retval) \
151 __asm__ __volatile__( \
154 "mov.l %R1,%T2\n\t" \
156 ".section .fixup,\"ax\"\n" \
164 ".section __ex_table,\"a\"\n\t" \
168 : "r" (val), "m" (__m(addr)), "i" (-EFAULT), "0" (retval) \
172 extern void __put_user_unknown(void);
174 #endif /* __ASM_SH_UACCESS_32_H */