Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/matt-nb6-plus]: src/common/lib/libc/arch/arm/string Sync with HEAD.



details:   https://anonhg.NetBSD.org/src/rev/9af927679169
branches:  matt-nb6-plus
changeset: 774553:9af927679169
user:      matt <matt%NetBSD.org@localhost>
date:      Fri Feb 08 02:22:41 2013 +0000

description:
Sync with HEAD.

diffstat:

 common/lib/libc/arch/arm/string/strchr_arm.S  |   4 +++-
 common/lib/libc/arch/arm/string/strrchr_arm.S |  16 ++++++++++++----
 2 files changed, 15 insertions(+), 5 deletions(-)

diffs (61 lines):

diff -r 5155e14c486e -r 9af927679169 common/lib/libc/arch/arm/string/strchr_arm.S
--- a/common/lib/libc/arch/arm/string/strchr_arm.S      Fri Feb 08 01:41:49 2013 +0000
+++ b/common/lib/libc/arch/arm/string/strchr_arm.S      Fri Feb 08 02:22:41 2013 +0000
@@ -29,7 +29,7 @@
 
 #include <machine/asm.h>
 
-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   0x000000ff
@@ -90,6 +90,8 @@
         * 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) */
diff -r 5155e14c486e -r 9af927679169 common/lib/libc/arch/arm/string/strrchr_arm.S
--- a/common/lib/libc/arch/arm/string/strrchr_arm.S     Fri Feb 08 01:41:49 2013 +0000
+++ b/common/lib/libc/arch/arm/string/strrchr_arm.S     Fri Feb 08 02:22:41 2013 +0000
@@ -29,7 +29,7 @@
 
 #include <machine/asm.h>
 
-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   0x000000ff
@@ -47,16 +47,24 @@
 
        .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 */



Home | Main Index | Thread Index | Old Index