Module Name:src
Committed By: matt
Date: Fri Feb 8 02:22:41 UTC 2013
Modified Files:
src/common/lib/libc/arch/arm/string [matt-nb6-plus]: strchr_arm.S
strrchr_arm.S
Log Message:
Sync with HEAD.
To generate a diff of this commit:
cvs rdiff -u -r1.4.2.2 -r1.4.2.3 \
src/common/lib/libc/arch/arm/string/strchr_arm.S
cvs rdiff -u -r1.2.2.2 -r1.2.2.3 \
src/common/lib/libc/arch/arm/string/strrchr_arm.S
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/common/lib/libc/arch/arm/string/strchr_arm.S
diff -u src/common/lib/libc/arch/arm/string/strchr_arm.S:1.4.2.2 src/common/lib/libc/arch/arm/string/strchr_arm.S:1.4.2.3
--- src/common/lib/libc/arch/arm/string/strchr_arm.S:1.4.2.2 Thu Feb 7 07:06:00 2013
+++ src/common/lib/libc/arch/arm/string/strchr_arm.S Fri Feb 8 02:22:41 2013
@@ -29,7 +29,7 @@
#include
-RCSID("$NetBSD: strchr_arm.S,v 1.4.2.2 2013/02/07 07:06:00 matt Exp $")
+RCSID("$NetBSD: strchr_arm.S,v 1.4.2.3 2013/02/08 02:22:41 matt Exp $")
#ifdef __ARMEL__
#define BYTE0 0x00ff
@@ -90,6 +90,8 @@ ENTRY(strchr)
* We've encountered a NUL or a match but we don't know which happened
* first.
*/
+ teq r2, #0 /* searching for NUL? */
+ beq .Lfind_match /* yes, find the match */
mvns ip, ip /* did we encounter a NUL? */
beq .Lfind_match /* no, find the match */
bics r3, r3, ip /* clear match for the NUL(s) */
Index: src/common/lib/libc/arch/arm/string/strrchr_arm.S
diff -u src/common/lib/libc/arch/arm/string/strrchr_arm.S:1.2.2.2 src/common/lib/libc/arch/arm/string/strrchr_arm.S:1.2.2.3
--- src/common/lib/libc/arch/arm/string/strrchr_arm.S:1.2.2.2 Thu Feb 7 07:06:02 2013
+++ src/common/lib/libc/arch/arm/string/strrchr_arm.S Fri Feb 8 02:22:41 2013
@@ -29,7 +29,7 @@
#include
-RCSID("$NetBSD: strrchr_arm.S,v 1.2.2.2 2013/02/07 07:06:02 matt Exp $")
+RCSID("$NetBSD: strrchr_arm.S,v 1.2.2.3 2013/02/08 02:22:41 matt Exp $")
#ifdef __ARMEL__
#define BYTE0 0x00ff
@@ -47,16 +47,24 @@ RCSID("$NetBSD: strrchr_arm.S,v 1.2.2.2
.text
ENTRY(strrchr)
- mov ip, r0 /* we use r0 at the return value */
+ teq r1, #0 /* searching for NUL? */
+ bne 1f /* no, do it the hard way */
+ push {r0, lr} /* save pointer and return addr */
+ bl PLT_SYM(strlen) /* get length */
+ pop {r1, lr} /* restore pointer and returna addr */
+ add r0, r0, r1 /* add pointer to length */
+ RET/* return */
+
+1: mov ip, r0 /* we use r0 at the return value */
mov r0, #0 /* return NULL by default */
and r2, r1, #0xff /* restrict to byte value */
-1: tst ip, #3 /* test for word alignment */
+2: tst ip, #3 /* test for word alignment */
beq .Lpre_main_loop /* finally word aligned */
ldrb r3, [ip], #1 /* load a byte */
cmp r3, r2 /* did it match? */
subeq r0, ip, #1 /* yes, remember that it did */
teq r3, #0 /* was it NUL? */
- bne 1b /* no, try next byte */
+ bne 2b /* no, try next byte */
RET/* return */
.Lpre_main_loop:
push {r4, r5} /* save some registers */