]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[POWERPC] Add memchr() to the bootwrapper
authorDavid Gibson <david@gibson.dropbear.id.au>
Fri, 12 Oct 2007 02:36:20 +0000 (12:36 +1000)
committerPaul Mackerras <paulus@samba.org>
Fri, 12 Oct 2007 04:13:44 +0000 (14:13 +1000)
This adds a memchr() implementation to the bootwrapper, which will
be needed when libfdt is merged in.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/boot/string.S
arch/powerpc/boot/string.h

index 2627558bcb7132cc30a7944752068264beeb0cbb..643e4cb2f11da67f3c55f237ff68fbda5b07687f 100644 (file)
@@ -219,6 +219,19 @@ backwards_memcpy:
        mtctr   r7
        b       1b
 
+       .globl  memchr
+memchr:
+       cmpwi   0,r5,0
+       blelr
+       mtctr   r5
+       addi    r3,r3,-1
+1:     lbzu    r0,1(r3)
+       cmpw    r0,r4
+       beqlr
+       bdnz    1b
+       li      r3,0
+       blr
+
        .globl  memcmp
 memcmp:
        cmpwi   0,r5,0
index 4650030d1040c32d50f390b407ef64d0f7ddba37..50091cc0eed97a3ba8b384c6a88a11ba64265bef 100644 (file)
@@ -14,6 +14,7 @@ extern size_t strnlen(const char *s, size_t count);
 extern void *memset(void *s, int c, size_t n);
 extern void *memmove(void *dest, const void *src, unsigned long n);
 extern void *memcpy(void *dest, const void *src, unsigned long n);
+extern void *memchr(const void *s, int c, size_t n);
 extern int memcmp(const void *s1, const void *s2, size_t n);
 
 #endif /* _PPC_BOOT_STRING_H_ */