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 * This file is part of TUD:OS and distributed under the terms of the
11 * GNU General Public License 2.
12 * Please see the COPYING-GPL-2 file for details.
13 *
14 * As a special exception, you may use this file as part of a free software
15 * library without restriction. Specifically, if other files instantiate
16 * templates or use macros or inline functions from this file, or you compile
17 * this file and link it with other files to produce an executable, this
18 * file does not by itself cause the resulting executable to be covered by
19 * the GNU General Public License. This exception does not however
20 * invalidate any other reasons why the executable file might be covered by
21 * the GNU General Public License.
22 */
23#pragma once
24
25#include <l4/sys/consts.h>
26#include <l4/sys/types.h>
27#include <l4/sys/kip.h>
28#include <l4/sys/compiler.h>
29
30#include <l4/re/consts.h>
31
51{
56
62
66 char name[16];
67#ifdef __cplusplus
68
73
82 : cap(c), flags(f)
83 {
84 for (unsigned i = 0; n && i < sizeof(name); ++i, ++n)
85 {
86 name[i] = *n;
87 if (!*n)
88 break;
89 }
90 }
91
92 static bool is_valid_name(char const *n) L4_NOTHROW
93 {
94 for (unsigned i = 0; *n; ++i, ++n)
95 if (i > sizeof(name))
96 return false;
97
98 return true;
99 }
100#endif
102
103
128
134extern l4re_env_t *l4re_global_env;
135
136
143
144/*
145 * FIXME: this seems to be at the wrong place here
146 */
153
154
163l4re_env_get_cap(char const *name) L4_NOTHROW;
164
174l4re_env_get_cap_e(char const *name, l4re_env_t const *e) L4_NOTHROW;
175
187l4re_env_get_cap_l(char const *name, unsigned l, l4re_env_t const *e) L4_NOTHROW;
188
191{ return l4re_global_env; }
192
195{ return l4_kip(); }
196
198l4re_env_get_cap_l(char const *name, unsigned l, l4re_env_t const *e) L4_NOTHROW
199{
200 l4re_env_cap_entry_t const *c = e->caps;
201 for (; c && c->flags != ~0UL; ++c)
202 {
203 unsigned i;
204 for (i = 0;
205 i < sizeof(c->name) && i < l && c->name[i] && name[i] && name[i] == c->name[i];
206 ++i)
207 ;
208
209 if (i == l && (i == sizeof(c->name) || !c->name[i]))
210 return c;
211 }
212 return NULL;
213}
214
216l4re_env_get_cap_e(char const *name, l4re_env_t const *e) L4_NOTHROW
217{
218 unsigned l;
219 l4re_env_cap_entry_t const *r;
220 for (l = 0; name[l]; ++l) ;
221 r = l4re_env_get_cap_l(name, l, e);
222 if (r)
223 return r->cap;
224
225 return L4_INVALID_CAP;
226}
227
230{ return l4re_env_get_cap_e(name, l4re_env()); }
231
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:229
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:216
l4_kernel_info_t const * l4re_kip(void) L4_NOTHROW
Get Kernel Info Page.
Definition env.h:194
l4re_env_t * l4re_env(void) L4_NOTHROW
Get L4Re initial environment.
Definition env.h:190
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:198
unsigned long l4_umword_t
Unsigned machine word.
Definition l4int.h:51
unsigned long l4_addr_t
Address type.
Definition l4int.h:45
unsigned long l4_cap_idx_t
Capability selector type.
Definition types.h:358
@ L4_INVALID_CAP
Invalid capability selector.
Definition consts.h:168
l4_kernel_info_t const * l4_kip(void) L4_NOTHROW
Get Kernel Info Page.
Definition kip.h:192
#define L4_NOTHROW
Mark a function declaration and definition as never throwing an exception.
Definition compiler.h:188
#define L4_INLINE
L4 Inline function attribute.
Definition compiler.h:62
Constants.
Common L4 ABI Data Types.
L4 Kernel Interface Page.
Definition __kip-32bit.h:39
Entry in the L4Re environment array for the named inital objects.
Definition env.h:51
l4re_env_cap_entry_t() L4_NOTHROW
Create an invalid entry.
Definition env.h:72
l4_cap_idx_t cap
The capability selector for the object.
Definition env.h:55
char name[16]
The name of the object.
Definition env.h:66
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:81
l4_umword_t flags
Some flags for the object.
Definition env.h:61
Initial environment data structure.
Definition env.h:110
l4_cap_idx_t factory
Object-capability of the factory available to the task.
Definition env.h:116
l4_cap_idx_t mem_alloc
Memory allocator object-capability.
Definition env.h:113
l4_cap_idx_t scheduler
Object capability for the scheduler set to use.
Definition env.h:117
l4_cap_idx_t rm
Region map object-capability.
Definition env.h:112
l4_addr_t first_free_utcb
First UTCB within the UTCB area available to the application.
Definition env.h:120
l4_cap_idx_t first_free_cap
First capability index available to the application.
Definition env.h:118
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:126
l4_cap_idx_t main_thread
Object-capability of the first user thread.
Definition env.h:115
l4_fpage_t utcb_area
UTCB area of the task.
Definition env.h:119
l4_cap_idx_t parent
Parent object-capability.
Definition env.h:111
l4_cap_idx_t log
Logging object-capability.
Definition env.h:114
Kernel Info Page access functions.
L4 flexpage type.
Definition __l4_fpage.h:85