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
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
118
124extern l4re_env_t *l4re_global_env;
125
126
133
134/*
135 * FIXME: this seems to be at the wrong place here
136 */
143
144
153l4re_env_get_cap(char const *name) L4_NOTHROW;
154
164l4re_env_get_cap_e(char const *name, l4re_env_t const *e) L4_NOTHROW;
165
177l4re_env_get_cap_l(char const *name, unsigned l, l4re_env_t const *e) L4_NOTHROW;
178
181{ return l4re_global_env; }
182
185{ return l4_kip(); }
186
188l4re_env_get_cap_l(char const *name, unsigned l, l4re_env_t const *e) L4_NOTHROW
189{
190 l4re_env_cap_entry_t const *c = e->caps;
191 for (; c && c->flags != ~0UL; ++c)
192 {
193 unsigned i;
194 for (i = 0;
195 i < sizeof(c->name) && i < l && c->name[i] && name[i] && name[i] == c->name[i];
196 ++i)
197 ;
198
199 if (i == l && (i == sizeof(c->name) || !c->name[i]))
200 return c;
201 }
202 return NULL;
203}
204
206l4re_env_get_cap_e(char const *name, l4re_env_t const *e) L4_NOTHROW
207{
208 unsigned l;
209 l4re_env_cap_entry_t const *r;
210 for (l = 0; name[l]; ++l) ;
211 r = l4re_env_get_cap_l(name, l, e);
212 if (r)
213 return r->cap;
214
215 return L4_INVALID_CAP;
216}
217
220{ return l4re_env_get_cap_e(name, l4re_env()); }
221
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:219
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:206
l4_kernel_info_t const * l4re_kip(void) L4_NOTHROW
Get Kernel Info Page.
Definition env.h:184
l4re_env_t * l4re_env(void) L4_NOTHROW
Get L4Re initial environment.
Definition env.h:180
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:188
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:157
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 inital 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
Some 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:110
l4_cap_idx_t first_free_cap
First capability index available to the application.
Definition env.h:108
l4_cap_idx_t itas
ITAS services object-capability.
Definition env.h:107
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:116
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:109
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