L4Re - L4 Runtime Environment
L4Re::Env Class Reference

C++ interface of the initial environment that is provided to an L4 task. More...

+ Collaboration diagram for L4Re::Env:

Public Types

typedef l4re_env_cap_entry_t Cap_entry
 C++ type for an entry in the initial objects array.
 

Public Member Functions

L4::Cap< Parentparent () const throw ()
 Object-capability to the parent. More...
 
L4::Cap< Mem_allocmem_alloc () const throw ()
 Object-capability to the memory allocator. More...
 
L4::Cap< L4::Factoryuser_factory () const throw ()
 Object-capability to the user-level object factory.
 
L4::Cap< Rmrm () const throw ()
 Object-capability to the region map. More...
 
L4::Cap< Loglog () const throw ()
 Object-capability to the logging service. More...
 
L4::Cap< L4::Threadmain_thread () const throw ()
 Object-capability of the first user thread. More...
 
L4::Cap< L4::Tasktask () const throw ()
 Object-capability of the user task. More...
 
L4::Cap< L4::Factoryfactory () const throw ()
 Object-capability to the factory object available to the task. More...
 
l4_cap_idx_t first_free_cap () const throw ()
 First available capability selector. More...
 
l4_fpage_t utcb_area () const throw ()
 UTCB area of the task. More...
 
l4_addr_t first_free_utcb () const throw ()
 First free UTCB. More...
 
Cap_entry const * initial_caps () const throw ()
 Get a pointer to the first entry in the initial objects array. More...
 
Cap_entry const * get (char const *name, unsigned l) const throw ()
 Get the Cap_entry for the object named name. More...
 
template<typename T >
L4::Cap< T > get_cap (char const *name, unsigned l) const throw ()
 Get the capability selector for the object named name. More...
 
template<typename T >
L4::Cap< T > get_cap (char const *name) const throw ()
 Get the capability selector for the object named name. More...
 
void parent (L4::Cap< Parent > const &c) throw ()
 Set parent object-capability. More...
 
void mem_alloc (L4::Cap< Mem_alloc > const &c) throw ()
 Set memory allocator object-capability. More...
 
void rm (L4::Cap< Rm > const &c) throw ()
 Set region map object-capability. More...
 
void log (L4::Cap< Log > const &c) throw ()
 Set log object-capability. More...
 
void main_thread (L4::Cap< L4::Thread > const &c) throw ()
 Set object-capability of first user thread. More...
 
void factory (L4::Cap< L4::Factory > const &c) throw ()
 Set factory object-capability. More...
 
void first_free_cap (l4_cap_idx_t c) throw ()
 Set first available capability selector. More...
 
void utcb_area (l4_fpage_t utcbs) throw ()
 Set UTCB area of the task. More...
 
void first_free_utcb (l4_addr_t u) throw ()
 Set first free UTCB. More...
 
L4::Cap< L4::Schedulerscheduler () const throw ()
 Get the scheduler capability for the task. More...
 
void scheduler (L4::Cap< L4::Scheduler > const &c) throw ()
 Set the scheduler capability. More...
 
void initial_caps (Cap_entry *first) throw ()
 Set the pointer to the first Cap_entry in the initial objects array. More...
 

Static Public Member Functions

static Env const * env () throw ()
 Returns the initial environment for the current task. More...
 

Detailed Description

C++ interface of the initial environment that is provided to an L4 task.

The initial environment is provided to each L4 task that is started by an L4Re conform loader, such as the Moe root task. The initial environment provides access to a set of initial capabilities and some additional information about the available resources, such as free UTCBs (see Virtual Registers ) and available entries in capability table (provided by the micro kernel).

Each of the initial capabilities is stored at a fixed index in the task's capability table and the L4 runtime environment provides convenience functions to retrieve the capabilities. See the table below for an comprehensive overview.

Name Object Type Convenience Function
parent L4Re::Parent L4Re::Env::parent()
user_factory L4::Factory L4Re::Env::user_factory()
log L4Re::Log L4Re::Env::log()
main_thread L4::Thread L4Re::Env::main_thread()
rm L4Re::Rm L4Re::Env::rm()
factory L4::Factory L4Re::Env::factory()
task L4::Task L4Re::Env::task()
scheduler L4::Scheduler L4Re::Env::scheduler()

