Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 67281
b: refs/heads/master
c: 0ae0b54
h: refs/heads/master
i:
  67279: 351be3f
v: v3
  • Loading branch information
David Gibson authored and Paul Mackerras committed Sep 13, 2007
1 parent 8ca5b74 commit 8d1717a
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 768cc2d3b2768ca34f254e8190f1f9e297b09ad4
refs/heads/master: 0ae0b54565a8dcc2b98de694b998e765de15b713
20 changes: 0 additions & 20 deletions trunk/arch/powerpc/boot/flatdevtree_env.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,4 @@
#define be64_to_cpu(x) (x)
#define cpu_to_be64(x) (x)

static inline int strncmp(const char *cs, const char *ct, size_t count)
{
signed char __res = 0;

while (count) {
if ((__res = *cs - *ct++) != 0 || !*cs++)
break;
count--;
}
return __res;
}

static inline char *strchr(const char *s, int c)
{
for (; *s != (char)c; ++s)
if (*s == '\0')
return NULL;
return (char *)s;
}

#endif /* _PPC_BOOT_FLATDEVTREE_ENV_H_ */
24 changes: 24 additions & 0 deletions trunk/arch/powerpc/boot/string.S
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@ strcat:
bne 1b
blr

.globl strchr
strchr:
addi r3,r3,-1
1: lbzu r0,1(r3)
cmpw 0,r0,r4
beqlr
cmpwi 0,r0,0
bne 1b
li r3,0
blr

.globl strcmp
strcmp:
addi r5,r3,-1
Expand All @@ -61,6 +72,19 @@ strcmp:
beq 1b
blr

.globl strncmp
strncmp:
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

.globl strlen
strlen:
addi r4,r3,-1
Expand Down
2 changes: 2 additions & 0 deletions trunk/arch/powerpc/boot/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
extern char *strcpy(char *dest, const char *src);
extern char *strncpy(char *dest, const char *src, size_t n);
extern char *strcat(char *dest, const char *src);
extern char *strchr(const char *s, int c);
extern int strcmp(const char *s1, const char *s2);
extern int strncmp(const char *s1, const char *s2, size_t n);
extern size_t strlen(const char *s);
extern size_t strnlen(const char *s, size_t count);

Expand Down

0 comments on commit 8d1717a

Please sign in to comment.