[ARM] allow for alternative __copy_to_user/__clear_user implementations
authorNicolas Pitre <nico@cam.org>
Mon, 9 Mar 2009 02:34:45 +0000 (22:34 -0400)
committerNicolas Pitre <nico@cam.org>
Sat, 30 May 2009 02:34:45 +0000 (22:34 -0400)
This allows for optional alternative implementations of __copy_to_user
and __clear_user, with a possible runtime fallback to the standard
version when the alternative provides no gain over that standard
version. This is done by making the standard __copy_to_user into a weak
alias for the symbol __copy_to_user_std.  Same thing for __clear_user.

Those two functions are particularly good candidates to have alternative
implementations for, since they rely on the STRT instruction which has
lower performances than STM instructions on some CPU cores such as
the ARM1176 and Marvell Feroceon.

Signed-off-by: Nicolas Pitre <nico@marvell.com>
arch/arm/include/asm/uaccess.h
arch/arm/lib/clear_user.S
arch/arm/lib/copy_to_user.S

index 7897464..0da9bc9 100644 (file)
@@ -386,7 +386,9 @@ do {                                                                        \
 #ifdef CONFIG_MMU
 extern unsigned long __must_check __copy_from_user(void *to, const void __user *from, unsigned long n);
 extern unsigned long __must_check __copy_to_user(void __user *to, const void *from, unsigned long n);
 #ifdef CONFIG_MMU
 extern unsigned long __must_check __copy_from_user(void *to, const void __user *from, unsigned long n);
 extern unsigned long __must_check __copy_to_user(void __user *to, const void *from, unsigned long n);
+extern unsigned long __must_check __copy_to_user_std(void __user *to, const void *from, unsigned long n);
 extern unsigned long __must_check __clear_user(void __user *addr, unsigned long n);
 extern unsigned long __must_check __clear_user(void __user *addr, unsigned long n);
+extern unsigned long __must_check __clear_user_std(void __user *addr, unsigned long n);
 #else
 #define __copy_from_user(to,from,n)    (memcpy(to, (void __force *)from, n), 0)
 #define __copy_to_user(to,from,n)      (memcpy((void __force *)to, from, n), 0)
 #else
 #define __copy_from_user(to,from,n)    (memcpy(to, (void __force *)from, n), 0)
 #define __copy_to_user(to,from,n)      (memcpy((void __force *)to, from, n), 0)
index 4d6bc71..844f567 100644 (file)
@@ -18,7 +18,8 @@
  *          : sz   - number of bytes to clear
  * Returns  : number of bytes NOT cleared
  */
  *          : sz   - number of bytes to clear
  * Returns  : number of bytes NOT cleared
  */
-ENTRY(__clear_user)
+ENTRY(__clear_user_std)
+WEAK(__clear_user)
                stmfd   sp!, {r1, lr}
                mov     r2, #0
                cmp     r1, #4
                stmfd   sp!, {r1, lr}
                mov     r2, #0
                cmp     r1, #4
index 22f968b..878820f 100644 (file)
@@ -86,7 +86,8 @@
 
        .text
 
 
        .text
 
-ENTRY(__copy_to_user)
+ENTRY(__copy_to_user_std)
+WEAK(__copy_to_user)
 
 #include "copy_template.S"
 
 
 #include "copy_template.S"