microblaze: uaccess: copy_to_user unification
noMMU and MMU kernel will use copy copy_tofrom_user asm implementation. Signed-off-by: Michal Simek <monstr@monstr.eu>
This commit is contained in:
parent
0dcb409de7
commit
cc5a428b7a
|
@ -372,19 +372,28 @@ extern long __user_bad(void);
|
||||||
? __put_user((x), (ptr)) : -EFAULT; \
|
? __put_user((x), (ptr)) : -EFAULT; \
|
||||||
})
|
})
|
||||||
|
|
||||||
|
extern unsigned long __copy_tofrom_user(void __user *to,
|
||||||
|
const void __user *from, unsigned long size);
|
||||||
|
|
||||||
#define __copy_from_user(to, from, n) copy_from_user((to), (from), (n))
|
#define __copy_from_user(to, from, n) copy_from_user((to), (from), (n))
|
||||||
#define __copy_from_user_inatomic(to, from, n) \
|
#define __copy_from_user_inatomic(to, from, n) \
|
||||||
copy_from_user((to), (from), (n))
|
copy_from_user((to), (from), (n))
|
||||||
|
|
||||||
#define copy_to_user(to, from, n) \
|
#define __copy_to_user(to, from, n) \
|
||||||
(access_ok(VERIFY_WRITE, (to), (n)) ? \
|
__copy_tofrom_user((void __user *)(to), \
|
||||||
__copy_tofrom_user((void __user *)(to), \
|
(__force const void __user *)(from), (n))
|
||||||
(__force const void __user *)(from), (n)) \
|
|
||||||
: -EFAULT)
|
|
||||||
|
|
||||||
#define __copy_to_user(to, from, n) copy_to_user((to), (from), (n))
|
|
||||||
#define __copy_to_user_inatomic(to, from, n) copy_to_user((to), (from), (n))
|
#define __copy_to_user_inatomic(to, from, n) copy_to_user((to), (from), (n))
|
||||||
|
|
||||||
|
static inline long copy_to_user(void __user *to,
|
||||||
|
const void *from, unsigned long n)
|
||||||
|
{
|
||||||
|
might_sleep();
|
||||||
|
if (access_ok(VERIFY_WRITE, to, n))
|
||||||
|
return __copy_to_user(to, from, n);
|
||||||
|
else
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
#define copy_from_user(to, from, n) \
|
#define copy_from_user(to, from, n) \
|
||||||
(access_ok(VERIFY_READ, (from), (n)) ? \
|
(access_ok(VERIFY_READ, (from), (n)) ? \
|
||||||
__copy_tofrom_user((__force void __user *)(to), \
|
__copy_tofrom_user((__force void __user *)(to), \
|
||||||
|
@ -402,8 +411,6 @@ extern int __strnlen_user(const char __user *sstr, int len);
|
||||||
|
|
||||||
#endif /* CONFIG_MMU */
|
#endif /* CONFIG_MMU */
|
||||||
|
|
||||||
extern unsigned long __copy_tofrom_user(void __user *to,
|
|
||||||
const void __user *from, unsigned long size);
|
|
||||||
|
|
||||||
#endif /* __ASSEMBLY__ */
|
#endif /* __ASSEMBLY__ */
|
||||||
#endif /* __KERNEL__ */
|
#endif /* __KERNEL__ */
|
||||||
|
|
Loading…
Reference in New Issue