aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin/lib
diff options
context:
space:
mode:
authorRobin Getz <robin.getz@analog.com>2010-05-03 13:23:20 -0400
committerMike Frysinger <vapier@gentoo.org>2010-05-22 14:19:09 -0400
commit479ba6035862a9c08ce4351c7fff8926fde4ede5 (patch)
tree93a6419ffdfd38056f26d4362de450f79af044b3 /arch/blackfin/lib
parent80fcdb959343ab9e0ee95c11b5ea47c44a2c3004 (diff)
Blackfin: move string functions to normal lib/ assembly
Since 'extern inline' doesn't work correctly in the context of the Linux kernel (too many overriding defines), move the string functions to normal lib/ assembly files (like the existing mem funcs). This avoids the forced inline all over the kernel and allows us to place them constantly in L1. This also avoids some module failures when gcc inserts calls to string functions but the kernel build system doesn't fully consult the library archives. Signed-off-by: Robin Getz <robin.getz@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch/blackfin/lib')
-rw-r--r--arch/blackfin/lib/strcmp.S43
-rw-r--r--arch/blackfin/lib/strcmp.c19
-rw-r--r--arch/blackfin/lib/strcpy.S35
-rw-r--r--arch/blackfin/lib/strcpy.c19
-rw-r--r--arch/blackfin/lib/strncmp.S52
-rw-r--r--arch/blackfin/lib/strncmp.c18
-rw-r--r--arch/blackfin/lib/strncpy.S52
-rw-r--r--arch/blackfin/lib/strncpy.c19
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
26ENTRY(_strcmp)
27 P0 = R0 ; /* s1 */
28 P1 = R1 ; /* s2 */
29
301:
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 */
382:
39 R0 = R0 - R1; /* *s1 - *s2 */
403:
41 RTS;
42
43ENDPROC(_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
15int strcmp(const char *dest, const char *src)
16{
17 return __inline_strcmp(dest, src);
18}
19EXPORT_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
24ENTRY(_strcpy)
25 P0 = R0 ; /* dst*/
26 P1 = R1 ; /* src*/
27
281:
29 R1 = B [P1++] (Z);
30 B [P0++] = R1;
31 CC = R1;
32 if cc jump 1b (bp);
33 RTS;
34
35ENDPROC(_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
15char *strcpy(char *dest, const char *src)
16{
17 return __inline_strcpy(dest, src);
18}
19EXPORT_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
24ENTRY(_strncmp)
25 CC = R2 == 0;
26 if CC JUMP 5f;
27
28 P0 = R0 ; /* s1 */
29 P1 = R1 ; /* s2 */
301:
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 */
402:
41 R0 = 0; /* strings are equal */
42 jump.s 4f;
433:
44 R0 = R0 - R1; /* *s1 - *s2 */
454:
46 RTS;
47
485:
49 R0 = 0;
50 RTS;
51
52ENDPROC(_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
14int strncmp(const char *cs, const char *ct, size_t count)
15{
16 return __inline_strncmp(cs, ct, count);
17}
18EXPORT_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
24ENTRY(_strncpy)
25 CC = R2 == 0;
26 if CC JUMP 4f;
27 P0 = R0 ; /* dst*/
28 P1 = R1 ; /* src*/
29
301:
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;
392:
40 /* if src is shorter than n, we need to null pad bytes in dest */
41 R1 = 0;
423:
43 R2 += -1;
44 CC = R2 == 0;
45 if cc jump 4f;
46 B [P0++] = R1;
47 jump 3b;
48
494:
50 RTS;
51
52ENDPROC(_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
15char *strncpy(char *dest, const char *src, size_t n)
16{
17 return __inline_strncpy(dest, src, n);
18}
19EXPORT_SYMBOL(strncpy);