L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
env.h
Go to the documentation of this file.
1
5/*
6 * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
7 * Alexander Warg <warg@os.inf.tu-dresden.de>
8 * economic rights: Technische Universität Dresden (Germany)
9 *
10 * License: see LICENSE.spdx (in this directory or the directories above)
11 */
12#pragma once
13
14#include <l4/sys/consts.h>
15#include <l4/sys/types.h>
16#include <l4/sys/kip.h>
17#include <l4/sys/compiler.h>
18
19#include <l4/re/consts.h>
20
21#ifdef __cplusplus
22#include <l4/cxx/string>
23#endif
24
38
44{
49
55
59 char name[16];
60#ifdef __cplusplus
61
66
75 : cap(c), flags(f)
76 {
77 for (unsigned i = 0; n && i < sizeof(name); ++i, ++n)
78 {
79 name[i] = *n;
80 if (!*n)
81 break;
82 }
83 }
84
85 static bool is_valid_name(char const *n) L4_NOTHROW
86 {
87 for (unsigned i = 0; *n; ++i, ++n)
88 if (i > sizeof(name))
89 return false;
90
91 return true;
92 }
93
94 cxx::String get_name() const noexcept
95 {
96 unsigned len = 0;
97 while (len < sizeof(name) && name[len] != '\0')
98 ++len;
99
100 return cxx::String(name, len);
101 }
102#endif
104
105
133
139extern l4re_env_t *l4re_global_env;
140
141
148
149/*
150 * FIXME: this seems to be at the wrong place here
151 */
158
159
168l4re_env_get_cap(char const *name) L4_NOTHROW;
169
179l4re_env_get_cap_e(char const *name, l4re_env_t const *e) L4_NOTHROW;
180
192l4re_env_get_cap_l(char const *name, unsigned l, l4re_env_t const *e) L4_NOTHROW;
193
196{ return l4re_global_env; }
197
200{ return l4_kip(); }
201
203l4re_env_get_cap_l(char const *name, unsigned l, l4re_env_t const *e) L4_NOTHROW
204{
205 l4re_env_cap_entry_t const *c = e->caps;
206 for (; c && c->flags != ~0UL; ++c)
207 {
208 unsigned i;
209 for (i = 0;
210 i < sizeof(c->name) && i < l && c->name[i] && name[i] && name[i] == c->name[i];
211 ++i)
212 ;
213
214 if (i == l && (i == sizeof(c->name) || !c->name[i]))
215 return c;
216 }
217 return NULL;
218}
219
221l4re_env_get_cap_e(char const *name, l4re_env_t const *e) L4_NOTHROW
222{
223 unsigned l;
224 l4re_env_cap_entry_t const *r;
225 for (l = 0; name[l]; ++l) ;
226 r = l4re_env_get_cap_l(name, l, e);
227 if (r)
228 return r->cap;
229
230 return L4_INVALID_CAP;
231}
232
235{ return l4re_env_get_cap_e(name, l4re_env()); }
236
L4 compiler related defines.
l4_cap_idx_t l4re_env_get_cap(char const *name) L4_NOTHROW
Get the capability selector for the object named name.
Definition env.h:234
l4_cap_idx_t l4re_env_get_cap_e(char const *name, l4re_env_t const *e) L4_NOTHROW
Get the capability selector for the object named name.
Definition env.h:221
l4_kernel_info_t const * l4re_kip(void) L4_NOTHROW
Get Kernel Info Page.
Definition env.h:199
l4re_env_t * l4re_env(void) L4_NOTHROW
Get L4Re initial environment.
Definition env.h:195
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:203
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:357
l4_kernel_info_t const * l4_kip(void) L4_NOTHROW
Get Kernel Info Page.
Definition kip.h:226
#define L4_NOTHROW
Mark a function declaration and definition as never throwing an exception.
Definition compiler.h:167
#define L4_INLINE
L4 Inline function attribute.
Definition compiler.h:51
Constants.
Common constants.
#define L4_INVALID_CAP
Invalid capability selector.
Definition consts.h:152
Kernel Info Page access functions.
Common L4 ABI Data Types.
L4 Kernel Interface Page.
Definition kip.h:37
Entry in the L4Re environment array for the named initial objects.
Definition env.h:44
l4re_env_cap_entry_t() L4_NOTHROW
Create an invalid entry.
Definition env.h:65
l4_cap_idx_t cap
The capability selector for the object.
Definition env.h:48
char name[16]
The name of the object.
Definition env.h:59
l4re_env_cap_entry_t(char const *n, l4_cap_idx_t c, l4_umword_t f=0) L4_NOTHROW
Create an entry with the name n, capability c, and flags f.
Definition env.h:74
l4_umword_t flags
Flags for the object.
Definition env.h:54
Initial environment data structure.
Definition env.h:112
l4_cap_idx_t factory
Object-capability of the factory available to the task.
Definition env.h:118
l4_umword_t first_free_reply_cap
First reply capability index available to the application.
Definition env.h:123
l4_cap_idx_t mem_alloc
Memory allocator object-capability.
Definition env.h:115
l4_cap_idx_t scheduler
Object capability for the scheduler set to use.
Definition env.h:119
l4_cap_idx_t rm
Region map object-capability.
Definition env.h:114
l4_addr_t first_free_utcb
First UTCB within the UTCB area available to the application.
Definition env.h:125
l4_cap_idx_t first_free_cap
First capability index available to the application.
Definition env.h:122
l4_cap_idx_t itas
ITAS services object-capability.
Definition env.h:120
l4_cap_idx_t dbg_events
Object-capability of the debug events service.
Definition env.h:121
l4re_env_cap_entry_t * caps
Pointer to the first entry in the initial objects array which contains l4re_env_cap_entry_t elements.
Definition env.h:131
l4_cap_idx_t main_thread
Object-capability of the first user thread.
Definition env.h:117
l4_fpage_t utcb_area
UTCB area of the task.
Definition env.h:124
l4_cap_idx_t parent
Parent object-capability.
Definition env.h:113
l4_cap_idx_t log
Logging object-capability.
Definition env.h:116
L4 flexpage type.
Definition __l4_fpage.h:76