Commit 0119536c authored by Steven Rostedt's avatar Steven Rostedt Committed by Paul Mackerras

[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: default avatarSteven Rostedt <srostedt@redhat.com>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 4df4441e
...@@ -78,6 +78,7 @@ EXPORT_SYMBOL(strncpy); ...@@ -78,6 +78,7 @@ EXPORT_SYMBOL(strncpy);
EXPORT_SYMBOL(strcat); EXPORT_SYMBOL(strcat);
EXPORT_SYMBOL(strlen); EXPORT_SYMBOL(strlen);
EXPORT_SYMBOL(strcmp); EXPORT_SYMBOL(strcmp);
EXPORT_SYMBOL(strncmp);
EXPORT_SYMBOL(csum_partial); EXPORT_SYMBOL(csum_partial);
EXPORT_SYMBOL(csum_partial_copy_generic); EXPORT_SYMBOL(csum_partial_copy_generic);
......
...@@ -75,6 +75,20 @@ _GLOBAL(strcmp) ...@@ -75,6 +75,20 @@ _GLOBAL(strcmp)
beq 1b beq 1b
blr blr
_GLOBAL(strncmp)
PPC_LCMPI r5,0
beqlr
mtctr r5
addi r5,r3,-1
addi r4,r4,-1
1: lbzu r3,1(r5)
cmpwi 1,r3,0
lbzu r0,1(r4)
subf. r3,r0,r3
beqlr 1
bdnzt eq,1b
blr
_GLOBAL(strlen) _GLOBAL(strlen)
addi r4,r3,-1 addi r4,r3,-1
1: lbzu r0,1(r4) 1: lbzu r0,1(r4)
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#define __HAVE_ARCH_STRNCPY #define __HAVE_ARCH_STRNCPY
#define __HAVE_ARCH_STRLEN #define __HAVE_ARCH_STRLEN
#define __HAVE_ARCH_STRCMP #define __HAVE_ARCH_STRCMP
#define __HAVE_ARCH_STRNCMP
#define __HAVE_ARCH_STRCAT #define __HAVE_ARCH_STRCAT
#define __HAVE_ARCH_MEMSET #define __HAVE_ARCH_MEMSET
#define __HAVE_ARCH_MEMCPY #define __HAVE_ARCH_MEMCPY
...@@ -18,6 +19,7 @@ extern char * strcpy(char *,const char *); ...@@ -18,6 +19,7 @@ extern char * strcpy(char *,const char *);
extern char * strncpy(char *,const char *, __kernel_size_t); extern char * strncpy(char *,const char *, __kernel_size_t);
extern __kernel_size_t strlen(const char *); extern __kernel_size_t strlen(const char *);
extern int strcmp(const char *,const char *); extern int strcmp(const char *,const char *);
extern int strncmp(const char *, const char *, __kernel_size_t);
extern char * strcat(char *, const char *); extern char * strcat(char *, const char *);
extern void * memset(void *,int,__kernel_size_t); extern void * memset(void *,int,__kernel_size_t);
extern void * memcpy(void *,const void *,__kernel_size_t); extern void * memcpy(void *,const void *,__kernel_size_t);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment