aboutsummaryrefslogtreecommitdiffstats
path: root/arch/microblaze/include
diff options
context:
space:
mode:
authorMichal Simek <monstr@monstr.eu>2010-03-22 10:52:53 -0400
committerMichal Simek <monstr@monstr.eu>2010-04-01 02:38:20 -0400
commitcc5a428b7ae9c2d6233b5bf6b3e6fbb24ddd1ed5 (patch)
tree42c745eae2cd81ea467cdca3ae05bc197838b73f /arch/microblaze/include
parent0dcb409de73edeb221aed38d9ff8640cf41ff0de (diff)
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>
Diffstat (limited to 'arch/microblaze/include')
-rw-r--r--arch/microblaze/include/asm/uaccess.h25
1 files changed, 16 insertions, 9 deletions
diff --git a/arch/microblaze/include/asm/uaccess.h b/arch/microblaze/include/asm/uaccess.h
index 6bb9b8fb6655..125e4cf4105c 100644
--- a/arch/microblaze/include/asm/uaccess.h
+++ b/arch/microblaze/include/asm/uaccess.h
@@ -372,19 +372,28 @@ extern long __user_bad(void);
372 ? __put_user((x), (ptr)) : -EFAULT; \ 372 ? __put_user((x), (ptr)) : -EFAULT; \
373}) 373})
374 374
375extern unsigned long __copy_tofrom_user(void __user *to,
376 const void __user *from, unsigned long size);
377
375#define __copy_from_user(to, from, n) copy_from_user((to), (from), (n)) 378#define __copy_from_user(to, from, n) copy_from_user((to), (from), (n))
376#define __copy_from_user_inatomic(to, from, n) \ 379#define __copy_from_user_inatomic(to, from, n) \
377 copy_from_user((to), (from), (n)) 380 copy_from_user((to), (from), (n))
378 381
379#define copy_to_user(to, from, n) \ 382#define __copy_to_user(to, from, n) \
380 (access_ok(VERIFY_WRITE, (to), (n)) ? \ 383 __copy_tofrom_user((void __user *)(to), \
381 __copy_tofrom_user((void __user *)(to), \ 384 (__force const void __user *)(from), (n))
382 (__force const void __user *)(from), (n)) \
383 : -EFAULT)
384
385#define __copy_to_user(to, from, n) copy_to_user((to), (from), (n))
386#define __copy_to_user_inatomic(to, from, n) copy_to_user((to), (from), (n)) 385#define __copy_to_user_inatomic(to, from, n) copy_to_user((to), (from), (n))
387 386
387static inline long copy_to_user(void __user *to,
388 const void *from, unsigned long n)
389{
390 might_sleep();
391 if (access_ok(VERIFY_WRITE, to, n))
392 return __copy_to_user(to, from, n);
393 else
394 return n;
395}
396
388#define copy_from_user(to, from, n) \ 397#define copy_from_user(to, from, n) \
389 (access_ok(VERIFY_READ, (from), (n)) ? \ 398 (access_ok(VERIFY_READ, (from), (n)) ? \
390 __copy_tofrom_user((__force void __user *)(to), \ 399 __copy_tofrom_user((__force void __user *)(to), \
@@ -402,8 +411,6 @@ extern int __strnlen_user(const char __user *sstr, int len);
402 411
403#endif /* CONFIG_MMU */ 412#endif /* CONFIG_MMU */
404 413
405extern unsigned long __copy_tofrom_user(void __user *to,
406 const void __user *from, unsigned long size);
407 414
408#endif /* __ASSEMBLY__ */ 415#endif /* __ASSEMBLY__ */
409#endif /* __KERNEL__ */ 416#endif /* __KERNEL__ */