L4Re Operating System Framework
Interface and Usage Documentation
Toggle main menu visibility
Main Page
Related Pages
Topics
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
h
i
k
m
o
p
r
s
t
u
w
Functions
a
b
c
k
m
r
s
t
w
Variables
Typedefs
Enumerations
Enumerator
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
Data Fields
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
~
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
~
Variables
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Typedefs
_
a
b
c
d
e
f
g
i
k
m
n
o
p
r
s
t
v
w
Enumerations
a
c
d
e
f
i
m
n
p
q
r
s
t
v
Enumerator
a
b
c
d
e
f
g
i
k
l
m
n
o
p
r
s
t
u
w
x
Related Symbols
Files
File List
Globals
All
_
a
b
d
e
f
g
l
m
n
o
p
r
s
Functions
_
b
e
f
g
l
o
p
Variables
Typedefs
e
g
l
p
Enumerations
e
l
p
Enumerator
a
d
e
f
l
n
p
r
s
Macros
_
e
g
l
m
p
s
Examples
•
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
Loading...
Searching...
No Matches
splitlog2.h
Go to the documentation of this file.
1
5
/*
6
* (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>
7
* economic rights: Technische Universität Dresden (Germany)
8
* License: see LICENSE.spdx (in this directory or the directories above)
9
*/
10
#ifndef __L4UTIL__INCLUDE__SPLITLOG2_H__
11
#define __L4UTIL__INCLUDE__SPLITLOG2_H__
12
13
#include <l4/sys/linkage.h>
14
#include <
l4/sys/err.h
>
15
#include <
l4/util/bitops.h
>
16
17
L4_BEGIN_DECLS
18
31
L4_INLINE
long
32
l4util_splitlog2_hdl
(
l4_addr_t
start,
l4_addr_t
end,
33
long
(*handler)(
l4_addr_t
s,
l4_addr_t
e,
int
log2size));
34
43
L4_INLINE
l4_addr_t
44
l4util_splitlog2_size
(
l4_addr_t
start,
l4_addr_t
end);
45
46
L4_END_DECLS
47
48
/* Implementation */
49
50
L4_INLINE
long
51
l4util_splitlog2_hdl
(
l4_addr_t
start,
l4_addr_t
end,
52
long
(*handler)(
l4_addr_t
s,
l4_addr_t
e,
int
log2size))
53
{
54
if
(end < start)
55
return
-
L4_EINVAL
;
56
57
while
(start <= end)
58
{
59
long
retval;
60
int
len2 =
l4util_splitlog2_size
(start, end);
61
l4_addr_t
len = 1UL << len2;
62
if
((retval = handler(start, start + len - 1, len2)))
63
return
retval;
64
start += len;
65
}
66
return
0;
67
}
51
l4util_splitlog2_hdl
(
l4_addr_t
start,
l4_addr_t
end, {
…
}
68
69
L4_INLINE
l4_addr_t
70
l4util_splitlog2_size
(
l4_addr_t
start,
l4_addr_t
end)
71
{
72
int
start_bits = l4util_bsf(start);
73
int
len_bits = l4util_bsr(end - start + 1);
74
if
(start_bits != -1 && len_bits > start_bits)
75
len_bits = start_bits;
76
77
return
len_bits;
78
}
70
l4util_splitlog2_size
(
l4_addr_t
start,
l4_addr_t
end) {
…
}
79
80
#endif
/* ! __L4UTIL__INCLUDE__SPLITLOG2_H__ */
bitops.h
bit manipulation functions
err.h
Error codes.
l4_addr_t
unsigned long l4_addr_t
Address type.
Definition
l4int.h:34
L4_EINVAL
@ L4_EINVAL
Invalid argument.
Definition
err.h:46
L4_INLINE
#define L4_INLINE
L4 Inline function attribute.
Definition
compiler.h:51
L4_BEGIN_DECLS
#define L4_BEGIN_DECLS
Start section with C types and functions.
Definition
compiler.h:165
L4_END_DECLS
#define L4_END_DECLS
End section with C types and functions.
Definition
compiler.h:166
l4util_splitlog2_size
l4_addr_t l4util_splitlog2_size(l4_addr_t start, l4_addr_t end)
Return log2 base and size aligned length of a range.
Definition
splitlog2.h:70
l4util_splitlog2_hdl
L4_BEGIN_DECLS long l4util_splitlog2_hdl(l4_addr_t start, l4_addr_t end, long(*handler)(l4_addr_t s, l4_addr_t e, int log2size))
Split a range into log2 base and size aligned chunks.
Definition
splitlog2.h:51
l4
util
splitlog2.h
Generated on Thu Jul 10 2025 20:08:04 for L4Re Operating System Framework by
1.9.8