2 * User space memory access functions
4 * Copyright (C) 1999, 2002 Niibe Yutaka
5 * Copyright (C) 2003 - 2008 Paul Mundt
8 * MIPS implementation version 1.15 by
9 * Copyright (C) 1996, 1997, 1998 by Ralf Baechle
12 #ifndef __ASM_SH_UACCESS_32_H
13 #define __ASM_SH_UACCESS_32_H
15 #define __get_user_size(x,ptr,size,retval) \
20 __get_user_asm(x, ptr, retval, "b"); \
23 __get_user_asm(x, ptr, retval, "w"); \
26 __get_user_asm(x, ptr, retval, "l"); \
29 __get_user_unknown(); \
35 #define __get_user_asm(x, addr, err, insn) \
37 __asm__ __volatile__( \
39 "mov." insn " %2, %1\n\t" \
41 ".section .fixup,\"ax\"\n" \
50 ".section __ex_table,\"a\"\n\t" \
53 :"=&r" (err), "=&r" (x) \
54 :"m" (__m(addr)), "i" (-EFAULT), "0" (err)); })
56 #define __get_user_asm(x, addr, err, insn) \
58 __asm__ __volatile__ ( \
59 "mov." insn " %1, %0\n\t" \
64 #endif /* CONFIG_MMU */
66 extern void __get_user_unknown(void);
68 #define __put_user_size(x,ptr,size,retval) \
73 __put_user_asm(x, ptr, retval, "b"); \
76 __put_user_asm(x, ptr, retval, "w"); \
79 __put_user_asm(x, ptr, retval, "l"); \
82 __put_user_u64(x, ptr, retval); \
85 __put_user_unknown(); \
90 #define __put_user_asm(x, addr, err, insn) \
92 __asm__ __volatile__ ( \
94 "mov." insn " %1, %2\n\t" \
96 ".section .fixup,\"ax\"\n" \
104 ".section __ex_table,\"a\"\n\t" \
108 : "r" (x), "m" (__m(addr)), "i" (-EFAULT), \
114 #define __put_user_asm(x, addr, err, insn) \
116 __asm__ __volatile__ ( \
117 "mov." insn " %0, %1\n\t" \
119 : "r" (x), "m" (__m(addr)) \
123 #endif /* CONFIG_MMU */
125 #if defined(CONFIG_CPU_LITTLE_ENDIAN)
126 #define __put_user_u64(val,addr,retval) \
128 __asm__ __volatile__( \
131 "mov.l %S1,%T2\n\t" \
133 ".section .fixup,\"ax\"\n" \
141 ".section __ex_table,\"a\"\n\t" \
145 : "r" (val), "m" (__m(addr)), "i" (-EFAULT), "0" (retval) \
148 #define __put_user_u64(val,addr,retval) \
150 __asm__ __volatile__( \
153 "mov.l %R1,%T2\n\t" \
155 ".section .fixup,\"ax\"\n" \
163 ".section __ex_table,\"a\"\n\t" \
167 : "r" (val), "m" (__m(addr)), "i" (-EFAULT), "0" (retval) \
171 extern void __put_user_unknown(void);
173 #endif /* __ASM_SH_UACCESS_32_H */