L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
env
Go to the documentation of this file.
1// -*- Mode: C++ -*-
2// vim:ft=cpp
7/*
8 * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
9 * Alexander Warg <warg@os.inf.tu-dresden.de>,
10 * Björn Döbel <doebel@os.inf.tu-dresden.de>
11 * economic rights: Technische Universität Dresden (Germany)
12 *
13 * License: see LICENSE.spdx (in this directory or the directories above)
14 */
15#pragma once
16
17#include <l4/sys/types.h>
18
19#include <l4/re/rm>
20#include <l4/re/parent>
21#include <l4/re/mem_alloc>
22#include <l4/re/log>
23#include <l4/re/consts>
24
25#include <l4/re/env.h>
26
27namespace L4 {
28class Scheduler;
29}
30
34namespace L4Re
35{
36 class Itas;
37 struct Dbg_events;
38
79 {
80 private:
81 l4re_env_t _env;
82 public:
83
88
96 static Env const *env() noexcept
97 { return reinterpret_cast<Env*>(l4re_global_env); }
98
103 L4::Cap<Parent> parent() const noexcept
104 { return L4::Cap<Parent>(_env.parent); }
105
110 { return L4::Cap<Mem_alloc>(_env.mem_alloc); }
111
115 { return L4::Cap<L4::Factory>(_env.mem_alloc); }
116
120 L4::Cap<Rm> rm() const noexcept
121 { return L4::Cap<Rm>(_env.rm); }
122
130 L4::Cap<Log> log() const noexcept
131 { return L4::Cap<Log>(_env.log); }
132
137 { return L4::Cap<L4::Thread>(_env.main_thread); }
138
142 L4::Cap<L4::Task> task() const noexcept
143 { return L4::Cap<L4::Task>(L4RE_THIS_TASK_CAP); }
144
149 { return L4::Cap<L4::Factory>(_env.factory); }
150
159 { return _env.first_free_cap; }
160
169 { return _env.first_free_reply_cap; }
170
174 l4_fpage_t utcb_area() const noexcept
175 { return _env.utcb_area; }
176
183 l4_addr_t first_free_utcb() const noexcept
184 { return _env.first_free_utcb; }
185
190 Cap_entry const *initial_caps() const noexcept
191 { return _env.caps; }
192
201 Cap_entry const *get(char const *name, unsigned l) const noexcept
202 { return l4re_env_get_cap_l(name, l, &_env); }
203
212 template< typename T >
213 L4::Cap<T> get_cap(char const *name, unsigned l) const noexcept
214 {
215 if (Cap_entry const *e = get(name, l))
216 return L4::Cap<T>(e->cap);
217
218 return L4::Cap<T>(-L4_ENOENT);
219 }
220
227 template< typename T >
228 L4::Cap<T> get_cap(char const *name) const noexcept
229 { return get_cap<T>(name, __builtin_strlen(name)); }
230
235 void parent(L4::Cap<Parent> const &c) noexcept
236 { _env.parent = c.cap(); }
237
241 void mem_alloc(L4::Cap<Mem_alloc> const &c) noexcept
242 { _env.mem_alloc = c.cap(); }
243
247 void rm(L4::Cap<Rm> const &c) noexcept
248 { _env.rm = c.cap(); }
249
253 void log(L4::Cap<Log> const &c) noexcept
254 { _env.log = c.cap(); }
255
259 void main_thread(L4::Cap<L4::Thread> const &c) noexcept
260 { _env.main_thread = c.cap(); }
261
265 void factory(L4::Cap<L4::Factory> const &c) noexcept
266 { _env.factory = c.cap(); }
267
274 { _env.first_free_cap = c; }
275
282 { _env.first_free_reply_cap = c; }
283
287 void utcb_area(l4_fpage_t utcbs) noexcept
288 { _env.utcb_area = utcbs; }
289
293 void first_free_utcb(l4_addr_t u) noexcept
294 { _env.first_free_utcb = u; }
295
302 { return L4::Cap<L4::Scheduler>(_env.scheduler); }
303
308 void scheduler(L4::Cap<L4::Scheduler> const &c) noexcept
309 { _env.scheduler = c.cap(); }
310
320 L4::Cap<Itas> itas() const noexcept
321 { return L4::Cap<Itas>(_env.itas); }
322
327 void itas(L4::Cap<Itas> const &c) noexcept
328 { _env.itas = c.cap(); }
329
337 { return L4::Cap<Dbg_events>(_env.dbg_events); }
338
347 { _env.dbg_events = dbg_events.cap(); }
348
353 void initial_caps(Cap_entry *first) noexcept
354 { _env.caps = first; }
355 };
356};
C++ interface of the initial environment that is provided to an L4 task.
Definition env:79
L4::Cap< L4::Scheduler > scheduler() const noexcept
Get the scheduler capability for the task.
Definition env:301
void first_free_cap(l4_cap_idx_t c) noexcept
Set first available object capability index (not shifted by L4_CAP_SHIFT).
Definition env:273
Cap_entry const * get(char const *name, unsigned l) const noexcept
Get the Cap_entry for the object named name.
Definition env:201
static Env const * env() noexcept
Returns the initial environment for the current task.
Definition env:96
l4_cap_idx_t first_free_cap() const noexcept
First available object capability index (not shifted by L4_CAP_SHIFT).
Definition env:158
void scheduler(L4::Cap< L4::Scheduler > const &c) noexcept
Set the scheduler capability.
Definition env:308
L4::Cap< L4::Factory > factory() const noexcept
Object-capability to the factory object available to the task.
Definition env:148
L4::Cap< Mem_alloc > mem_alloc() const noexcept
Object-capability to the memory allocator.
Definition env:109
L4::Cap< L4::Factory > user_factory() const noexcept
Object-capability to the user-level object factory.
Definition env:114
void log(L4::Cap< Log > const &c) noexcept
Set log object-capability.
Definition env:253
L4::Cap< L4::Thread > main_thread() const noexcept
Object-capability of the first user thread.
Definition env:136
void mem_alloc(L4::Cap< Mem_alloc > const &c) noexcept
Set memory allocator object-capability.
Definition env:241
void factory(L4::Cap< L4::Factory > const &c) noexcept
Set factory object-capability.
Definition env:265
L4::Cap< T > get_cap(char const *name) const noexcept
Get the capability index for the object named name.
Definition env:228
l4re_env_cap_entry_t Cap_entry
C++ type for an entry in the initial objects array.
Definition env:87
void first_free_reply_cap(l4_umword_t c) noexcept
Set first available reply capability index (not shifted by L4_CAP_SHIFT).
Definition env:281
Cap_entry const * initial_caps() const noexcept
Get a pointer to the first entry in the initial objects array.
Definition env:190
L4::Cap< Log > log() const noexcept
Object-capability to the logging service.
Definition env:130
L4::Cap< Dbg_events > dbg_events() const noexcept
Object-capability to a debugger events service.
Definition env:336
void utcb_area(l4_fpage_t utcbs) noexcept
Set UTCB area of the task.
Definition env:287
void first_free_utcb(l4_addr_t u) noexcept
Set first free UTCB.
Definition env:293
L4::Cap< Rm > rm() const noexcept
Object-capability to the region map.
Definition env:120
void initial_caps(Cap_entry *first) noexcept
Set the pointer to the first Cap_entry in the initial objects array.
Definition env:353
l4_umword_t first_free_reply_cap() const noexcept
First available reply capability index (not shifted by L4_CAP_SHIFT).
Definition env:168
L4::Cap< T > get_cap(char const *name, unsigned l) const noexcept
Get the capability index for the object named name.
Definition env:213
L4::Cap< Itas > itas() const noexcept
Object-capability to the ITAS services.
Definition env:320
void rm(L4::Cap< Rm > const &c) noexcept
Set region map object-capability.
Definition env:247
void dbg_events(L4::Cap< Dbg_events > const &dbg_events) noexcept
Set the dbg_events capability.
Definition env:346
l4_addr_t first_free_utcb() const noexcept
First free UTCB.
Definition env:183
L4::Cap< Parent > parent() const noexcept
Object-capability to the parent.
Definition env:103
void itas(L4::Cap< Itas > const &c) noexcept
Set the ITAS capability.
Definition env:327
l4_fpage_t utcb_area() const noexcept
UTCB area of the task.
Definition env:174
void main_thread(L4::Cap< L4::Thread > const &c) noexcept
Set object-capability of first user thread.
Definition env:259
void parent(L4::Cap< Parent > const &c) noexcept
Set parent object-capability.
Definition env:235
L4::Cap< L4::Task > task() const noexcept
Object-capability of the user task.
Definition env:142
Interface to the ITAS.
Definition itas:34
C++ interface for capabilities.
Definition capability.h:249
C++ interface of the Scheduler kernel object, see Scheduler for the C interface.
Definition scheduler:49
Environment interface.
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:210
unsigned long l4_umword_t
Unsigned machine word.
Definition l4int.h:40
unsigned long l4_addr_t
Address type.
Definition l4int.h:34
unsigned long l4_cap_idx_t
Capability selector type.
Definition types.h:374
@ L4_ENOENT
No such entity.
Definition err.h:35
#define L4_EXPORT
Attribute to mark functions, variables, and data types as being exported from a library.
Definition compiler.h:220
Common L4 ABI Data Types.
Log interface.
Memory allocator interface.
L4Re C++ Interfaces.
Definition cmd_control:14
L4 low-level kernel interface.
Parent interface.
Constants.
Region mapper interface.
Entry in the L4Re environment array for the named initial objects.
Definition env.h:44
Initial environment data structure.
Definition env.h:115
L4 flexpage type.
Definition __l4_fpage.h:76