L4Re Operating System Framework
Interface and Usage Documentation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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
40{
45
51
55 char name[16];
56#ifdef __cplusplus
57
62
71 : cap(c), flags(f)
72 {
73 for (unsigned i = 0; n && i < sizeof(name); ++i, ++n)
74 {
75 name[i] = *n;
76 if (!*n)
77 break;
78 }
79 }
80
81 static bool is_valid_name(char const *n) L4_NOTHROW
82 {
83 for (unsigned i = 0; *n; ++i, ++n)
84 if (i > sizeof(name))
85 return false;
86
87 return true;
88 }
89#endif
91
92
119
125extern l4re_env_t *l4re_global_env;
126
127
134
135/*
136 * FIXME: this seems to be at the wrong place here
137 */
144
145
154l4re_env_get_cap(char const *name) L4_NOTHROW;
155
165l4re_env_get_cap_e(char const *name, l4re_env_t const *e) L4_NOTHROW;
166
178l4re_env_get_cap_l(char const *name, unsigned l, l4re_env_t const *e) L4_NOTHROW;
179
182{ return l4re_global_env; }
183
186{ return l4_kip(); }
187
189l4re_env_get_cap_l(char const *name, unsigned l, l4re_env_t const *e) L4_NOTHROW
190{
191 l4re_env_cap_entry_t const *c = e->caps;
192 for (; c && c->flags != ~0UL; ++c)
193 {
194 unsigned i;
195 for (i = 0;
196 i < sizeof(c->name) && i < l && c->name[i] && name[i] && name[i] == c->name[i];
197 ++i)
198 ;
199
200 if (i == l && (i == sizeof(c->name) || !c->name[i]))
201 return c;
202 }
203 return NULL;
204}
205
207l4re_env_get_cap_e(char const *name, l4re_env_t const *e) L4_NOTHROW
208{
209 unsigned l;
210 l4re_env_cap_entry_t const *r;
211 for (l = 0; name[l]; ++l) ;
212 r = l4re_env_get_cap_l(name, l, e);
213 if (r)
214 return r->cap;
215
216 return L4_INVALID_CAP;
217}
218
221{ return l4re_env_get_cap_e(name, l4re_env()); }
222
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:220
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:207
l4_kernel_info_t const * l4re_kip(void) L4_NOTHROW
Get Kernel Info Page.
Definition env.h:185
l4re_env_t * l4re_env(void) L4_NOTHROW
Get L4Re initial environment.
Definition env.h:181
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
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:335
@ L4_INVALID_CAP
Invalid capability selector.
Definition consts.h:153
l4_kernel_info_t const * l4_kip(void) L4_NOTHROW
Get Kernel Info Page.
Definition kip.h:184
#define L4_NOTHROW
Mark a function declaration and definition as never throwing an exception.
Definition compiler.h:159
#define L4_INLINE
L4 Inline function attribute.
Definition compiler.h:51
Constants.
Common L4 ABI Data Types.
L4 Kernel Interface Page.
Definition __kip-32bit.h:28
Entry in the L4Re environment array for the named initial objects.
Definition env.h:40
l4re_env_cap_entry_t() L4_NOTHROW
Create an invalid entry.
Definition env.h:61
l4_cap_idx_t cap
The capability selector for the object.
Definition env.h:44
char name[16]
The name of the object.
Definition env.h:55
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:70
l4_umword_t flags
Flags for the object.
Definition env.h:50
Initial environment data structure.
Definition env.h:99
l4_cap_idx_t factory
Object-capability of the factory available to the task.
Definition env.h:105
l4_cap_idx_t mem_alloc
Memory allocator object-capability.
Definition env.h:102
l4_cap_idx_t scheduler
Object capability for the scheduler set to use.
Definition env.h:106
l4_cap_idx_t rm
Region map object-capability.
Definition env.h:101
l4_addr_t first_free_utcb
First UTCB within the UTCB area available to the application.
Definition env.h:111
l4_cap_idx_t first_free_cap
First capability index available to the application.
Definition env.h:109
l4_cap_idx_t itas
ITAS services object-capability.
Definition env.h:107
l4_cap_idx_t dbg_events
Object-capability of the debug events service.
Definition env.h:108
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:117
l4_cap_idx_t main_thread
Object-capability of the first user thread.
Definition env.h:104
l4_fpage_t utcb_area
UTCB area of the task.
Definition env.h:110
l4_cap_idx_t parent
Parent object-capability.
Definition env.h:100
l4_cap_idx_t log
Logging object-capability.
Definition env.h:103
Kernel Info Page access functions.
L4 flexpage type.
Definition __l4_fpage.h:76