Additional information found in the initial environment is:

  • First free entry in capability table
  • The UTCB area (as flex page)
  • First free UTCB (address in the UTCB area)
Include File
#include <l4/re/env>

For the C interface refer to Initial Environment.

Definition at line 82 of file env.

Member Function Documentation

◆ env()

static Env const* L4Re::Env::env ( )
throw (
)
inlinestatic

Returns the initial environment for the current task.

Returns
Pointer to the initial environment class.

A typical use of this function is L4Re::Env::env()-><member>()

Examples:
examples/clntsrv/client.cc, examples/libs/l4re/c++/mem_alloc/ma+rm.cc, examples/libs/l4re/c++/shared_ds/ds_clnt.cc, examples/libs/l4re/c++/shared_ds/ds_srv.cc, examples/libs/l4re/streammap/client.cc, and examples/sys/migrate/thread_migrate.cc.

Definition at line 100 of file env.

◆ factory() [1/2]

L4::Cap<L4::Factory> L4Re::Env::factory ( ) const
throw (
)
inline

Object-capability to the factory object available to the task.

Returns
Factory object-capability

Definition at line 148 of file env.

◆ factory() [2/2]

void L4Re::Env::factory ( L4::Cap< L4::Factory > const &  c)
throw (
)
inline

Set factory object-capability.

Parameters
cFactory object-capability

Definition at line 253 of file env.

◆ first_free_cap() [1/2]

l4_cap_idx_t L4Re::Env::first_free_cap ( ) const
throw (
)
inline

First available capability selector.

Returns
First capability selector.

First capability selector available for use for in the application.

Definition at line 156 of file env.

◆ first_free_cap() [2/2]

void L4Re::Env::first_free_cap ( l4_cap_idx_t  c)
throw (
)
inline

Set first available capability selector.

Parameters
cFirst capability selector available to the application.

Definition at line 259 of file env.

◆ first_free_utcb() [1/2]

l4_addr_t L4Re::Env::first_free_utcb ( ) const
throw (
)
inline

First free UTCB.

Returns
object-capability

First free UTCB within the UTCB area available for the application to use.

Definition at line 171 of file env.

◆ first_free_utcb() [2/2]

void L4Re::Env::first_free_utcb ( l4_addr_t  u)
throw (
)
inline

Set first free UTCB.

Parameters
uFirst UTCB available for the application to use.

Definition at line 271 of file env.

◆ get()

Cap_entry const* L4Re::Env::get ( char const *  name,
unsigned  l 
) const
throw (
)
inline

Get the Cap_entry for the object named name.

Parameters
nameis the name of the object.
lis the length of the name, thus name might not be zero terminated.
Returns
A pointer to the Cap_entry for the object named name, or NULL if no such object was found.

Definition at line 189 of file env.

◆ get_cap() [1/2]

template<typename T >
L4::Cap<T> L4Re::Env::get_cap ( char const *  name,
unsigned  l 
) const
throw (
)
inline

Get the capability selector for the object named name.

Parameters
nameis the name of the object.
lis the length of the name, thus name might not be zero terminated.
Returns
A capability selector for the object named name, or an invalid capability selector if no such object was found.
Examples:
examples/clntsrv/client.cc, examples/libs/l4re/c++/shared_ds/ds_clnt.cc, and examples/libs/l4re/streammap/client.cc.

Definition at line 201 of file env.

◆ get_cap() [2/2]

template<typename T >
L4::Cap<T> L4Re::Env::get_cap ( char const *  name) const
throw (
)
inline

Get the capability selector for the object named name.

Parameters
nameis the name of the object (zero terminated).
Returns
A capability selector for the object named name, or an invalid capability selector if no such object was found.

Definition at line 216 of file env.

◆ initial_caps() [1/2]

Cap_entry const* L4Re::Env::initial_caps ( ) const
throw (
)
inline

Get a pointer to the first entry in the initial objects array.

Returns
A pointer to the first entry in the initial objects array.

