Skip to content

Commit

Permalink
x86, UML: remove x86-specific implementations of find_first_bit
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alexander van Heukelum authored and Ingo Molnar committed Apr 26, 2008
1 parent 3a48305 commit 5245698
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 193 deletions.
4 changes: 4 additions & 0 deletions arch/um/Kconfig.i386
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ config ARCH_REUSE_HOST_VSYSCALL_AREA
bool
default y

config GENERIC_FIND_FIRST_BIT
bool
default y

config GENERIC_FIND_NEXT_BIT
bool
default y
Expand Down
4 changes: 4 additions & 0 deletions arch/um/Kconfig.x86_64
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ config SMP_BROKEN
bool
default y

config GENERIC_FIND_FIRST_BIT
bool
default y

config GENERIC_FIND_NEXT_BIT
bool
default y
Expand Down
2 changes: 1 addition & 1 deletion arch/um/sys-i386/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ obj-y = bug.o bugs.o checksum.o delay.o fault.o ksyms.o ldt.o ptrace.o \
ptrace_user.o setjmp.o signal.o stub.o stub_segv.o syscalls.o sysrq.o \
sys_call_table.o tls.o

subarch-obj-y = lib/bitops_32.o lib/semaphore_32.o lib/string_32.o
subarch-obj-y = lib/semaphore_32.o lib/string_32.o
subarch-obj-$(CONFIG_HIGHMEM) += mm/highmem_32.o
subarch-obj-$(CONFIG_MODULES) += kernel/module_32.o

Expand Down
2 changes: 1 addition & 1 deletion arch/um/sys-x86_64/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ obj-y = bug.o bugs.o delay.o fault.o ldt.o mem.o ptrace.o ptrace_user.o \

obj-$(CONFIG_MODULES) += um_module.o

subarch-obj-y = lib/bitops_64.o lib/csum-partial_64.o lib/memcpy_64.o lib/thunk_64.o
subarch-obj-y = lib/csum-partial_64.o lib/memcpy_64.o lib/thunk_64.o
subarch-obj-$(CONFIG_MODULES) += kernel/module_64.o

ldt-y = ../sys-i386/ldt.o
Expand Down
1 change: 0 additions & 1 deletion arch/x86/lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ else

lib-y += csum-partial_64.o csum-copy_64.o csum-wrappers_64.o
lib-y += thunk_64.o clear_page_64.o copy_page_64.o
lib-y += bitops_64.o
lib-y += memmove_64.o memset_64.o
lib-y += copy_user_64.o rwlock_64.o copy_user_nocache_64.o
endif
109 changes: 0 additions & 109 deletions arch/x86/lib/bitops_64.c

This file was deleted.

58 changes: 0 additions & 58 deletions include/asm-x86/bitops_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,64 +4,6 @@
/*
* Copyright 1992, Linus Torvalds.
*/

#ifndef CONFIG_GENERIC_FIND_FIRST_BIT
/**
* find_first_zero_bit - find the first zero bit in a memory region
* @addr: The address to start the search at
* @size: The maximum size to search
*
* Returns the bit number of the first zero bit, not the number of the byte
* containing a bit.
*/
static inline int find_first_zero_bit(const unsigned long *addr, unsigned size)
{
int d0, d1, d2;
int res;

if (!size)
return 0;
/* This looks at memory.
* Mark it volatile to tell gcc not to move it around
*/
asm volatile("movl $-1,%%eax\n\t"
"xorl %%edx,%%edx\n\t"
"repe; scasl\n\t"
"je 1f\n\t"
"xorl -4(%%edi),%%eax\n\t"
"subl $4,%%edi\n\t"
"bsfl %%eax,%%edx\n"
"1:\tsubl %%ebx,%%edi\n\t"
"shll $3,%%edi\n\t"
"addl %%edi,%%edx"
: "=d" (res), "=&c" (d0), "=&D" (d1), "=&a" (d2)
: "1" ((size + 31) >> 5), "2" (addr),
"b" (addr) : "memory");
return res;
}

/**
* find_first_bit - find the first set bit in a memory region
* @addr: The address to start the search at
* @size: The maximum size to search
*
* Returns the bit number of the first set bit, not the number of the byte
* containing a bit.
*/
static inline unsigned find_first_bit(const unsigned long *addr, unsigned size)
{
unsigned x = 0;

while (x < size) {
unsigned long val = *addr++;
if (val)
return __ffs(val) + x;
x += sizeof(*addr) << 3;
}
return x;
}
#endif

#ifdef __KERNEL__

#include <asm-generic/bitops/sched.h>
Expand Down
23 changes: 0 additions & 23 deletions include/asm-x86/bitops_64.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,6 @@
/*
* Copyright 1992, Linus Torvalds.
*/

#ifndef CONFIG_GENERIC_FIND_FIRST_BIT
extern long find_first_zero_bit(const unsigned long *addr, unsigned long size);
extern long find_first_bit(const unsigned long *addr, unsigned long size);

/* return index of first bet set in val or max when no bit is set */
static inline long __scanbit(unsigned long val, unsigned long max)
{
asm("bsfq %1,%0 ; cmovz %2,%0" : "=&r" (val) : "r" (val), "r" (max));
return val;
}

#define find_first_bit(addr, size) \
((__builtin_constant_p((size)) && (size) <= BITS_PER_LONG \
? (__scanbit(*(unsigned long *)(addr), (size))) \
: find_first_bit((addr), (size))))

#define find_first_zero_bit(addr, size) \
((__builtin_constant_p((size)) && (size) <= BITS_PER_LONG \
? (__scanbit(~*(unsigned long *)(addr), (size))) \
: find_first_zero_bit((addr), (size))))
#endif

static inline void set_bit_string(unsigned long *bitmap, unsigned long i,
int len)
{
Expand Down

0 comments on commit 5245698

Please sign in to comment.