aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAlexander van Heukelum <heukelum@mailshack.com>2008-04-01 11:47:57 -0400
committerIngo Molnar <mingo@elte.hu>2008-04-26 13:21:17 -0400
commit5245698f665c4b7a533dcc47a5afdf33095d436a (patch)
tree5e417154f181e523c8491ec263eb71fbaf8ec0da /arch
parent3a48305028aa38afba93fc05066c71a6ee668ad8 (diff)
x86, UML: remove x86-specific implementations of find_first_bit
x86 has been switched to the generic versions of find_first_bit and find_first_zero_bit, but the original versions were retained. This patch just removes the now unused x86-specific versions. also update UML. Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r--arch/um/Kconfig.i3864
-rw-r--r--arch/um/Kconfig.x86_644
-rw-r--r--arch/um/sys-i386/Makefile2
-rw-r--r--arch/um/sys-x86_64/Makefile2
-rw-r--r--arch/x86/lib/Makefile1
-rw-r--r--arch/x86/lib/bitops_64.c109
6 files changed, 10 insertions, 112 deletions
diff --git a/arch/um/Kconfig.i386 b/arch/um/Kconfig.i386
index be7556028291..49990ea422e4 100644
--- a/arch/um/Kconfig.i386
+++ b/arch/um/Kconfig.i386
@@ -39,6 +39,10 @@ config ARCH_REUSE_HOST_VSYSCALL_AREA
39 bool 39 bool
40 default y 40 default y
41 41
42config GENERIC_FIND_FIRST_BIT
43 bool
44 default y
45
42config GENERIC_FIND_NEXT_BIT 46config GENERIC_FIND_NEXT_BIT
43 bool 47 bool
44 default y 48 default y
diff --git a/arch/um/Kconfig.x86_64 b/arch/um/Kconfig.x86_64
index 4ab5aa62ff3f..cc42e59585d2 100644
--- a/arch/um/Kconfig.x86_64
+++ b/arch/um/Kconfig.x86_64
@@ -34,6 +34,10 @@ config SMP_BROKEN
34 bool 34 bool
35 default y 35 default y
36 36
37config GENERIC_FIND_FIRST_BIT
38 bool
39 default y
40
37config GENERIC_FIND_NEXT_BIT 41config GENERIC_FIND_NEXT_BIT
38 bool 42 bool
39 default y 43 default y
diff --git a/arch/um/sys-i386/Makefile b/arch/um/sys-i386/Makefile
index 964dc1a04c37..598b5c1903af 100644
--- a/arch/um/sys-i386/Makefile
+++ b/arch/um/sys-i386/Makefile
@@ -6,7 +6,7 @@ obj-y = bug.o bugs.o checksum.o delay.o fault.o ksyms.o ldt.o ptrace.o \
6 ptrace_user.o setjmp.o signal.o stub.o stub_segv.o syscalls.o sysrq.o \ 6 ptrace_user.o setjmp.o signal.o stub.o stub_segv.o syscalls.o sysrq.o \
7 sys_call_table.o tls.o 7 sys_call_table.o tls.o
8 8
9subarch-obj-y = lib/bitops_32.o lib/semaphore_32.o lib/string_32.o 9subarch-obj-y = lib/semaphore_32.o lib/string_32.o
10subarch-obj-$(CONFIG_HIGHMEM) += mm/highmem_32.o 10subarch-obj-$(CONFIG_HIGHMEM) += mm/highmem_32.o
11subarch-obj-$(CONFIG_MODULES) += kernel/module_32.o 11subarch-obj-$(CONFIG_MODULES) += kernel/module_32.o
12 12
diff --git a/arch/um/sys-x86_64/Makefile b/arch/um/sys-x86_64/Makefile
index 3c22de532088..c8b4cce9cfe1 100644
--- a/arch/um/sys-x86_64/Makefile
+++ b/arch/um/sys-x86_64/Makefile
@@ -10,7 +10,7 @@ obj-y = bug.o bugs.o delay.o fault.o ldt.o mem.o ptrace.o ptrace_user.o \
10 10
11obj-$(CONFIG_MODULES) += um_module.o 11obj-$(CONFIG_MODULES) += um_module.o
12 12
13subarch-obj-y = lib/bitops_64.o lib/csum-partial_64.o lib/memcpy_64.o lib/thunk_64.o 13subarch-obj-y = lib/csum-partial_64.o lib/memcpy_64.o lib/thunk_64.o
14subarch-obj-$(CONFIG_MODULES) += kernel/module_64.o 14subarch-obj-$(CONFIG_MODULES) += kernel/module_64.o
15 15
16ldt-y = ../sys-i386/ldt.o 16ldt-y = ../sys-i386/ldt.o
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
index 436093299bd3..76f60f52a885 100644
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@ -21,7 +21,6 @@ else
21 21
22 lib-y += csum-partial_64.o csum-copy_64.o csum-wrappers_64.o 22 lib-y += csum-partial_64.o csum-copy_64.o csum-wrappers_64.o
23 lib-y += thunk_64.o clear_page_64.o copy_page_64.o 23 lib-y += thunk_64.o clear_page_64.o copy_page_64.o
24 lib-y += bitops_64.o
25 lib-y += memmove_64.o memset_64.o 24 lib-y += memmove_64.o memset_64.o
26 lib-y += copy_user_64.o rwlock_64.o copy_user_nocache_64.o 25 lib-y += copy_user_64.o rwlock_64.o copy_user_nocache_64.o
27endif 26endif
diff --git a/arch/x86/lib/bitops_64.c b/arch/x86/lib/bitops_64.c
deleted file mode 100644
index 568467d390c0..000000000000
--- a/arch/x86/lib/bitops_64.c
+++ /dev/null
@@ -1,109 +0,0 @@
1#ifndef CONFIG_GENERIC_FIND_FIRST_BIT
2#include <linux/bitops.h>
3
4#undef find_first_zero_bit
5#undef find_first_bit
6
7static inline long
8__find_first_zero_bit(const unsigned long * addr, unsigned long size)
9{
10 long d0, d1, d2;
11 long res;
12
13 /*
14 * We must test the size in words, not in bits, because
15 * otherwise incoming sizes in the range -63..-1 will not run
16 * any scasq instructions, and then the flags used by the je
17 * instruction will have whatever random value was in place
18 * before. Nobody should call us like that, but
19 * find_next_zero_bit() does when offset and size are at the
20 * same word and it fails to find a zero itself.
21 */
22 size += 63;
23 size >>= 6;
24 if (!size)
25 return 0;
26 asm volatile(
27 " repe; scasq\n"
28 " je 1f\n"
29 " xorq -8(%%rdi),%%rax\n"
30 " subq $8,%%rdi\n"
31 " bsfq %%rax,%%rdx\n"
32 "1: subq %[addr],%%rdi\n"
33 " shlq $3,%%rdi\n"
34 " addq %%rdi,%%rdx"
35 :"=d" (res), "=&c" (d0), "=&D" (d1), "=&a" (d2)
36 :"0" (0ULL), "1" (size), "2" (addr), "3" (-1ULL),
37 [addr] "S" (addr) : "memory");
38 /*
39 * Any register would do for [addr] above, but GCC tends to
40 * prefer rbx over rsi, even though rsi is readily available
41 * and doesn't have to be saved.
42 */
43 return res;
44}
45
46/**
47 * find_first_zero_bit - find the first zero bit in a memory region
48 * @addr: The address to start the search at
49 * @size: The maximum size to search
50 *
51 * Returns the bit-number of the first zero bit, not the number of the byte
52 * containing a bit.
53 */
54long find_first_zero_bit(const unsigned long * addr, unsigned long size)
55{
56 return __find_first_zero_bit (addr, size);
57}
58
59static inline long
60__find_first_bit(const unsigned long * addr, unsigned long size)
61{
62 long d0, d1;
63 long res;
64
65 /*
66 * We must test the size in words, not in bits, because
67 * otherwise incoming sizes in the range -63..-1 will not run
68 * any scasq instructions, and then the flags used by the jz
69 * instruction will have whatever random value was in place
70 * before. Nobody should call us like that, but
71 * find_next_bit() does when offset and size are at the same
72 * word and it fails to find a one itself.
73 */
74 size += 63;
75 size >>= 6;
76 if (!size)
77 return 0;
78 asm volatile(
79 " repe; scasq\n"
80 " jz 1f\n"
81 " subq $8,%%rdi\n"
82 " bsfq (%%rdi),%%rax\n"
83 "1: subq %[addr],%%rdi\n"
84 " shlq $3,%%rdi\n"
85 " addq %%rdi,%%rax"
86 :"=a" (res), "=&c" (d0), "=&D" (d1)
87 :"0" (0ULL), "1" (size), "2" (addr),
88 [addr] "r" (addr) : "memory");
89 return res;
90}
91
92/**
93 * find_first_bit - find the first set bit in a memory region
94 * @addr: The address to start the search at
95 * @size: The maximum size to search
96 *
97 * Returns the bit-number of the first set bit, not the number of the byte
98 * containing a bit.
99 */
100long find_first_bit(const unsigned long * addr, unsigned long size)
101{
102 return __find_first_bit(addr,size);
103}
104
105#include <linux/module.h>
106
107EXPORT_SYMBOL(find_first_bit);
108EXPORT_SYMBOL(find_first_zero_bit);
109#endif