Loading...
Searching...
No Matches
env
Go to the documentation of this file.
// -*- Mode: C++ -*-
// vim:ft=cpp
/*
* (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
* Alexander Warg <warg@os.inf.tu-dresden.de>,
* Björn Döbel <doebel@os.inf.tu-dresden.de>
* economic rights: Technische Universität Dresden (Germany)
*
* License: see LICENSE.spdx (in this directory or the directories above)
*/
#pragma once
#include <l4/sys/types.h>
#include <l4/re/rm>
#include <l4/re/parent>
#include <l4/re/mem_alloc>
#include <l4/re/log>
#include <l4/re/consts>
#include <l4/re/env.h>
namespace L4 {
class Scheduler;
}
namespace L4Re
{
class Itas;
struct Dbg_events;
class L4_EXPORT Env
{
private:
l4re_env_t _env;
public:
typedef l4re_env_cap_entry_t Cap_entry;
static Env const *env() noexcept
{ return reinterpret_cast< Env*>(l4re_global_env); }
L4::Cap<Parent> parent() const noexcept
{ return L4::Cap<Parent>(_env.parent); }
L4::Cap<Mem_alloc> mem_alloc() const noexcept
{ return L4::Cap<Mem_alloc>(_env.mem_alloc); }
L4::Cap<L4::Factory> user_factory() const noexcept
{ return L4::Cap<L4::Factory>(_env.mem_alloc); }
L4::Cap<Rm> rm() const noexcept
{ return L4::Cap<Rm>(_env.rm); }
L4::Cap<Log> log() const noexcept
{ return L4::Cap<Log>(_env.log); }
L4::Cap<L4::Thread> main_thread() const noexcept
{ return L4::Cap<L4::Thread>(_env.main_thread); }
L4::Cap<L4::Task> task() const noexcept
{ return L4::Cap<L4::Task>(L4RE_THIS_TASK_CAP); }
L4::Cap<L4::Factory> factory() const noexcept
{ return L4::Cap<L4::Factory>(_env.factory); }
l4_cap_idx_t first_free_cap() const noexcept
{ return _env.first_free_cap; }
l4_fpage_t utcb_area() const noexcept
{ return _env.utcb_area; }
l4_addr_t first_free_utcb() const noexcept
{ return _env.first_free_utcb; }
Cap_entry const *initial_caps() const noexcept
{ return _env.caps; }
Cap_entry const *get(char const *name, unsigned l) const noexcept
{ return l4re_env_get_cap_l(name, l, &_env); }
template< typename T >
L4::Cap<T> get_cap(char const *name, unsigned l) const noexcept
{
if (Cap_entry const *e = get(name, l))
return L4::Cap<T>(e->cap);
return L4::Cap<T>(-L4_ENOENT);
}
template< typename T >
L4::Cap<T> get_cap(char const *name) const noexcept
{ return get_cap<T>(name, __builtin_strlen(name)); }
void parent(L4::Cap<Parent> const &c) noexcept
{ _env.parent = c.cap(); }
void mem_alloc(L4::Cap<Mem_alloc> const &c) noexcept
{ _env.mem_alloc = c.cap(); }
void rm(L4::Cap<Rm> const &c) noexcept
{ _env.rm = c.cap(); }
void log(L4::Cap<Log> const &c) noexcept
{ _env.log = c.cap(); }
void main_thread(L4::Cap<L4::Thread> const &c) noexcept
{ _env.main_thread = c.cap(); }
void factory(L4::Cap<L4::Factory> const &c) noexcept
{ _env.factory = c.cap(); }
void first_free_cap(l4_cap_idx_t c) noexcept
{ _env.first_free_cap = c; }
void utcb_area(l4_fpage_t utcbs) noexcept
{ _env.utcb_area = utcbs; }
void first_free_utcb(l4_addr_t u) noexcept
{ _env.first_free_utcb = u; }
L4::Cap<L4::Scheduler> scheduler() const noexcept
{ return L4::Cap<L4::Scheduler>(_env.scheduler); }
void scheduler(L4::Cap<L4::Scheduler> const &c) noexcept
{ _env.scheduler = c.cap(); }
L4::Cap<Itas> itas() const noexcept
{ return L4::Cap<Itas>(_env.itas); }
void itas(L4::Cap<Itas> const &c) noexcept
{ _env.itas = c.cap(); }
L4::Cap<Dbg_events> dbg_events() const noexcept
{ return L4::Cap<Dbg_events>(_env.dbg_events); }
void dbg_events(L4::Cap<Dbg_events> const &dbg_events) noexcept
{ _env.dbg_events = dbg_events.cap(); }
void initial_caps(Cap_entry *first) noexcept
{ _env.caps = first; }
};
};
L4Re::Env
C++ interface of the initial environment that is provided to an L4 task.
Definition env:79
L4Re::Env::scheduler
L4::Cap< L4::Scheduler > scheduler() const noexcept
Get the scheduler capability for the task.
Definition env:275
L4Re::Env::first_free_cap
void first_free_cap(l4_cap_idx_t c) noexcept
Set first available capability selector.
Definition env:255
L4Re::Env::get
Cap_entry const * get(char const *name, unsigned l) const noexcept
Get the Cap_entry for the object named name.
Definition env:185
L4Re::Env::env
static Env const * env() noexcept
Returns the initial environment for the current task.
Definition env:96
L4Re::Env::first_free_cap
l4_cap_idx_t first_free_cap() const noexcept
First available capability selector.
Definition env:152
L4Re::Env::scheduler
void scheduler(L4::Cap< L4::Scheduler > const &c) noexcept
Set the scheduler capability.
Definition env:282
L4Re::Env::factory
L4::Cap< L4::Factory > factory() const noexcept
Object-capability to the factory object available to the task.
Definition env:144
L4Re::Env::mem_alloc
L4::Cap< Mem_alloc > mem_alloc() const noexcept
Object-capability to the memory allocator.
Definition env:109
L4Re::Env::user_factory
L4::Cap< L4::Factory > user_factory() const noexcept
Object-capability to the user-level object factory.
Definition env:114
L4Re::Env::log
void log(L4::Cap< Log > const &c) noexcept
Set log object-capability.
Definition env:237
L4Re::Env::main_thread
L4::Cap< L4::Thread > main_thread() const noexcept
Object-capability of the first user thread.
Definition env:132
L4Re::Env::mem_alloc
void mem_alloc(L4::Cap< Mem_alloc > const &c) noexcept
Set memory allocator object-capability.
Definition env:225
L4Re::Env::factory
void factory(L4::Cap< L4::Factory > const &c) noexcept
Set factory object-capability.
Definition env:249
L4Re::Env::get_cap
L4::Cap< T > get_cap(char const *name) const noexcept
Get the capability selector for the object named name.
Definition env:212
L4Re::Env::Cap_entry
l4re_env_cap_entry_t Cap_entry
C++ type for an entry in the initial objects array.
Definition env:87
L4Re::Env::initial_caps
Cap_entry const * initial_caps() const noexcept
Get a pointer to the first entry in the initial objects array.
Definition env:174
L4Re::Env::log
L4::Cap< Log > log() const noexcept
Object-capability to the logging service.
Definition env:126
L4Re::Env::dbg_events
L4::Cap< Dbg_events > dbg_events() const noexcept
Object-capability to a debugger events service.
Definition env:310
L4Re::Env::utcb_area
void utcb_area(l4_fpage_t utcbs) noexcept
Set UTCB area of the task.
Definition env:261
L4Re::Env::first_free_utcb
void first_free_utcb(l4_addr_t u) noexcept
Set first free UTCB.
Definition env:267
L4Re::Env::rm
L4::Cap< Rm > rm() const noexcept
Object-capability to the region map.
Definition env:120
L4Re::Env::initial_caps
void initial_caps(Cap_entry *first) noexcept
Set the pointer to the first Cap_entry in the initial objects array.
Definition env:327
L4Re::Env::get_cap
L4::Cap< T > get_cap(char const *name, unsigned l) const noexcept
Get the capability selector for the object named name.
Definition env:197
L4Re::Env::itas
L4::Cap< Itas > itas() const noexcept
Object-capability to the ITAS services.
Definition env:294
L4Re::Env::rm
void rm(L4::Cap< Rm > const &c) noexcept
Set region map object-capability.
Definition env:231
L4Re::Env::dbg_events
void dbg_events(L4::Cap< Dbg_events > const &dbg_events) noexcept
Set the dbg_events capability.
Definition env:320
L4Re::Env::first_free_utcb
l4_addr_t first_free_utcb() const noexcept
First free UTCB.
Definition env:167
L4Re::Env::parent
L4::Cap< Parent > parent() const noexcept
Object-capability to the parent.
Definition env:103
L4Re::Env::itas
void itas(L4::Cap< Itas > const &c) noexcept
Set the ITAS capability.
Definition env:301
L4Re::Env::utcb_area
l4_fpage_t utcb_area() const noexcept
UTCB area of the task.
Definition env:158
L4Re::Env::main_thread
void main_thread(L4::Cap< L4::Thread > const &c) noexcept
Set object-capability of first user thread.
Definition env:243
L4Re::Env::parent
void parent(L4::Cap< Parent > const &c) noexcept
Set parent object-capability.
Definition env:219
L4Re::Env::task
L4::Cap< L4::Task > task() const noexcept
Object-capability of the user task.
Definition env:138
L4Re::Itas
Interface to the ITAS.
Definition itas:34
L4::Cap
C++ interface for capabilities.
Definition capability.h:224
L4::Scheduler
C++ interface of the Scheduler kernel object, see Scheduler for the C interface.
Definition scheduler:49
env.h
Environment interface.
l4re_env_get_cap_l
l4re_env_cap_entry_t const * l4re_env_get_cap_l(char const *name, unsigned l, l4re_env_t const *e) L4_NOTHROW
Get the full l4re_env_cap_entry_t for the object named name.
Definition env.h:189
l4_addr_t
unsigned long l4_addr_t
Address type.
Definition l4int.h:34
l4_cap_idx_t
unsigned long l4_cap_idx_t
Capability selector type.
Definition types.h:336
L4_ENOENT
@ L4_ENOENT
No such entity.
Definition err.h:34
L4_EXPORT
#define L4_EXPORT
Attribute to mark functions, variables, and data types as being exported from a library.
Definition compiler.h:214
types.h
Common L4 ABI Data Types.
log
Log interface.
mem_alloc
Memory allocator interface.
L4Re
L4Re C++ Interfaces.
Definition cmd_control:14
L4
L4 low-level kernel interface.
Definition l4sys-l4f-groups.dox:50
parent
Parent interface.
consts
Constants.
rm
Region mapper interface.
l4re_env_cap_entry_t
Entry in the L4Re environment array for the named initial objects.
Definition env.h:40
l4re_env_t
Initial environment data structure.
Definition env.h:99
l4_fpage_t
L4 flexpage type.
Definition __l4_fpage.h:76