diff options
Diffstat (limited to 'arch/blackfin/lib')
-rw-r--r-- | arch/blackfin/lib/strcmp.S | 43 | ||||
-rw-r--r-- | arch/blackfin/lib/strcmp.c | 19 | ||||
-rw-r--r-- | arch/blackfin/lib/strcpy.S | 35 | ||||
-rw-r--r-- | arch/blackfin/lib/strcpy.c | 19 | ||||
-rw-r--r-- | arch/blackfin/lib/strncmp.S | 52 | ||||
-rw-r--r-- | arch/blackfin/lib/strncmp.c | 18 | ||||
-rw-r--r-- | arch/blackfin/lib/strncpy.S | 52 | ||||
-rw-r--r-- | arch/blackfin/lib/strncpy.c | 19 |
8 files changed, 182 insertions, 75 deletions
diff --git a/arch/blackfin/lib/strcmp.S b/arch/blackfin/lib/strcmp.S new file mode 100644 index 000000000000..d7c1d158973b --- /dev/null +++ b/arch/blackfin/lib/strcmp.S | |||
@@ -0,0 +1,43 @@ | |||
1 | /* | ||
2 | * Copyright 2005-2010 Analog Devices Inc. | ||
3 | * | ||
4 | * Licensed under the ADI BSD license or the GPL-2 (or later) | ||
5 | */ | ||
6 | |||
7 | #include <linux/linkage.h> | ||
8 | |||
9 | /* void *strcmp(char *s1, const char *s2); | ||
10 | * R0 = address (s1) | ||
11 | * R1 = address (s2) | ||
12 | * | ||
13 | * Returns an integer less than, equal to, or greater than zero if s1 | ||
14 | * (or the first n bytes thereof) is found, respectively, to be less | ||
15 | * than, to match, or be greater than s2. | ||
16 | */ | ||
17 | |||
18 | #ifdef CONFIG_STRCMP_L1 | ||
19 | .section .l1.text | ||
20 | #else | ||
21 | .text | ||
22 | #endif | ||
23 | |||
24 | .align 2 | ||
25 | |||
26 | ENTRY(_strcmp) | ||
27 | P0 = R0 ; /* s1 */ | ||
28 | P1 = R1 ; /* s2 */ | ||
29 | |||
30 | 1: | ||
31 | R0 = B[P0++] (Z); /* get *s1 */ | ||
32 | R1 = B[P1++] (Z); /* get *s2 */ | ||
33 | CC = R0 == R1; /* compare a byte */ | ||
34 | if ! cc jump 2f; /* not equal, break out */ | ||
35 | CC = R0; /* at end of s1? */ | ||
36 | if cc jump 1b (bp); /* no, keep going */ | ||
37 | jump.s 3f; /* strings are equal */ | ||
38 | 2: | ||
39 | R0 = R0 - R1; /* *s1 - *s2 */ | ||
40 | 3: | ||
41 | RTS; | ||
42 | |||
43 | ENDPROC(_strcmp) | ||
diff --git a/arch/blackfin/lib/strcmp.c b/arch/blackfin/lib/strcmp.c deleted file mode 100644 index fde39a1950ce..000000000000 --- a/arch/blackfin/lib/strcmp.c +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | /* | ||
2 | * Provide symbol in case str func is not inlined. | ||
3 | * | ||
4 | * Copyright (c) 2006-2007 Analog Devices Inc. | ||
5 | * | ||
6 | * Licensed under the GPL-2 or later. | ||
7 | */ | ||
8 | |||
9 | #define strcmp __inline_strcmp | ||
10 | #include <asm/string.h> | ||
11 | #undef strcmp | ||
12 | |||
13 | #include <linux/module.h> | ||
14 | |||
15 | int strcmp(const char *dest, const char *src) | ||
16 | { | ||
17 | return __inline_strcmp(dest, src); | ||
18 | } | ||
19 | EXPORT_SYMBOL(strcmp); | ||
diff --git a/arch/blackfin/lib/strcpy.S b/arch/blackfin/lib/strcpy.S new file mode 100644 index 000000000000..a6a0c6363806 --- /dev/null +++ b/arch/blackfin/lib/strcpy.S | |||
@@ -0,0 +1,35 @@ | |||
1 | /* | ||
2 | * Copyright 2005-2010 Analog Devices Inc. | ||
3 | * | ||
4 | * Licensed under the ADI BSD license or the GPL-2 (or later) | ||
5 | */ | ||
6 | |||
7 | #include <linux/linkage.h> | ||
8 | |||
9 | /* void *strcpy(char *dest, const char *src); | ||
10 | * R0 = address (dest) | ||
11 | * R1 = address (src) | ||
12 | * | ||
13 | * Returns a pointer to the destination string dest | ||
14 | */ | ||
15 | |||
16 | #ifdef CONFIG_STRCPY_L1 | ||
17 | .section .l1.text | ||
18 | #else | ||
19 | .text | ||
20 | #endif | ||
21 | |||
22 | .align 2 | ||
23 | |||
24 | ENTRY(_strcpy) | ||
25 | P0 = R0 ; /* dst*/ | ||
26 | P1 = R1 ; /* src*/ | ||
27 | |||
28 | 1: | ||
29 | R1 = B [P1++] (Z); | ||
30 | B [P0++] = R1; | ||
31 | CC = R1; | ||
32 | if cc jump 1b (bp); | ||
33 | RTS; | ||
34 | |||
35 | ENDPROC(_strcpy) | ||
diff --git a/arch/blackfin/lib/strcpy.c b/arch/blackfin/lib/strcpy.c deleted file mode 100644 index 2a8836b1f4d3..000000000000 --- a/arch/blackfin/lib/strcpy.c +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | /* | ||
2 | * Provide symbol in case str func is not inlined. | ||
3 | * | ||
4 | * Copyright (c) 2006-2007 Analog Devices Inc. | ||
5 | * | ||
6 | * Licensed under the GPL-2 or later. | ||
7 | */ | ||
8 | |||
9 | #define strcpy __inline_strcpy | ||
10 | #include <asm/string.h> | ||
11 | #undef strcpy | ||
12 | |||
13 | #include <linux/module.h> | ||
14 | |||
15 | char *strcpy(char *dest, const char *src) | ||
16 | { | ||
17 | return __inline_strcpy(dest, src); | ||
18 | } | ||
19 | EXPORT_SYMBOL(strcpy); | ||
diff --git a/arch/blackfin/lib/strncmp.S b/arch/blackfin/lib/strncmp.S new file mode 100644 index 000000000000..6da37c34a847 --- /dev/null +++ b/arch/blackfin/lib/strncmp.S | |||
@@ -0,0 +1,52 @@ | |||
1 | /* | ||
2 | * Copyright 2005-2010 Analog Devices Inc. | ||
3 | * | ||
4 | * Licensed under the ADI BSD license or the GPL-2 (or later) | ||
5 | */ | ||
6 | |||
7 | #include <linux/linkage.h> | ||
8 | |||
9 | /* void *strncpy(char *s1, const char *s2, size_t n); | ||
10 | * R0 = address (dest) | ||
11 | * R1 = address (src) | ||
12 | * R2 = size (n) | ||
13 | * Returns a pointer to the destination string dest | ||
14 | */ | ||
15 | |||
16 | #ifdef CONFIG_STRNCMP_L1 | ||
17 | .section .l1.text | ||
18 | #else | ||
19 | .text | ||
20 | #endif | ||
21 | |||
22 | .align 2 | ||
23 | |||
24 | ENTRY(_strncmp) | ||
25 | CC = R2 == 0; | ||
26 | if CC JUMP 5f; | ||
27 | |||
28 | P0 = R0 ; /* s1 */ | ||
29 | P1 = R1 ; /* s2 */ | ||
30 | 1: | ||
31 | R0 = B[P0++] (Z); /* get *s1 */ | ||
32 | R1 = B[P1++] (Z); /* get *s2 */ | ||
33 | CC = R0 == R1; /* compare a byte */ | ||
34 | if ! cc jump 3f; /* not equal, break out */ | ||
35 | CC = R0; /* at end of s1? */ | ||
36 | if ! cc jump 4f; /* yes, all done */ | ||
37 | R2 += -1; /* no, adjust count */ | ||
38 | CC = R2 == 0; | ||
39 | if ! cc jump 1b (bp); /* more to do, keep going */ | ||
40 | 2: | ||
41 | R0 = 0; /* strings are equal */ | ||
42 | jump.s 4f; | ||
43 | 3: | ||
44 | R0 = R0 - R1; /* *s1 - *s2 */ | ||
45 | 4: | ||
46 | RTS; | ||
47 | |||
48 | 5: | ||
49 | R0 = 0; | ||
50 | RTS; | ||
51 | |||
52 | ENDPROC(_strncmp) | ||
diff --git a/arch/blackfin/lib/strncmp.c b/arch/blackfin/lib/strncmp.c deleted file mode 100644 index 46518b1d2983..000000000000 --- a/arch/blackfin/lib/strncmp.c +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | /* | ||
2 | * Provide symbol in case str func is not inlined. | ||
3 | * | ||
4 | * Copyright (c) 2006-2007 Analog Devices Inc. | ||
5 | * | ||
6 | * Licensed under the GPL-2 or later. | ||
7 | */ | ||
8 | |||
9 | #define strncmp __inline_strncmp | ||
10 | #include <asm/string.h> | ||
11 | #include <linux/module.h> | ||
12 | #undef strncmp | ||
13 | |||
14 | int strncmp(const char *cs, const char *ct, size_t count) | ||
15 | { | ||
16 | return __inline_strncmp(cs, ct, count); | ||
17 | } | ||
18 | EXPORT_SYMBOL(strncmp); | ||
diff --git a/arch/blackfin/lib/strncpy.S b/arch/blackfin/lib/strncpy.S new file mode 100644 index 000000000000..39fbbe6523e5 --- /dev/null +++ b/arch/blackfin/lib/strncpy.S | |||
@@ -0,0 +1,52 @@ | |||
1 | /* | ||
2 | * Copyright 2005-2010 Analog Devices Inc. | ||
3 | * | ||
4 | * Licensed under the ADI BSD license or the GPL-2 (or later) | ||
5 | */ | ||
6 | |||
7 | #include <linux/linkage.h> | ||
8 | |||
9 | /* void *strncpy(char *dest, const char *src, size_t n); | ||
10 | * R0 = address (dest) | ||
11 | * R1 = address (src) | ||
12 | * R2 = size | ||
13 | * Returns a pointer to the destination string dest | ||
14 | */ | ||
15 | |||
16 | #ifdef CONFIG_STRNCPY_L1 | ||
17 | .section .l1.text | ||
18 | #else | ||
19 | .text | ||
20 | #endif | ||
21 | |||
22 | .align 2 | ||
23 | |||
24 | ENTRY(_strncpy) | ||
25 | CC = R2 == 0; | ||
26 | if CC JUMP 4f; | ||
27 | P0 = R0 ; /* dst*/ | ||
28 | P1 = R1 ; /* src*/ | ||
29 | |||
30 | 1: | ||
31 | R1 = B [P1++] (Z); | ||
32 | B [P0++] = R1; | ||
33 | CC = R1; | ||
34 | if ! cc jump 2f; | ||
35 | R2 += -1; | ||
36 | CC = R2 == 0; | ||
37 | if ! cc jump 1b (bp); | ||
38 | jump 4f; | ||
39 | 2: | ||
40 | /* if src is shorter than n, we need to null pad bytes in dest */ | ||
41 | R1 = 0; | ||
42 | 3: | ||
43 | R2 += -1; | ||
44 | CC = R2 == 0; | ||
45 | if cc jump 4f; | ||
46 | B [P0++] = R1; | ||
47 | jump 3b; | ||
48 | |||
49 | 4: | ||
50 | RTS; | ||
51 | |||
52 | ENDPROC(_strncpy) | ||
diff --git a/arch/blackfin/lib/strncpy.c b/arch/blackfin/lib/strncpy.c deleted file mode 100644 index ea1dc6bf2373..000000000000 --- a/arch/blackfin/lib/strncpy.c +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | /* | ||
2 | * Provide symbol in case str func is not inlined. | ||
3 | * | ||
4 | * Copyright (c) 2006-2007 Analog Devices Inc. | ||
5 | * | ||
6 | * Licensed under the GPL-2 or later. | ||
7 | */ | ||
8 | |||
9 | #define strncpy __inline_strncpy | ||
10 | #include <asm/string.h> | ||
11 | #undef strncpy | ||
12 | |||
13 | #include <linux/module.h> | ||
14 | |||
15 | char *strncpy(char *dest, const char *src, size_t n) | ||
16 | { | ||
17 | return __inline_strncpy(dest, src, n); | ||
18 | } | ||
19 | EXPORT_SYMBOL(strncpy); | ||