L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
L4Re::Env Class Reference

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

#include <env>

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

Static Public Member Functions

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

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>
Environment interface.

For an explanation of the default task capabilites see l4_default_caps_t.

For the C interface refer to Initial Environment.

Definition at line 85 of file env.

Member Function Documentation

◆ env()

static Env const * L4Re::Env::env ( )
inlinestaticnoexcept

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 103 of file env.

Referenced by L4virtio::Svr::Dev_config::Dev_config(), L4virtio::Driver::Device::driver_connect(), L4virtio::Driver::Virtio_net_device::setup_device(), and L4virtio::Driver::Block_device::setup_device().

+ Here is the caller graph for this function:

◆ factory() [1/2]

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

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

Returns
Factory object-capability

Definition at line 151 of file env.

References l4re_env_t::factory.

◆ factory() [2/2]

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

Set factory object-capability.

Parameters
cFactory object-capability

Definition at line 256 of file env.

References l4re_env_t::factory.

◆ first_free_cap() [1/2]

l4_cap_idx_t L4Re::Env::first_free_cap ( ) const
inlinenoexcept

First available capability selector.

Returns
First capability selector.

First capability selector available for use for in the application.

Definition at line 159 of file env.

References l4re_env_t::first_free_cap.

◆ first_free_cap() [2/2]

void L4Re::Env::first_free_cap ( l4_cap_idx_t  c)
inlinenoexcept

Set first available capability selector.

Parameters
cFirst capability selector available to the application.

Definition at line 262 of file env.

References l4re_env_t::first_free_cap.

◆ first_free_utcb() [1/2]

l4_addr_t L4Re::Env::first_free_utcb ( ) const
inlinenoexcept

First free UTCB.

Returns
object-capability

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

Definition at line 174 of file env.

References l4re_env_t::first_free_utcb.

◆ first_free_utcb() [2/2]

void L4Re::Env::first_free_utcb ( l4_addr_t  u)
inlinenoexcept

Set first free UTCB.

Parameters
uFirst UTCB available for the application to use.

Definition at line 274 of file env.

References l4re_env_t::first_free_utcb.

◆ get()

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

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 192 of file env.

References l4re_env_get_cap_l().

+ Here is the call graph for this function:

◆ get_cap() [1/2]

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

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 219 of file env.

◆ get_cap() [2/2]

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

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 204 of file env.

References L4_ENOENT.

◆ initial_caps() [1/2]

Cap_entry const * L4Re::Env::initial_caps ( ) const
inlinenoexcept

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 181 of file env.

References l4re_env_t::caps.

◆ initial_caps() [2/2]

void L4Re::Env::initial_caps ( Cap_entry first)
inlinenoexcept

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

Parameters
firstis the first element in the array.

Definition at line 296 of file env.

References l4re_env_t::caps.

◆ log() [1/2]

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

Object-capability to the logging service.

Returns
Log object-capability

Definition at line 133 of file env.

References l4re_env_t::log.

◆ log() [2/2]

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

Set log object-capability.

Parameters
cLog object-capability

Definition at line 244 of file env.

References l4re_env_t::log.

◆ main_thread() [1/2]

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

Object-capability of the first user thread.

Returns
Object-capability of the first user thread.

Definition at line 139 of file env.

References l4re_env_t::main_thread.

◆ main_thread() [2/2]

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

Set object-capability of first user thread.

Parameters
cFirst thread's object-capability

Definition at line 250 of file env.

References l4re_env_t::main_thread.

◆ mem_alloc() [1/2]

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

Object-capability to the memory allocator.

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

Definition at line 116 of file env.

References l4re_env_t::mem_alloc.

◆ mem_alloc() [2/2]

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

Set memory allocator object-capability.

Parameters
cMemory allocator object-capability

Definition at line 232 of file env.

References l4re_env_t::mem_alloc.

◆ parent() [1/2]

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

Object-capability to the parent.

Returns
Parent object-capability

Definition at line 110 of file env.

References l4re_env_t::parent.

◆ parent() [2/2]

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

Set parent object-capability.

Parameters
cParent object-capability

Definition at line 226 of file env.

References l4re_env_t::parent.

◆ rm() [1/2]

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

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 127 of file env.

References l4re_env_t::rm.

◆ rm() [2/2]

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

Set region map object-capability.

Parameters
cRegion map object-capability

Definition at line 238 of file env.

References l4re_env_t::rm.

◆ scheduler() [1/2]

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

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 282 of file env.

References l4re_env_t::scheduler.

◆ scheduler() [2/2]

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

Set the scheduler capability.

Parameters
cis the capability to be set as scheduler.

Definition at line 289 of file env.

References l4re_env_t::scheduler.

◆ task()

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

Object-capability of the user task.

Returns
Object-capability of the user task.

Definition at line 145 of file env.

◆ utcb_area() [1/2]

l4_fpage_t L4Re::Env::utcb_area ( ) const
inlinenoexcept

UTCB area of the task.

Returns
UTCB area

Definition at line 165 of file env.

References l4re_env_t::utcb_area.

◆ utcb_area() [2/2]

void L4Re::Env::utcb_area ( l4_fpage_t  utcbs)
inlinenoexcept

Set UTCB area of the task.

Parameters
utcbsUTCB area

Definition at line 268 of file env.

References l4re_env_t::utcb_area.


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