diff options
author | Steven Rostedt <rostedt@goodmis.org> | 2008-03-01 03:04:57 +1100 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-04-07 10:03:03 +1000 |
commit | 0119536cd314ef95553604208c25bc35581f7f0a (patch) | |
tree | c196d0652c5bc6bee252d6628cfd76771b2e9131 /arch/powerpc/lib | |
parent | 4df4441e418c809f263939b9f371b67aca28a280 (diff) | |
download | linux-0119536cd314ef95553604208c25bc35581f7f0a.tar.gz linux-0119536cd314ef95553604208c25bc35581f7f0a.tar.bz2 linux-0119536cd314ef95553604208c25bc35581f7f0a.zip |
[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>
Diffstat (limited to 'arch/powerpc/lib')
-rw-r--r-- | arch/powerpc/lib/string.S | 14 |
1 files changed, 14 insertions, 0 deletions
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) beq 1b 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) addi r4,r3,-1 1: lbzu r0,1(r4) |