9 #ifndef __S390_UACCESS_H
10 #define __S390_UACCESS_H
15 #include <linux/sched.h>
16 #include <linux/errno.h>
20 #define VERIFY_WRITE 1
31 #define MAKE_MM_SEG(a) ((mm_segment_t) { (a) })
34 #define KERNEL_DS MAKE_MM_SEG(0)
35 #define USER_DS MAKE_MM_SEG(1)
37 #define get_ds() (KERNEL_DS)
38 #define get_fs() (current->thread.mm_segment)
42 unsigned long __pto; \
43 current->thread.mm_segment = (x); \
44 __pto = current->thread.mm_segment.ar4 ? \
45 S390_lowcore.user_asce : S390_lowcore.kernel_asce; \
46 __ctl_load(__pto, 7, 7); \
49 #define segment_eq(a,b) ((a).ar4 == (b).ar4)
56 #define __access_ok(addr, size) \
58 __chk_user_ptr(addr); \
59 __range_ok((unsigned long)(addr), (size)); \
62 #define access_ok(type, addr, size) __access_ok(addr, size)
84 return (
unsigned long)&x->
insn + x->
insn;
92 #define ARCH_HAS_SORT_EXTABLE
93 #define ARCH_HAS_SEARCH_EXTABLE
116 static inline int __put_user_fn(
size_t size,
void __user *
ptr,
void *x)
118 size =
uaccess.copy_to_user_small(size, ptr, x);
122 static inline int __get_user_fn(
size_t size,
const void __user *ptr,
void *x)
124 size =
uaccess.copy_from_user_small(size, ptr, x);
132 #define __put_user(x, ptr) \
134 __typeof__(*(ptr)) __x = (x); \
135 int __pu_err = -EFAULT; \
136 __chk_user_ptr(ptr); \
137 switch (sizeof (*(ptr))) { \
142 __pu_err = __put_user_fn(sizeof (*(ptr)), \
152 #define put_user(x, ptr) \
155 __put_user(x, ptr); \
161 #define __get_user(x, ptr) \
163 int __gu_err = -EFAULT; \
164 __chk_user_ptr(ptr); \
165 switch (sizeof(*(ptr))) { \
168 __gu_err = __get_user_fn(sizeof (*(ptr)), \
170 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
174 unsigned short __x; \
175 __gu_err = __get_user_fn(sizeof (*(ptr)), \
177 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
182 __gu_err = __get_user_fn(sizeof (*(ptr)), \
184 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
188 unsigned long long __x; \
189 __gu_err = __get_user_fn(sizeof (*(ptr)), \
191 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
201 #define get_user(x, ptr) \
204 __get_user(x, ptr); \
209 #define __put_user_unaligned __put_user
210 #define __get_user_unaligned __get_user
229 if (__builtin_constant_p(n) && (n <= 256))
230 return uaccess.copy_to_user_small(n, to, from);
232 return uaccess.copy_to_user(n, to, from);
235 #define __copy_to_user_inatomic __copy_to_user
236 #define __copy_from_user_inatomic __copy_from_user
280 if (__builtin_constant_p(n) && (n <= 256))
281 return uaccess.copy_from_user_small(n, from, to);
283 return uaccess.copy_from_user(n, from, to);
287 #ifdef CONFIG_DEBUG_STRICT_USER_COPY_CHECKS
309 copy_from_user(
void *to,
const void __user *from,
unsigned long n)
326 __copy_in_user(
void __user *to,
const void __user *from,
unsigned long n)
328 return uaccess.copy_in_user(n, to, from);
332 copy_in_user(
void __user *to,
const void __user *from,
unsigned long n)
349 res =
uaccess.strncpy_from_user(count, src, dst);
353 static inline unsigned long
357 return uaccess.strnlen_user(n, src);
374 #define strlen_user(str) strnlen_user(str, ~0UL)
383 return uaccess.clear_user(n, to);