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
nexedi
linux
Commits
7a928ead
Commit
7a928ead
authored
Apr 20, 2004
by
Russell King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ARM] Add find_first_bit and find_next_bit.
parent
dfb9c436
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
1 deletion
+65
-1
arch/arm/lib/findbit.S
arch/arm/lib/findbit.S
+57
-0
include/asm-arm/bitops.h
include/asm-arm/bitops.h
+8
-1
No files found.
arch/arm/lib/findbit.S
View file @
7a928ead
...
...
@@ -51,6 +51,39 @@ ENTRY(_find_next_zero_bit_le)
add
r2
,
r2
,
#
1
@
align
bit
pointer
b
2
b
@
loop
for
next
bit
/*
*
Purpose
:
Find
a
'one'
bit
*
Prototype
:
int
find_first_bit
(
const
unsigned
long
*
addr
,
unsigned
int
maxbit
)
;
*/
ENTRY
(
_find_first_bit_le
)
teq
r1
,
#
0
beq
3
f
mov
r2
,
#
0
1
:
ldrb
r3
,
[
r0
,
r2
,
lsr
#
3
]
movs
r3
,
r3
bne
.
found
@
any
now
set
-
found
zero
bit
add
r2
,
r2
,
#
8
@
next
bit
pointer
2
:
cmp
r2
,
r1
@
any
more
?
blo
1
b
3
:
mov
r0
,
r1
@
no
free
bits
RETINSTR
(
mov
,
pc
,
lr
)
/*
*
Purpose
:
Find
next
'one'
bit
*
Prototype
:
int
find_next_zero_bit
(
void
*
addr
,
unsigned
int
maxbit
,
int
offset
)
*/
ENTRY
(
_find_next_bit_le
)
teq
r1
,
#
0
beq
2
b
ands
ip
,
r2
,
#
7
beq
1
b
@
If
new
byte
,
goto
old
routine
ldrb
r3
,
[
r0
,
r2
,
lsr
#
3
]
movs
r3
,
r3
,
lsr
ip
@
shift
off
unused
bits
bne
.
found
orr
r2
,
r2
,
#
7
@
if
zero
,
then
no
bits
here
add
r2
,
r2
,
#
1
@
align
bit
pointer
b
2
b
@
loop
for
next
bit
#ifdef __ARMEB__
ENTRY
(
_find_first_zero_bit_be
)
...
...
@@ -78,6 +111,30 @@ ENTRY(_find_next_zero_bit_be)
addeq
r2
,
r2
,
#
1
@
align
bit
pointer
beq
2
b
@
loop
for
next
bit
ENTRY
(
_find_first_bit_be
)
teq
r1
,
#
0
beq
3
f
mov
r2
,
#
0
1
:
eor
r3
,
r2
,
#
0x18
@
big
endian
byte
ordering
ldrb
r3
,
[
r0
,
r3
,
lsr
#
3
]
movs
r3
,
r3
bne
.
found
@
any
now
set
-
found
zero
bit
add
r2
,
r2
,
#
8
@
next
bit
pointer
2
:
cmp
r2
,
r1
@
any
more
?
blo
1
b
3
:
mov
r0
,
r1
@
no
free
bits
RETINSTR
(
mov
,
pc
,
lr
)
ENTRY
(
_find_next_bit_be
)
ands
ip
,
r2
,
#
7
beq
1
b
@
If
new
byte
,
goto
old
routine
eor
r3
,
r2
,
#
0x18
@
big
endian
byte
ordering
ldrb
r3
,
[
r0
,
r3
,
lsr
#
3
]
movs
r3
,
r3
,
lsr
ip
@
shift
off
unused
bits
orreq
r2
,
r2
,
#
7
@
if
zero
,
then
no
bits
here
addeq
r2
,
r2
,
#
1
@
align
bit
pointer
beq
2
b
@
loop
for
next
bit
#endif
/*
...
...
include/asm-arm/bitops.h
View file @
7a928ead
...
...
@@ -212,6 +212,8 @@ extern int _test_and_clear_bit_le(int nr, volatile unsigned long * p);
extern
int
_test_and_change_bit_le
(
int
nr
,
volatile
unsigned
long
*
p
);
extern
int
_find_first_zero_bit_le
(
void
*
p
,
unsigned
size
);
extern
int
_find_next_zero_bit_le
(
void
*
p
,
int
size
,
int
offset
);
extern
int
_find_first_bit_le
(
const
unsigned
long
*
p
,
unsigned
size
);
extern
int
_find_next_bit_le
(
const
unsigned
long
*
p
,
int
size
,
int
offset
);
/*
* Big endian assembly bitops. nr = 0 -> byte 3 bit 0.
...
...
@@ -224,7 +226,8 @@ extern int _test_and_clear_bit_be(int nr, volatile unsigned long * p);
extern
int
_test_and_change_bit_be
(
int
nr
,
volatile
unsigned
long
*
p
);
extern
int
_find_first_zero_bit_be
(
void
*
p
,
unsigned
size
);
extern
int
_find_next_zero_bit_be
(
void
*
p
,
int
size
,
int
offset
);
extern
int
_find_first_bit_be
(
const
unsigned
long
*
p
,
unsigned
size
);
extern
int
_find_next_bit_be
(
unsigned
long
*
p
,
int
size
,
int
offset
);
/*
* The __* form of bitops are non-atomic and may be reordered.
...
...
@@ -255,6 +258,8 @@ extern int _find_next_zero_bit_be(void * p, int size, int offset);
#define test_bit(nr,p) __test_bit(nr,p)
#define find_first_zero_bit(p,sz) _find_first_zero_bit_le(p,sz)
#define find_next_zero_bit(p,sz,off) _find_next_zero_bit_le(p,sz,off)
#define find_first_bit(p,sz) _find_first_bit_le(p,sz)
#define find_next_bit(p,sz,off) _find_next_bit_le(p,sz,off)
#define WORD_BITOFF_TO_LE(x) ((x))
...
...
@@ -272,6 +277,8 @@ extern int _find_next_zero_bit_be(void * p, int size, int offset);
#define test_bit(nr,p) __test_bit(nr,p)
#define find_first_zero_bit(p,sz) _find_first_zero_bit_be(p,sz)
#define find_next_zero_bit(p,sz,off) _find_next_zero_bit_be(p,sz,off)
#define find_first_bit(p,sz) _find_first_bit_be(p,sz)
#define find_next_bit(p,sz,off) _find_next_bit_be(p,sz,off)
#define WORD_BITOFF_TO_LE(x) ((x) ^ 0x18)
...
...
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