Definition at line 178 of file env.

◆ initial_caps() [2/2]

void L4Re::Env::initial_caps ( Cap_entry first)
throw (
)
inline

Set the pointer to the first Cap_entry in the initial objects array.

Parameters
firstis the first element in the array.

Definition at line 293 of file env.

◆ log() [1/2]

L4::Cap<Log> L4Re::Env::log ( ) const
throw (
)
inline

Object-capability to the logging service.

Returns
Log object-capability

Definition at line 130 of file env.

◆ log() [2/2]

void L4Re::Env::log ( L4::Cap< Log > const &  c)
throw (
)
inline

Set log object-capability.

Parameters
cLog object-capability

Definition at line 241 of file env.

◆ main_thread() [1/2]

L4::Cap<L4::Thread> L4Re::Env::main_thread ( ) const
throw (
)
inline

Object-capability of the first user thread.

Returns
Object-capability of the first user thread.

Definition at line 136 of file env.

◆ main_thread() [2/2]

void L4Re::Env::main_thread ( L4::Cap< L4::Thread > const &  c)
throw (
)
inline

Set object-capability of first user thread.

Parameters
cFirst thread's object-capability

Definition at line 247 of file env.

◆ mem_alloc() [1/2]

L4::Cap<Mem_alloc> L4Re::Env::mem_alloc ( ) const
throw (
)
inline

Object-capability to the memory allocator.

Returns
Memory allocator object-capability
Examples:
examples/libs/l4re/c++/shared_ds/ds_srv.cc.

Definition at line 113 of file env.

◆ mem_alloc() [2/2]

void L4Re::Env::mem_alloc ( L4::Cap< Mem_alloc > const &  c)
throw (
)
inline

Set memory allocator object-capability.

Parameters
cMemory allocator object-capability

Definition at line 229 of file env.

◆ parent() [1/2]

L4::Cap<Parent> L4Re::Env::parent ( ) const
throw (
)
inline

Object-capability to the parent.

Returns
Parent object-capability

Definition at line 107 of file env.

◆ parent() [2/2]

void L4Re::Env::parent ( L4::Cap< Parent > const &  c)
throw (
)
inline

Set parent object-capability.

Parameters
cParent object-capability

Definition at line 223 of file env.

◆ rm() [1/2]

L4::Cap<Rm> L4Re::Env::rm ( ) const
throw (
)
inline

Object-capability to the region map.

Returns
Region map object-capability
Examples:
examples/libs/l4re/c++/shared_ds/ds_clnt.cc, and examples/libs/l4re/c++/shared_ds/ds_srv.cc.

Definition at line 124 of file env.

◆ rm() [2/2]

void L4Re::Env::rm ( L4::Cap< Rm > const &  c)
throw (
)
inline

Set region map object-capability.

Parameters
cRegion map object-capability

Definition at line 235 of file env.

◆ scheduler() [1/2]

L4::Cap<L4::Scheduler> L4Re::Env::scheduler ( ) const
throw (
)
inline

Get the scheduler capability for the task.

Returns
The capability selector for the default scheduler used for this task.
Examples:
examples/sys/migrate/thread_migrate.cc.

Definition at line 279 of file env.

◆ scheduler() [2/2]

void L4Re::Env::scheduler ( L4::Cap< L4::Scheduler > const &  c)
throw (
)
inline

Set the scheduler capability.

Parameters
cis the capability to be set as scheduler.

Definition at line 286 of file env.

◆ task()

L4::Cap<L4::Task> L4Re::Env::task ( ) const
throw (
)
inline

Object-capability of the user task.

Returns
Object-capability of the user task.

Definition at line 142 of file env.

◆ utcb_area() [1/2]

l4_fpage_t L4Re::Env::utcb_area ( ) const
throw (
)
inline

UTCB area of the task.

Returns
UTCB area

Definition at line 162 of file env.

◆ utcb_area() [2/2]

void L4Re::Env::utcb_area ( l4_fpage_t  utcbs)
throw (
)
inline

Set UTCB area of the task.

Parameters
utcbsUTCB area

Definition at line 265 of file env.


The documentation for this class was generated from the following file: