L4Re - L4 Runtime Environment
Utility Functions

Utilities, generic file. More...

+ Collaboration diagram for Utility Functions:

Modules

 Atomic Instructions
 
 Bit Manipulation
 
 Bitmap graphics and fonts
 This library provides some functions for bitmap handling in frame buffers.
 
 CPU related functions
 
 Comfortable Command Line Parsing
 
 ELF binary format
 Functions and types related to ELF binaries.
 
 Functions to manipulate the local IDT
 
 IA32 Port I/O API
 
 Internal functions
 
 Kernel Interface Page API
 
 Low-Level Thread Functions
 
 Machine Restarting Function
 
 Random number support
 
 Timestamp Counter
 

Files

file  rand.h
 Simple Pseudo-Random Number Generator.
 

Functions

void l4_sleep_forever (void) L4_NOTHROW)
 Go sleep and never wake up.
 
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. More...
 
l4_addr_t l4util_splitlog2_size (l4_addr_t start, l4_addr_t end)
 Return log2 base and size aligned length of a range. More...
 
l4_timeout_s l4util_micros2l4to (unsigned int mus) L4_NOTHROW
 Calculate l4 timeouts. More...
 
void l4_sleep (int ms) L4_NOTHROW
 Suspend thread for a period of ms milliseconds. More...
 
void l4_usleep (int us) L4_NOTHROW
 Suspend thread for a period of us microseconds. More...
 
void l4_touch_ro (const void *addr, unsigned size) L4_NOTHROW
 Touch data area to force mapping (read-only) More...
 
void l4_touch_rw (const void *addr, unsigned size) L4_NOTHROW
 Touch data areas to force mapping (read-write) More...
 

Detailed Description

Utilities, generic file.

Function Documentation

◆ l4_sleep()

void l4_sleep ( int  ms)

Suspend thread for a period of ms milliseconds.

Parameters
msTime in milliseconds

◆ l4_touch_ro()

void l4_touch_ro ( const void *  addr,
unsigned  size 
)
inline

Touch data area to force mapping (read-only)

Parameters
addrStart of memory area to touch.
sizeSize of area to touch.
Examples:
examples/sys/singlestep/main.c.

Definition at line 94 of file util.h.

References L4_PAGESIZE, and l4_trunc_page().

Referenced by l4_sleep_forever().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ l4_touch_rw()

void l4_touch_rw ( const void *  addr,
unsigned  size 
)
inline

Touch data areas to force mapping (read-write)

Parameters
addrStart of memory area to touch.
sizeSize of area to touch.
Examples:
examples/sys/aliens/main.c, and examples/sys/singlestep/main.c.

Definition at line 107 of file util.h.

References EXTERN_C_END, L4_PAGESIZE, and l4_trunc_page().

Referenced by l4_sleep_forever().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ l4_usleep()

void l4_usleep ( int  us)

Suspend thread for a period of us microseconds.

Parameters
usTime in microseconds

WARNING: This function is mostly bogus since the timer resolution of current L4 implementations is about 1ms!

◆ l4util_micros2l4to()

l4_timeout_s l4util_micros2l4to ( unsigned int  mus)

Calculate l4 timeouts.

Parameters
mustime in microseconds. Special cases:
  • 0 - > timeout 0
  • ~0U -> timeout NEVER
Returns
the corresponding l4_timeout value

◆ l4util_splitlog2_hdl()

long l4util_splitlog2_hdl ( l4_addr_t  start,
l4_addr_t  end,
long(*)(l4_addr_t s, l4_addr_t e, int log2size)  handler 
)
inline

Split a range into log2 base and size aligned chunks.

Parameters
startStart of range
endEnd of range (inclusive) (e.g. 2-4 is len 3)
handlerHandler function that is called with start and end (both inclusive) of the chunk. On success, the handler must return 0, if it returns !=0 the function will immediately return with the return code of the handler.
Returns
0 on success, != 0 otherwise

Definition at line 53 of file splitlog2.h.

References L4_EINVAL, and l4util_splitlog2_size().

+ Here is the call graph for this function:

◆ l4util_splitlog2_size()

l4_addr_t l4util_splitlog2_size ( l4_addr_t  start,
l4_addr_t  end 
)
inline

Return log2 base and size aligned length of a range.

Parameters
startStart of range
endEnd of range (inclusive) (e.g. 2-4 is len 3)
Returns
length of elements in log2size (length is 1 << log2size)

Definition at line 72 of file splitlog2.h.

References l4util_bsf(), and l4util_bsr().

Referenced by l4util_splitlog2_hdl().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: