diff options
author | Steven Rostedt <rostedt@goodmis.org> | 2008-02-29 11:04:57 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-04-06 20:03:03 -0400 |
commit | 0119536cd314ef95553604208c25bc35581f7f0a (patch) | |
tree | c196d0652c5bc6bee252d6628cfd76771b2e9131 | |
parent | 4df4441e418c809f263939b9f371b67aca28a280 (diff) |
[POWERPC] Add hand-coded assembly strcmp
We have an assembly version of strncmp for the bootwrapper, but not
for the kernel, so we end up using the C version in the kernel. This
takes the strncmp code from the bootup and copies it to the kernel
proper, adding two instructions so it copes correctly with len==0.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r-- | arch/powerpc/kernel/ppc_ksyms.c | 1 | ||||
-rw-r--r-- | arch/powerpc/lib/string.S | 14 | ||||
-rw-r--r-- | include/asm-powerpc/string.h | 2 |
3 files changed, 17 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c index a722ede726db..5a4c76eada48 100644 --- a/arch/powerpc/kernel/ppc_ksyms.c +++ b/arch/powerpc/kernel/ppc_ksyms.c | |||
@@ -78,6 +78,7 @@ EXPORT_SYMBOL(strncpy); | |||
78 | EXPORT_SYMBOL(strcat); | 78 | EXPORT_SYMBOL(strcat); |
79 | EXPORT_SYMBOL(strlen); | 79 | EXPORT_SYMBOL(strlen); |
80 | EXPORT_SYMBOL(strcmp); | 80 | EXPORT_SYMBOL(strcmp); |
81 | EXPORT_SYMBOL(strncmp); | ||
81 | 82 | ||
82 | EXPORT_SYMBOL(csum_partial); | 83 | EXPORT_SYMBOL(csum_partial); |
83 | EXPORT_SYMBOL(csum_partial_copy_generic); | 84 | EXPORT_SYMBOL(csum_partial_copy_generic); |
diff --git a/arch/powerpc/lib/string.S b/arch/powerpc/lib/string.S index c4c622d8e6ac..49eb1f1a2bb4 100644 --- a/arch/powerpc/lib/string.S +++ b/arch/powerpc/lib/string.S | |||
@@ -75,6 +75,20 @@ _GLOBAL(strcmp) | |||
75 | beq 1b | 75 | beq 1b |
76 | blr | 76 | blr |
77 | 77 | ||
78 | _GLOBAL(strncmp) | ||
79 | PPC_LCMPI r5,0 | ||
80 | beqlr | ||
81 | mtctr r5 | ||
82 | addi r5,r3,-1 | ||
83 | addi r4,r4,-1 | ||
84 | 1: lbzu r3,1(r5) | ||
85 | cmpwi 1,r3,0 | ||
86 | lbzu r0,1(r4) | ||
87 | subf. r3,r0,r3 | ||
88 | beqlr 1 | ||
89 | bdnzt eq,1b | ||
90 | blr | ||
91 | |||
78 | _GLOBAL(strlen) | 92 | _GLOBAL(strlen) |
79 | addi r4,r3,-1 | 93 | addi r4,r3,-1 |
80 | 1: lbzu r0,1(r4) | 94 | 1: lbzu r0,1(r4) |
diff --git a/include/asm-powerpc/string.h b/include/asm-powerpc/string.h index aa40f92c298d..e40010abcaf1 100644 --- a/include/asm-powerpc/string.h +++ b/include/asm-powerpc/string.h | |||
@@ -7,6 +7,7 @@ | |||
7 | #define __HAVE_ARCH_STRNCPY | 7 | #define __HAVE_ARCH_STRNCPY |
8 | #define __HAVE_ARCH_STRLEN | 8 | #define __HAVE_ARCH_STRLEN |
9 | #define __HAVE_ARCH_STRCMP | 9 | #define __HAVE_ARCH_STRCMP |
10 | #define __HAVE_ARCH_STRNCMP | ||
10 | #define __HAVE_ARCH_STRCAT | 11 | #define __HAVE_ARCH_STRCAT |
11 | #define __HAVE_ARCH_MEMSET | 12 | #define __HAVE_ARCH_MEMSET |
12 | #define __HAVE_ARCH_MEMCPY | 13 | #define __HAVE_ARCH_MEMCPY |
@@ -18,6 +19,7 @@ extern char * strcpy(char *,const char *); | |||
18 | extern char * strncpy(char *,const char *, __kernel_size_t); | 19 | extern char * strncpy(char *,const char *, __kernel_size_t); |
19 | extern __kernel_size_t strlen(const char *); | 20 | extern __kernel_size_t strlen(const char *); |
20 | extern int strcmp(const char *,const char *); | 21 | extern int strcmp(const char *,const char *); |
22 | extern int strncmp(const char *, const char *, __kernel_size_t); | ||
21 | extern char * strcat(char *, const char *); | 23 | extern char * strcat(char *, const char *); |
22 | extern void * memset(void *,int,__kernel_size_t); | 24 | extern void * memset(void *,int,__kernel_size_t); |
23 | extern void * memcpy(void *,const void *,__kernel_size_t); | 25 | extern void * memcpy(void *,const void *,__kernel_size_t); |