diff options
Diffstat (limited to 'arch/blackfin/lib')
-rw-r--r-- | arch/blackfin/lib/memset.S | 1 | ||||
-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 | 85 | ||||
-rw-r--r-- | arch/blackfin/lib/strncpy.c | 19 |
9 files changed, 216 insertions, 75 deletions
diff --git a/arch/blackfin/lib/memset.S b/arch/blackfin/lib/memset.S index c30d99b10969..eab1bef3f5bf 100644 --- a/arch/blackfin/lib/memset.S +++ b/arch/blackfin/lib/memset.S | |||
@@ -20,6 +20,7 @@ | |||
20 | * R1 = filler byte | 20 | * R1 = filler byte |
21 | * R2 = count | 21 | * R2 = count |
22 | * Favours word aligned data. | 22 | * Favours word aligned data. |
23 | * The strncpy assumes that I0 and I1 are not used in this function | ||
23 | */ | 24 | */ |
24 | 25 | ||
25 | ENTRY(_memset) | 26 | ENTRY(_memset) |
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..f3931d50b4a7 --- /dev/null +++ b/arch/blackfin/lib/strncpy.S | |||
@@ -0,0 +1,85 @@ | |||
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 | #include <asm/context.S> | ||
9 | |||
10 | /* void *strncpy(char *dest, const char *src, size_t n); | ||
11 | * R0 = address (dest) | ||
12 | * R1 = address (src) | ||
13 | * R2 = size | ||
14 | * Returns a pointer (R0) to the destination string dest | ||
15 | * we do this by not changing R0 | ||
16 | */ | ||
17 | |||
18 | #ifdef CONFIG_STRNCPY_L1 | ||
19 | .section .l1.text | ||
20 | #else | ||
21 | .text | ||
22 | #endif | ||
23 | |||
24 | .align 2 | ||
25 | |||
26 | ENTRY(_strncpy) | ||
27 | CC = R2 == 0; | ||
28 | if CC JUMP 4f; | ||
29 | |||
30 | P2 = R2 ; /* size */ | ||
31 | P0 = R0 ; /* dst*/ | ||
32 | P1 = R1 ; /* src*/ | ||
33 | |||
34 | LSETUP (1f, 2f) LC0 = P2; | ||
35 | 1: | ||
36 | R1 = B [P1++] (Z); | ||
37 | B [P0++] = R1; | ||
38 | CC = R1 == 0; | ||
39 | 2: | ||
40 | if CC jump 3f; | ||
41 | |||
42 | RTS; | ||
43 | |||
44 | /* if src is shorter than n, we need to null pad bytes in dest | ||
45 | * but, we can get here when the last byte is zero, and we don't | ||
46 | * want to copy an extra byte at the end, so we need to check | ||
47 | */ | ||
48 | 3: | ||
49 | R2 = LC0; | ||
50 | CC = R2 | ||
51 | if ! CC jump 6f; | ||
52 | |||
53 | /* if the required null padded portion is small, do it here, rather than | ||
54 | * handling the overhead of memset (which is OK when things are big). | ||
55 | */ | ||
56 | R3 = 0x20; | ||
57 | CC = R2 < R3; | ||
58 | IF CC jump 4f; | ||
59 | |||
60 | R2 += -1; | ||
61 | |||
62 | /* Set things up for memset | ||
63 | * R0 = address | ||
64 | * R1 = filler byte (this case it's zero, set above) | ||
65 | * R2 = count (set above) | ||
66 | */ | ||
67 | |||
68 | I1 = R0; | ||
69 | R0 = RETS; | ||
70 | I0 = R0; | ||
71 | R0 = P0; | ||
72 | pseudo_long_call _memset, p0; | ||
73 | R0 = I0; | ||
74 | RETS = R0; | ||
75 | R0 = I1; | ||
76 | RTS; | ||
77 | |||
78 | 4: | ||
79 | LSETUP(5f, 5f) LC0; | ||
80 | 5: | ||
81 | B [P0++] = R1; | ||
82 | 6: | ||
83 | RTS; | ||
84 | |||
85 | 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); | ||