Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
295b4cb6
Commit
295b4cb6
authored
Jun 08, 2004
by
David S. Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SPARC64]: Uninline find_*_bit() like ia64 did.
parent
686b4f33
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
135 additions
and
111 deletions
+135
-111
arch/sparc64/kernel/sparc64_ksyms.c
arch/sparc64/kernel/sparc64_ksyms.c
+5
-0
arch/sparc64/lib/Makefile
arch/sparc64/lib/Makefile
+2
-1
arch/sparc64/lib/find_bit.c
arch/sparc64/lib/find_bit.c
+125
-0
include/asm-sparc64/bitops.h
include/asm-sparc64/bitops.h
+3
-110
No files found.
arch/sparc64/kernel/sparc64_ksyms.c
View file @
295b4cb6
...
...
@@ -189,6 +189,11 @@ EXPORT_SYMBOL(___test_and_change_bit);
EXPORT_SYMBOL
(
___test_and_set_le_bit
);
EXPORT_SYMBOL
(
___test_and_clear_le_bit
);
/* Bit searching */
EXPORT_SYMBOL
(
find_next_bit
);
EXPORT_SYMBOL
(
find_next_zero_bit
);
EXPORT_SYMBOL
(
find_next_zero_le_bit
);
EXPORT_SYMBOL
(
ivector_table
);
EXPORT_SYMBOL
(
enable_irq
);
EXPORT_SYMBOL
(
disable_irq
);
...
...
arch/sparc64/lib/Makefile
View file @
295b4cb6
...
...
@@ -10,7 +10,8 @@ lib-y := PeeCeeI.o blockops.o strlen.o strncmp.o \
VIScopy.o VISbzero.o VISmemset.o VIScsum.o VIScsumcopy.o
\
VIScsumcopyusr.o VISsave.o atomic.o rwlock.o bitops.o
\
U3memcpy.o U3copy_from_user.o U3copy_to_user.o
\
U3copy_in_user.o mcount.o ipcsum.o rwsem.o xor.o splock.o
U3copy_in_user.o mcount.o ipcsum.o rwsem.o xor.o splock.o
\
find_bit.o
lib-$(CONFIG_DEBUG_SPINLOCK)
+=
debuglocks.o
lib-$(CONFIG_HAVE_DEC_LOCK)
+=
dec_and_lock.o
arch/sparc64/lib/find_bit.c
0 → 100644
View file @
295b4cb6
#include <asm/bitops.h>
/**
* find_next_bit - find the next set bit in a memory region
* @addr: The address to base the search on
* @offset: The bitnumber to start searching at
* @size: The maximum size to search
*/
unsigned
long
find_next_bit
(
unsigned
long
*
addr
,
unsigned
long
size
,
unsigned
long
offset
)
{
unsigned
long
*
p
=
addr
+
(
offset
>>
6
);
unsigned
long
result
=
offset
&
~
63UL
;
unsigned
long
tmp
;
if
(
offset
>=
size
)
return
size
;
size
-=
result
;
offset
&=
63UL
;
if
(
offset
)
{
tmp
=
*
(
p
++
);
tmp
&=
(
~
0UL
<<
offset
);
if
(
size
<
64
)
goto
found_first
;
if
(
tmp
)
goto
found_middle
;
size
-=
64
;
result
+=
64
;
}
while
(
size
&
~
63UL
)
{
if
((
tmp
=
*
(
p
++
)))
goto
found_middle
;
result
+=
64
;
size
-=
64
;
}
if
(
!
size
)
return
result
;
tmp
=
*
p
;
found_first:
tmp
&=
(
~
0UL
>>
(
64
-
size
));
if
(
tmp
==
0UL
)
/* Are any bits set? */
return
result
+
size
;
/* Nope. */
found_middle:
return
result
+
__ffs
(
tmp
);
}
/* find_next_zero_bit() finds the first zero bit in a bit string of length
* 'size' bits, starting the search at bit 'offset'. This is largely based
* on Linus's ALPHA routines, which are pretty portable BTW.
*/
unsigned
long
find_next_zero_bit
(
unsigned
long
*
addr
,
unsigned
long
size
,
unsigned
long
offset
)
{
unsigned
long
*
p
=
addr
+
(
offset
>>
6
);
unsigned
long
result
=
offset
&
~
63UL
;
unsigned
long
tmp
;
if
(
offset
>=
size
)
return
size
;
size
-=
result
;
offset
&=
63UL
;
if
(
offset
)
{
tmp
=
*
(
p
++
);
tmp
|=
~
0UL
>>
(
64
-
offset
);
if
(
size
<
64
)
goto
found_first
;
if
(
~
tmp
)
goto
found_middle
;
size
-=
64
;
result
+=
64
;
}
while
(
size
&
~
63UL
)
{
if
(
~
(
tmp
=
*
(
p
++
)))
goto
found_middle
;
result
+=
64
;
size
-=
64
;
}
if
(
!
size
)
return
result
;
tmp
=
*
p
;
found_first:
tmp
|=
~
0UL
<<
size
;
if
(
tmp
==
~
0UL
)
/* Are any bits zero? */
return
result
+
size
;
/* Nope. */
found_middle:
return
result
+
ffz
(
tmp
);
}
unsigned
long
find_next_zero_le_bit
(
unsigned
long
*
addr
,
unsigned
long
size
,
unsigned
long
offset
)
{
unsigned
long
*
p
=
addr
+
(
offset
>>
6
);
unsigned
long
result
=
offset
&
~
63UL
;
unsigned
long
tmp
;
if
(
offset
>=
size
)
return
size
;
size
-=
result
;
offset
&=
63UL
;
if
(
offset
)
{
tmp
=
__swab64p
(
p
++
);
tmp
|=
(
~
0UL
>>
(
64
-
offset
));
if
(
size
<
64
)
goto
found_first
;
if
(
~
tmp
)
goto
found_middle
;
size
-=
64
;
result
+=
64
;
}
while
(
size
&
~
63
)
{
if
(
~
(
tmp
=
__swab64p
(
p
++
)))
goto
found_middle
;
result
+=
64
;
size
-=
64
;
}
if
(
!
size
)
return
result
;
tmp
=
__swab64p
(
p
);
found_first:
tmp
|=
(
~
0UL
<<
size
);
if
(
tmp
==
~
0UL
)
/* Are any bits zero? */
return
result
+
size
;
/* Nope. */
found_middle:
return
result
+
ffz
(
tmp
);
}
include/asm-sparc64/bitops.h
View file @
295b4cb6
...
...
@@ -204,43 +204,7 @@ static __inline__ unsigned int hweight8(unsigned int w)
* @offset: The bitnumber to start searching at
* @size: The maximum size to search
*/
static
__inline__
unsigned
long
find_next_bit
(
unsigned
long
*
addr
,
unsigned
long
size
,
unsigned
long
offset
)
{
unsigned
long
*
p
=
addr
+
(
offset
>>
6
);
unsigned
long
result
=
offset
&
~
63UL
;
unsigned
long
tmp
;
if
(
offset
>=
size
)
return
size
;
size
-=
result
;
offset
&=
63UL
;
if
(
offset
)
{
tmp
=
*
(
p
++
);
tmp
&=
(
~
0UL
<<
offset
);
if
(
size
<
64
)
goto
found_first
;
if
(
tmp
)
goto
found_middle
;
size
-=
64
;
result
+=
64
;
}
while
(
size
&
~
63UL
)
{
if
((
tmp
=
*
(
p
++
)))
goto
found_middle
;
result
+=
64
;
size
-=
64
;
}
if
(
!
size
)
return
result
;
tmp
=
*
p
;
found_first:
tmp
&=
(
~
0UL
>>
(
64
-
size
));
if
(
tmp
==
0UL
)
/* Are any bits set? */
return
result
+
size
;
/* Nope. */
found_middle:
return
result
+
__ffs
(
tmp
);
}
extern
unsigned
long
find_next_bit
(
unsigned
long
*
,
unsigned
long
,
unsigned
long
);
/**
* find_first_bit - find the first set bit in a memory region
...
...
@@ -258,43 +222,7 @@ static __inline__ unsigned long find_next_bit(unsigned long *addr, unsigned long
* on Linus's ALPHA routines, which are pretty portable BTW.
*/
static
__inline__
unsigned
long
find_next_zero_bit
(
unsigned
long
*
addr
,
unsigned
long
size
,
unsigned
long
offset
)
{
unsigned
long
*
p
=
addr
+
(
offset
>>
6
);
unsigned
long
result
=
offset
&
~
63UL
;
unsigned
long
tmp
;
if
(
offset
>=
size
)
return
size
;
size
-=
result
;
offset
&=
63UL
;
if
(
offset
)
{
tmp
=
*
(
p
++
);
tmp
|=
~
0UL
>>
(
64
-
offset
);
if
(
size
<
64
)
goto
found_first
;
if
(
~
tmp
)
goto
found_middle
;
size
-=
64
;
result
+=
64
;
}
while
(
size
&
~
63UL
)
{
if
(
~
(
tmp
=
*
(
p
++
)))
goto
found_middle
;
result
+=
64
;
size
-=
64
;
}
if
(
!
size
)
return
result
;
tmp
=
*
p
;
found_first:
tmp
|=
~
0UL
<<
size
;
if
(
tmp
==
~
0UL
)
/* Are any bits zero? */
return
result
+
size
;
/* Nope. */
found_middle:
return
result
+
ffz
(
tmp
);
}
extern
unsigned
long
find_next_zero_bit
(
unsigned
long
*
,
unsigned
long
,
unsigned
long
);
#define find_first_zero_bit(addr, size) \
find_next_zero_bit((addr), (size), 0)
...
...
@@ -320,42 +248,7 @@ static __inline__ int test_le_bit(int nr, __const__ unsigned long * addr)
#define find_first_zero_le_bit(addr, size) \
find_next_zero_le_bit((addr), (size), 0)
static
__inline__
unsigned
long
find_next_zero_le_bit
(
unsigned
long
*
addr
,
unsigned
long
size
,
unsigned
long
offset
)
{
unsigned
long
*
p
=
addr
+
(
offset
>>
6
);
unsigned
long
result
=
offset
&
~
63UL
;
unsigned
long
tmp
;
if
(
offset
>=
size
)
return
size
;
size
-=
result
;
offset
&=
63UL
;
if
(
offset
)
{
tmp
=
__swab64p
(
p
++
);
tmp
|=
(
~
0UL
>>
(
64
-
offset
));
if
(
size
<
64
)
goto
found_first
;
if
(
~
tmp
)
goto
found_middle
;
size
-=
64
;
result
+=
64
;
}
while
(
size
&
~
63
)
{
if
(
~
(
tmp
=
__swab64p
(
p
++
)))
goto
found_middle
;
result
+=
64
;
size
-=
64
;
}
if
(
!
size
)
return
result
;
tmp
=
__swab64p
(
p
);
found_first:
tmp
|=
(
~
0UL
<<
size
);
if
(
tmp
==
~
0UL
)
/* Are any bits zero? */
return
result
+
size
;
/* Nope. */
found_middle:
return
result
+
ffz
(
tmp
);
}
extern
unsigned
long
find_next_zero_le_bit
(
unsigned
long
*
,
unsigned
long
,
unsigned
long
);
#ifdef __KERNEL__
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment