L4Re - L4 Runtime Environment
rm.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 
31 #include <l4/re/env.h>
32 #include <l4/re/c/dataspace.h>
33 
35 
43  L4RE_RM_PAGER = 0x04,
47  L4RE_RM_OVERMAP = 0x10,
49  L4RE_RM_IN_AREA = 0x40,
52 };
53 
54 
55 
63 L4_CV L4_INLINE int
64 l4re_rm_reserve_area(l4_addr_t *start, unsigned long size,
65  unsigned flags, unsigned char align) L4_NOTHROW;
66 
74 L4_CV L4_INLINE int
76 
85 L4_CV L4_INLINE int
86 l4re_rm_attach(void **start, unsigned long size, unsigned long flags,
87  l4re_ds_t const mem, l4_addr_t offs,
88  unsigned char align) L4_NOTHROW;
89 
90 
101 L4_CV L4_INLINE int
102 l4re_rm_detach(void *addr) L4_NOTHROW;
103 
116 L4_CV L4_INLINE int
117 l4re_rm_detach_ds(void *addr, l4re_ds_t *ds) L4_NOTHROW;
118 
130 L4_CV L4_INLINE int
132 
145 L4_CV L4_INLINE int
146 l4re_rm_detach_ds_unmap(void *addr, l4re_ds_t *ds,
147  l4_cap_idx_t task) L4_NOTHROW;
148 
149 
155 L4_CV L4_INLINE int
156 l4re_rm_find(l4_addr_t *addr, unsigned long *size, l4_addr_t *offset,
157  unsigned *flags, l4re_ds_t *m) L4_NOTHROW;
158 
165 L4_CV L4_INLINE void
167 
168 
169 /*
170  * Variants of functions that also take a capability of the region map
171  * service.
172  */
173 
174 
179 L4_CV int
180 l4re_rm_reserve_area_srv(l4_cap_idx_t rm, l4_addr_t *start, unsigned long size,
181  unsigned flags, unsigned char align) L4_NOTHROW;
182 
187 L4_CV int
189 
194 L4_CV int
195 l4re_rm_attach_srv(l4_cap_idx_t rm, void **start, unsigned long size,
196  unsigned long flags, l4re_ds_t const mem, l4_addr_t offs,
197  unsigned char align) L4_NOTHROW;
198 
199 
204 L4_CV int
206  l4re_ds_t *ds, l4_cap_idx_t task) L4_NOTHROW;
207 
208 
213 L4_CV int
215  unsigned long *size, l4_addr_t *offset,
216  unsigned *flags, l4re_ds_t *m) L4_NOTHROW;
217 
222 L4_CV void
224 
225 
226 /********** Implementations ***************************/
227 
228 L4_CV L4_INLINE int
229 l4re_rm_reserve_area(l4_addr_t *start, unsigned long size,
230  unsigned flags, unsigned char align) L4_NOTHROW
231 {
232  return l4re_rm_reserve_area_srv(l4re_global_env->rm, start, size,
233  flags, align);
234 }
235 
236 L4_CV L4_INLINE int
238 {
239  return l4re_rm_free_area_srv(l4re_global_env->rm, addr);
240 }
241 
242 L4_CV L4_INLINE int
243 l4re_rm_attach(void **start, unsigned long size, unsigned long flags,
244  l4re_ds_t const mem, l4_addr_t offs,
245  unsigned char align) L4_NOTHROW
246 {
247  return l4re_rm_attach_srv(l4re_global_env->rm, start, size,
248  flags, mem, offs, align);
249 }
250 
251 
252 L4_CV L4_INLINE int
254 {
255  return l4re_rm_detach_srv(l4re_global_env->rm,
256  (l4_addr_t)addr, 0, L4_BASE_TASK_CAP);
257 }
258 
259 L4_CV L4_INLINE int
261 {
262  return l4re_rm_detach_srv(l4re_global_env->rm, addr, 0, task);
263 }
264 
265 L4_CV L4_INLINE int
267 {
268  return l4re_rm_detach_srv(l4re_global_env->rm, (l4_addr_t)addr,
269  ds, L4_BASE_TASK_CAP);
270 }
271 
272 L4_CV L4_INLINE int
274 {
275  return l4re_rm_detach_srv(l4re_global_env->rm, (l4_addr_t)addr,
276  ds, task);
277 }
278 
279 L4_CV L4_INLINE int
280 l4re_rm_find(l4_addr_t *addr, unsigned long *size, l4_addr_t *offset,
281  unsigned *flags, l4re_ds_t *m) L4_NOTHROW
282 {
283  return l4re_rm_find_srv(l4re_global_env->rm, addr, size, offset, flags, m);
284 }
285 
286 L4_CV L4_INLINE void
288 {
289  l4re_rm_show_lists_srv(l4re_global_env->rm);
290 }
291 
Region is read-only.
Definition: rm.h:41
int l4re_rm_attach(void **start, unsigned long size, unsigned long flags, l4re_ds_t const mem, l4_addr_t offs, unsigned char align) L4_NOTHROW
Definition: rm.h:243
int l4re_rm_detach_ds(void *addr, l4re_ds_t *ds) L4_NOTHROW
Detach, unmap and return affected dataspace in current task.
Definition: rm.h:266
Region has a pager.
Definition: rm.h:43
Unmap memory already mapped in the region.
Definition: rm.h:47
int l4re_rm_reserve_area_srv(l4_cap_idx_t rm, l4_addr_t *start, unsigned long size, unsigned flags, unsigned char align) L4_NOTHROW
Search for a suitable address range.
Definition: rm.h:48
#define EXTERN_C_END
End section with C types and functions.
Definition: compiler.h:187
Mask of all attach flags.
Definition: rm.h:51
Capability selector for the current task.
Definition: consts.h:243
Search only in area, or map into area.
Definition: rm.h:49
The region contains exclusive memory that is not mapped anywhere else.
Definition: rm.h:42
int l4re_rm_attach_srv(l4_cap_idx_t rm, void **start, unsigned long size, unsigned long flags, l4re_ds_t const mem, l4_addr_t offs, unsigned char align) L4_NOTHROW
unsigned long l4_cap_idx_t
L4 Capability selector Type.
Definition: types.h:342
Region is reserved (blocked)
Definition: rm.h:44
Environment interface.
int l4re_rm_free_area_srv(l4_cap_idx_t rm, l4_addr_t addr) L4_NOTHROW
Mask of all region flags.
Definition: rm.h:45
l4_cap_idx_t rm
Region map object-capability.
Definition: env.h:111
Eagerly map the attached data space in.
Definition: rm.h:50
l4_cap_idx_t l4re_ds_t
Dataspace type.
Definition: dataspace.h:39
#define EXTERN_C_BEGIN
Start section with C types and functions.
Definition: compiler.h:186
void l4re_rm_show_lists_srv(l4_cap_idx_t rm) L4_NOTHROW
Dump region map internal data structures.
Data space C interface.
int l4re_rm_detach(void *addr) L4_NOTHROW
Detach and unmap in current task.
Definition: rm.h:253
#define L4_CV
Define calling convention.
Definition: linkage.h:44
void l4re_rm_show_lists(void) L4_NOTHROW
Dump region map internal data structures.
Definition: rm.h:287
int l4re_rm_detach_ds_unmap(void *addr, l4re_ds_t *ds, l4_cap_idx_t task) L4_NOTHROW
Detach and unmap in specified task.
Definition: rm.h:273
int l4re_rm_find_srv(l4_cap_idx_t rm, l4_addr_t *addr, unsigned long *size, l4_addr_t *offset, unsigned *flags, l4re_ds_t *m) L4_NOTHROW
int l4re_rm_detach_unmap(l4_addr_t addr, l4_cap_idx_t task) L4_NOTHROW
Detach and unmap in specified task.
Definition: rm.h:260
int l4re_rm_find(l4_addr_t *addr, unsigned long *size, l4_addr_t *offset, unsigned *flags, l4re_ds_t *m) L4_NOTHROW
Definition: rm.h:280
int l4re_rm_free_area(l4_addr_t addr) L4_NOTHROW
Definition: rm.h:237
int l4re_rm_reserve_area(l4_addr_t *start, unsigned long size, unsigned flags, unsigned char align) L4_NOTHROW
Definition: rm.h:229
int l4re_rm_detach_srv(l4_cap_idx_t rm, l4_addr_t addr, l4re_ds_t *ds, l4_cap_idx_t task) L4_NOTHROW
l4re_rm_flags_t
Flags for region operations.
Definition: rm.h:40
unsigned long l4_addr_t
Address type.
Definition: l4int.h:45
#define L4_NOTHROW
Mark a function declaration and definition as never throwing an exception.
Definition: compiler.h:185