diff options
author | David S. Miller <davem@davemloft.net> | 2008-12-09 07:09:07 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-12-09 07:09:07 -0500 |
commit | 18cdae68e7bb24f33883e58f366cde38ea89ba17 (patch) | |
tree | 891b87b5e3c0b605f5e7d2b9809282b67c005293 | |
parent | ae984d72e0632782dd98c3fcf469b9045ad0d449 (diff) |
sparc: Commonize memcmp assembler.
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | arch/sparc/kernel/sparc_ksyms_32.c | 2 | ||||
-rw-r--r-- | arch/sparc/kernel/sparc_ksyms_64.c | 2 | ||||
-rw-r--r-- | arch/sparc/lib/Makefile | 2 | ||||
-rw-r--r-- | arch/sparc/lib/memcmp.S | 27 | ||||
-rw-r--r-- | arch/sparc/lib/memcmp_32.S | 30 | ||||
-rw-r--r-- | arch/sparc/lib/memcmp_64.S | 28 |
6 files changed, 28 insertions, 63 deletions
diff --git a/arch/sparc/kernel/sparc_ksyms_32.c b/arch/sparc/kernel/sparc_ksyms_32.c index 3c80562faa8a..a4d45fc29b21 100644 --- a/arch/sparc/kernel/sparc_ksyms_32.c +++ b/arch/sparc/kernel/sparc_ksyms_32.c | |||
@@ -61,7 +61,6 @@ extern void (*bzero_1page)(void *); | |||
61 | extern void *__bzero(void *, size_t); | 61 | extern void *__bzero(void *, size_t); |
62 | extern void *__memscan_zero(void *, size_t); | 62 | extern void *__memscan_zero(void *, size_t); |
63 | extern void *__memscan_generic(void *, int, size_t); | 63 | extern void *__memscan_generic(void *, int, size_t); |
64 | extern int __memcmp(const void *, const void *, __kernel_size_t); | ||
65 | extern int __strncmp(const char *, const char *, __kernel_size_t); | 64 | extern int __strncmp(const char *, const char *, __kernel_size_t); |
66 | 65 | ||
67 | extern int __ashrdi3(int, int); | 66 | extern int __ashrdi3(int, int); |
@@ -211,7 +210,6 @@ EXPORT_SYMBOL(bzero_1page); | |||
211 | EXPORT_SYMBOL(__bzero); | 210 | EXPORT_SYMBOL(__bzero); |
212 | EXPORT_SYMBOL(__memscan_zero); | 211 | EXPORT_SYMBOL(__memscan_zero); |
213 | EXPORT_SYMBOL(__memscan_generic); | 212 | EXPORT_SYMBOL(__memscan_generic); |
214 | EXPORT_SYMBOL(__memcmp); | ||
215 | EXPORT_SYMBOL(__strncmp); | 213 | EXPORT_SYMBOL(__strncmp); |
216 | EXPORT_SYMBOL(__memmove); | 214 | EXPORT_SYMBOL(__memmove); |
217 | 215 | ||
diff --git a/arch/sparc/kernel/sparc_ksyms_64.c b/arch/sparc/kernel/sparc_ksyms_64.c index e6d2bb86a46f..59e7ca0108e9 100644 --- a/arch/sparc/kernel/sparc_ksyms_64.c +++ b/arch/sparc/kernel/sparc_ksyms_64.c | |||
@@ -62,7 +62,6 @@ extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); | |||
62 | extern void *__bzero(void *, size_t); | 62 | extern void *__bzero(void *, size_t); |
63 | extern void *__memscan_zero(void *, size_t); | 63 | extern void *__memscan_zero(void *, size_t); |
64 | extern void *__memscan_generic(void *, int, size_t); | 64 | extern void *__memscan_generic(void *, int, size_t); |
65 | extern int __memcmp(const void *, const void *, __kernel_size_t); | ||
66 | extern __kernel_size_t strlen(const char *); | 65 | extern __kernel_size_t strlen(const char *); |
67 | extern void sys_sigsuspend(void); | 66 | extern void sys_sigsuspend(void); |
68 | extern int compat_sys_ioctl(unsigned int fd, unsigned int cmd, u32 arg); | 67 | extern int compat_sys_ioctl(unsigned int fd, unsigned int cmd, u32 arg); |
@@ -223,7 +222,6 @@ EXPORT_SYMBOL(copy_user_page); | |||
223 | EXPORT_SYMBOL(__bzero); | 222 | EXPORT_SYMBOL(__bzero); |
224 | EXPORT_SYMBOL(__memscan_zero); | 223 | EXPORT_SYMBOL(__memscan_zero); |
225 | EXPORT_SYMBOL(__memscan_generic); | 224 | EXPORT_SYMBOL(__memscan_generic); |
226 | EXPORT_SYMBOL(__memcmp); | ||
227 | EXPORT_SYMBOL(__memset); | 225 | EXPORT_SYMBOL(__memset); |
228 | 226 | ||
229 | EXPORT_SYMBOL(csum_partial); | 227 | EXPORT_SYMBOL(csum_partial); |
diff --git a/arch/sparc/lib/Makefile b/arch/sparc/lib/Makefile index 0db2c61a0f78..375016e19144 100644 --- a/arch/sparc/lib/Makefile +++ b/arch/sparc/lib/Makefile | |||
@@ -9,7 +9,7 @@ lib-$(CONFIG_SPARC32) += memcpy.o memset.o | |||
9 | lib-y += strlen.o | 9 | lib-y += strlen.o |
10 | lib-y += checksum_$(BITS).o | 10 | lib-y += checksum_$(BITS).o |
11 | lib-$(CONFIG_SPARC32) += blockops.o | 11 | lib-$(CONFIG_SPARC32) += blockops.o |
12 | lib-y += memscan_$(BITS).o memcmp_$(BITS).o strncmp_$(BITS).o | 12 | lib-y += memscan_$(BITS).o memcmp.o strncmp_$(BITS).o |
13 | lib-y += strncpy_from_user_$(BITS).o strlen_user_$(BITS).o | 13 | lib-y += strncpy_from_user_$(BITS).o strlen_user_$(BITS).o |
14 | lib-$(CONFIG_SPARC32) += divdi3.o udivdi3.o | 14 | lib-$(CONFIG_SPARC32) += divdi3.o udivdi3.o |
15 | lib-$(CONFIG_SPARC32) += copy_user.o locks.o | 15 | lib-$(CONFIG_SPARC32) += copy_user.o locks.o |
diff --git a/arch/sparc/lib/memcmp.S b/arch/sparc/lib/memcmp.S new file mode 100644 index 000000000000..efa106c41ed0 --- /dev/null +++ b/arch/sparc/lib/memcmp.S | |||
@@ -0,0 +1,27 @@ | |||
1 | /* Sparc optimized memcmp code. | ||
2 | * | ||
3 | * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) | ||
4 | * Copyright (C) 2000, 2008 David S. Miller (davem@davemloft.net) | ||
5 | */ | ||
6 | |||
7 | #include <linux/linkage.h> | ||
8 | #include <asm/asm.h> | ||
9 | |||
10 | .text | ||
11 | ENTRY(memcmp) | ||
12 | cmp %o2, 0 | ||
13 | 1: BRANCH32(be, pn, 2f) | ||
14 | nop | ||
15 | ldub [%o0], %g7 | ||
16 | ldub [%o1], %g3 | ||
17 | sub %o2, 1, %o2 | ||
18 | add %o0, 1, %o0 | ||
19 | add %o1, 1, %o1 | ||
20 | subcc %g7, %g3, %g3 | ||
21 | BRANCH32(be, pt, 1b) | ||
22 | cmp %o2, 0 | ||
23 | retl | ||
24 | mov %g3, %o0 | ||
25 | 2: retl | ||
26 | mov 0, %o0 | ||
27 | ENDPROC(memcmp) | ||
diff --git a/arch/sparc/lib/memcmp_32.S b/arch/sparc/lib/memcmp_32.S deleted file mode 100644 index 9e21f0282659..000000000000 --- a/arch/sparc/lib/memcmp_32.S +++ /dev/null | |||
@@ -1,30 +0,0 @@ | |||
1 | .text | ||
2 | .align 4 | ||
3 | .global __memcmp, memcmp | ||
4 | __memcmp: | ||
5 | memcmp: | ||
6 | cmp %o2, 0 | ||
7 | ble L3 | ||
8 | mov 0, %g3 | ||
9 | L5: | ||
10 | ldub [%o0], %g2 | ||
11 | ldub [%o1], %g3 | ||
12 | sub %g2, %g3, %g2 | ||
13 | mov %g2, %g3 | ||
14 | sll %g2, 24, %g2 | ||
15 | |||
16 | cmp %g2, 0 | ||
17 | bne L3 | ||
18 | add %o0, 1, %o0 | ||
19 | |||
20 | add %o2, -1, %o2 | ||
21 | |||
22 | cmp %o2, 0 | ||
23 | bg L5 | ||
24 | add %o1, 1, %o1 | ||
25 | L3: | ||
26 | sll %g3, 24, %o0 | ||
27 | sra %o0, 24, %o0 | ||
28 | |||
29 | retl | ||
30 | nop | ||
diff --git a/arch/sparc/lib/memcmp_64.S b/arch/sparc/lib/memcmp_64.S deleted file mode 100644 index d3fdaa898566..000000000000 --- a/arch/sparc/lib/memcmp_64.S +++ /dev/null | |||
@@ -1,28 +0,0 @@ | |||
1 | /* | ||
2 | * Sparc64 optimized memcmp code. | ||
3 | * | ||
4 | * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) | ||
5 | * Copyright (C) 2000 David S. Miller (davem@redhat.com) | ||
6 | */ | ||
7 | |||
8 | .text | ||
9 | .align 32 | ||
10 | .globl __memcmp, memcmp | ||
11 | __memcmp: | ||
12 | memcmp: | ||
13 | cmp %o2, 0 ! IEU1 Group | ||
14 | loop: be,pn %icc, ret_0 ! CTI | ||
15 | nop ! IEU0 | ||
16 | ldub [%o0], %g7 ! LSU Group | ||
17 | ldub [%o1], %g3 ! LSU Group | ||
18 | sub %o2, 1, %o2 ! IEU0 | ||
19 | add %o0, 1, %o0 ! IEU1 | ||
20 | add %o1, 1, %o1 ! IEU0 Group | ||
21 | subcc %g7, %g3, %g3 ! IEU1 Group | ||
22 | be,pt %icc, loop ! CTI | ||
23 | cmp %o2, 0 ! IEU1 Group | ||
24 | |||
25 | ret_n0: retl | ||
26 | mov %g3, %o0 | ||
27 | ret_0: retl | ||
28 | mov 0, %o0 | ||