L4Re - L4 Runtime Environment
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Capabilities

Functions and definitions related to capabilities. More...

+ Collaboration diagram for Capabilities:

Data Structures

class  L4::Cap_base
 Base class for all kinds of capabilities. More...
class  L4::Cap< T >
 Capability Selector a la C++. More...

Typedefs

typedef unsigned long l4_cap_idx_t
 L4 Capability selector Type.

Enumerations

enum  l4_cap_consts_t { L4_CAP_SHIFT, L4_CAP_SIZE , L4_CAP_MASK, L4_INVALID_CAP }
 Constants related to capability selectors. More...
enum  l4_default_caps_t {
  L4_BASE_TASK_CAP, L4_BASE_FACTORY_CAP, L4_BASE_THREAD_CAP, L4_BASE_PAGER_CAP,
  L4_BASE_LOG_CAP, L4_BASE_ICU_CAP, L4_BASE_SCHEDULER_CAP
}
 Default capabilities setup for the initial tasks. More...

Functions

template<typename T , typename F >
Cap< T > L4::cap_cast (Cap< F > const &c) throw ()
 static_cast for capabilities.
template<typename T , typename F >
Cap< T > L4::cap_reinterpret_cast (Cap< F > const &c) throw ()
 reinterpret_cast for capabilities.
template<typename T , typename F >
Cap< T > L4::cap_dynamic_cast (Cap< F > const &c) throw ()
 dynamic_cast for capabilities.
unsigned l4_is_invalid_cap (l4_cap_idx_t c) L4_NOTHROW
 Test if a capability selector is the invalid capability.
unsigned l4_is_valid_cap (l4_cap_idx_t c) L4_NOTHROW
 Test if a capability selector is a valid selector.
unsigned l4_capability_equal (l4_cap_idx_t c1, l4_cap_idx_t c2) L4_NOTHROW
 Test if two capability selectors are equal.

Detailed Description

Functions and definitions related to capabilities.

#include <l4/sys/consts.h>

C++ interface for capabilities:
#include <l4/sys/capability>

C interface for capabilities:
#include <l4/sys/types.h>

Typedef Documentation

typedef unsigned long l4_cap_idx_t

L4 Capability selector Type.

#include <l4/sys/types.h>

Definition at line 319 of file types.h.

Enumeration Type Documentation

Constants related to capability selectors.

Enumerator:
L4_CAP_SHIFT 

Capability index shift.

L4_CAP_SIZE 

Offset of two consecutive capability selectors.

L4_CAP_MASK 

Mask to get only the relevant bits of an l4_cap_idx_t.

L4_INVALID_CAP 

Invalid capability selector.

Definition at line 134 of file consts.h.

Default capabilities setup for the initial tasks.

#include <l4/sys/consts.h>

These capability selectors are setup per default by the micro kernel for the two initial tasks, the Root-Pager (Sigma0) and the Root-Task (Moe).

Attention
This constants do not have any particular meaning for applications started by Moe, see Initial Environment for this kind of information.
See Also
Initial Environment for information useful for normal user applications.
Enumerator:
L4_BASE_TASK_CAP 

Capability selector for the current task.

L4_BASE_FACTORY_CAP 

Capability selector for the factory.

L4_BASE_THREAD_CAP 

Capability selector for the first thread.

L4_BASE_PAGER_CAP 

Capability selector for the pager gate.

L4_BASE_LOG_CAP 

Capability selector for the log object.

L4_BASE_ICU_CAP 

Capability selector for the base icu object.

L4_BASE_SCHEDULER_CAP 

Capability selector for the scheduler cap.

Definition at line 248 of file consts.h.

Function Documentation

template<typename T , typename F >
Cap<T> L4::cap_cast ( Cap< F > const &  c) throw ()
inline

static_cast for capabilities.

Parameters
Tis the target type of the capability
Fis the source type (and is usually implicitly set)
cis the source capability that shall be casted
Returns
A capability typed to the interface T.

The use of this cast operator is similar to the static_cast<>() for C++ pointers. It does the same type checking and adjustment like C++ does on pointers.

Example code:

Definition at line 343 of file capability.

Referenced by L4Re::Cap_alloc::alloc().

+ Here is the caller graph for this function:

template<typename T , typename F >
Cap<T> L4::cap_reinterpret_cast ( Cap< F > const &  c) throw ()
inline

reinterpret_cast for capabilities.

Parameters
Tis the target type of the capability
Fis the source type (and is usually implicitly set)
cis the source capability that shall be casted
Returns
A capability typed to the interface T.

The use of this cast operator is similar to the reinterpret_cast<>() for C++ pointers. It does not do any type checking or type adjustment.

Example code:

Definition at line 367 of file capability.

Referenced by L4::cap_dynamic_cast().

+ Here is the caller graph for this function:

template<typename T , typename F >
Cap<T> L4::cap_dynamic_cast ( Cap< F > const &  c) throw ()
inline

dynamic_cast for capabilities.

Parameters
Tis the target type of the capability
Fis the source type (and is usually implicitly set)
cis the source capability that shall be casted
Returns
A capability typed to the interface T. If the object does not support the target interface T or does not support the L4::Meta interface the result is the invalid capability selector.

The use of this cast operator is similar to the dynamic_cast<>() for C++ pointers. It also induces overhead, because it uses the meta interface (L4::Meta) to do runtime type checking.

Example code:

Definition at line 547 of file capability.

References L4::cap_reinterpret_cast(), and l4_error().

+ Here is the call graph for this function:

unsigned l4_is_invalid_cap ( l4_cap_idx_t  c)
inline

Test if a capability selector is the invalid capability.

Parameters
cCapability selector
Returns
Boolean value
Examples:
examples/libs/l4re/c/ma+rm.c, examples/sys/aliens/main.c, examples/sys/isr/main.c, examples/sys/singlestep/main.c, examples/sys/start-with-exc/main.c, and examples/sys/utcb-ipc/main.c.

Definition at line 350 of file types.h.

unsigned l4_is_valid_cap ( l4_cap_idx_t  c)
inline

Test if a capability selector is a valid selector.

Parameters
cCapability selector
Returns
Boolean value

Definition at line 354 of file types.h.

unsigned l4_capability_equal ( l4_cap_idx_t  c1,
l4_cap_idx_t  c2 
)
inline

Test if two capability selectors are equal.

Parameters
c1Capability
c2Capability
Returns
1 if equal, 0 if not equal

Definition at line 358 of file types.h.

References L4_CAP_SHIFT.

L4Re - L4 Runtime Environment