diff options
Diffstat (limited to 'arch/powerpc/boot')
-rw-r--r-- | arch/powerpc/boot/flatdevtree_env.h | 20 | ||||
-rw-r--r-- | arch/powerpc/boot/string.S | 24 | ||||
-rw-r--r-- | arch/powerpc/boot/string.h | 2 |
3 files changed, 26 insertions, 20 deletions
diff --git a/arch/powerpc/boot/flatdevtree_env.h b/arch/powerpc/boot/flatdevtree_env.h index 83bc1c718836..ad0420da8921 100644 --- a/arch/powerpc/boot/flatdevtree_env.h +++ b/arch/powerpc/boot/flatdevtree_env.h | |||
@@ -24,24 +24,4 @@ | |||
24 | #define be64_to_cpu(x) (x) | 24 | #define be64_to_cpu(x) (x) |
25 | #define cpu_to_be64(x) (x) | 25 | #define cpu_to_be64(x) (x) |
26 | 26 | ||
27 | static inline int strncmp(const char *cs, const char *ct, size_t count) | ||
28 | { | ||
29 | signed char __res = 0; | ||
30 | |||
31 | while (count) { | ||
32 | if ((__res = *cs - *ct++) != 0 || !*cs++) | ||
33 | break; | ||
34 | count--; | ||
35 | } | ||
36 | return __res; | ||
37 | } | ||
38 | |||
39 | static inline char *strchr(const char *s, int c) | ||
40 | { | ||
41 | for (; *s != (char)c; ++s) | ||
42 | if (*s == '\0') | ||
43 | return NULL; | ||
44 | return (char *)s; | ||
45 | } | ||
46 | |||
47 | #endif /* _PPC_BOOT_FLATDEVTREE_ENV_H_ */ | 27 | #endif /* _PPC_BOOT_FLATDEVTREE_ENV_H_ */ |
diff --git a/arch/powerpc/boot/string.S b/arch/powerpc/boot/string.S index ac3d43b6a324..2627558bcb71 100644 --- a/arch/powerpc/boot/string.S +++ b/arch/powerpc/boot/string.S | |||
@@ -49,6 +49,17 @@ strcat: | |||
49 | bne 1b | 49 | bne 1b |
50 | blr | 50 | blr |
51 | 51 | ||
52 | .globl strchr | ||
53 | strchr: | ||
54 | addi r3,r3,-1 | ||
55 | 1: lbzu r0,1(r3) | ||
56 | cmpw 0,r0,r4 | ||
57 | beqlr | ||
58 | cmpwi 0,r0,0 | ||
59 | bne 1b | ||
60 | li r3,0 | ||
61 | blr | ||
62 | |||
52 | .globl strcmp | 63 | .globl strcmp |
53 | strcmp: | 64 | strcmp: |
54 | addi r5,r3,-1 | 65 | addi r5,r3,-1 |
@@ -61,6 +72,19 @@ strcmp: | |||
61 | beq 1b | 72 | beq 1b |
62 | blr | 73 | blr |
63 | 74 | ||
75 | .globl strncmp | ||
76 | strncmp: | ||
77 | mtctr r5 | ||
78 | addi r5,r3,-1 | ||
79 | addi r4,r4,-1 | ||
80 | 1: lbzu r3,1(r5) | ||
81 | cmpwi 1,r3,0 | ||
82 | lbzu r0,1(r4) | ||
83 | subf. r3,r0,r3 | ||
84 | beqlr 1 | ||
85 | bdnzt eq,1b | ||
86 | blr | ||
87 | |||
64 | .globl strlen | 88 | .globl strlen |
65 | strlen: | 89 | strlen: |
66 | addi r4,r3,-1 | 90 | addi r4,r3,-1 |
diff --git a/arch/powerpc/boot/string.h b/arch/powerpc/boot/string.h index 9fdff1cc0d70..4650030d1040 100644 --- a/arch/powerpc/boot/string.h +++ b/arch/powerpc/boot/string.h | |||
@@ -5,7 +5,9 @@ | |||
5 | extern char *strcpy(char *dest, const char *src); | 5 | extern char *strcpy(char *dest, const char *src); |
6 | extern char *strncpy(char *dest, const char *src, size_t n); | 6 | extern char *strncpy(char *dest, const char *src, size_t n); |
7 | extern char *strcat(char *dest, const char *src); | 7 | extern char *strcat(char *dest, const char *src); |
8 | extern char *strchr(const char *s, int c); | ||
8 | extern int strcmp(const char *s1, const char *s2); | 9 | extern int strcmp(const char *s1, const char *s2); |
10 | extern int strncmp(const char *s1, const char *s2, size_t n); | ||
9 | extern size_t strlen(const char *s); | 11 | extern size_t strlen(const char *s); |
10 | extern size_t strnlen(const char *s, size_t count); | 12 | extern size_t strnlen(const char *s, size_t count); |
11 | 13 | ||