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,
50 
53 
58 
61 
64 
65  L4RE_RM_OVERMAP = 0x10,
67  L4RE_RM_IN_AREA = 0x40,
70 };
71 
72 
73 
81 L4_CV L4_INLINE int
82 l4re_rm_reserve_area(l4_addr_t *start, unsigned long size,
83  unsigned flags, unsigned char align) L4_NOTHROW;
84 
92 L4_CV L4_INLINE int
94 
103 L4_CV L4_INLINE int
104 l4re_rm_attach(void **start, unsigned long size, unsigned long flags,
105  l4re_ds_t const mem, l4_addr_t offs,
106  unsigned char align) L4_NOTHROW;
107 
108 
119 L4_CV L4_INLINE int
120 l4re_rm_detach(void *addr) L4_NOTHROW;
121 
134 L4_CV L4_INLINE int
135 l4re_rm_detach_ds(void *addr, l4re_ds_t *ds) L4_NOTHROW;
136 
148 L4_CV L4_INLINE int
150 
163 L4_CV L4_INLINE int
164 l4re_rm_detach_ds_unmap(void *addr, l4re_ds_t *ds,
165  l4_cap_idx_t task) L4_NOTHROW;
166 
167 
173 L4_CV L4_INLINE int
174 l4re_rm_find(l4_addr_t *addr, unsigned long *size, l4_addr_t *offset,
175  unsigned *flags, l4re_ds_t *m) L4_NOTHROW;
176 
183 L4_CV L4_INLINE void
185 
186 
187 /*
188  * Variants of functions that also take a capability of the region map
189  * service.
190  */
191 
192 
197 L4_CV int
198 l4re_rm_reserve_area_srv(l4_cap_idx_t rm, l4_addr_t *start, unsigned long size,
199  unsigned flags, unsigned char align) L4_NOTHROW;
200 
205 L4_CV int
207 
212 L4_CV int
213 l4re_rm_attach_srv(l4_cap_idx_t rm, void **start, unsigned long size,
214  unsigned long flags, l4re_ds_t const mem, l4_addr_t offs,
215  unsigned char align) L4_NOTHROW;
216 
217 
222 L4_CV int
224  l4re_ds_t *ds, l4_cap_idx_t task) L4_NOTHROW;
225 
226 
231 L4_CV int
233  unsigned long *size, l4_addr_t *offset,
234  unsigned *flags, l4re_ds_t *m) L4_NOTHROW;
235 
240 L4_CV void
242 
243 
244 /********** Implementations ***************************/
245 
246 L4_CV L4_INLINE int
247 l4re_rm_reserve_area(l4_addr_t *start, unsigned long size,
248  unsigned flags, unsigned char align) L4_NOTHROW
249 {
250  return l4re_rm_reserve_area_srv(l4re_global_env->rm, start, size,
251  flags, align);
252 }
253 
254 L4_CV L4_INLINE int
256 {
257  return l4re_rm_free_area_srv(l4re_global_env->rm, addr);
258 }
259 
260 L4_CV L4_INLINE int
261 l4re_rm_attach(void **start, unsigned long size, unsigned long flags,
262  l4re_ds_t const mem, l4_addr_t offs,
263  unsigned char align) L4_NOTHROW
264 {
265  return l4re_rm_attach_srv(l4re_global_env->rm, start, size,
266  flags, mem, offs, align);
267 }
268 
269 
270 L4_CV L4_INLINE int
272 {
273  return l4re_rm_detach_srv(l4re_global_env->rm,
274  (l4_addr_t)addr, 0, L4_BASE_TASK_CAP);
275 }
276 
277 L4_CV L4_INLINE int
279 {
280  return l4re_rm_detach_srv(l4re_global_env->rm, addr, 0, task);
281 }
282 
283 L4_CV L4_INLINE int
285 {
286  return l4re_rm_detach_srv(l4re_global_env->rm, (l4_addr_t)addr,
287  ds, L4_BASE_TASK_CAP);
288 }
289 
290 L4_CV L4_INLINE int
292 {
293  return l4re_rm_detach_srv(l4re_global_env->rm, (l4_addr_t)addr,
294  ds, task);
295 }
296 
297 L4_CV L4_INLINE int
298 l4re_rm_find(l4_addr_t *addr, unsigned long *size, l4_addr_t *offset,
299  unsigned *flags, l4re_ds_t *m) L4_NOTHROW
300 {
301  return l4re_rm_find_srv(l4re_global_env->rm, addr, size, offset, flags, m);
302 }
303 
304 L4_CV L4_INLINE void
306 {
307  l4re_rm_show_lists_srv(l4re_global_env->rm);
308 }
309 
Region is read-only.
Definition: rm.h:41
Mask of all region manager cache bits.
Definition: rm.h:52
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:261
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:284
shift value for caching flags
Definition: dataspace.h:63
Region has a pager.
Definition: rm.h:43
Unmap memory already mapped in the region.
Definition: rm.h:65
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:66
#define EXTERN_C_END
End section with C types and functions.
Definition: compiler.h:187
Shift value for Dataspace to Rm cache bits.
Definition: rm.h:49
Start of region mapper cache bits.
Definition: rm.h:46
Mask of all attach flags.
Definition: rm.h:69
Capability selector for the current task.
Definition: consts.h:243
Search only in area, or map into area.
Definition: rm.h:67
The region contains exclusive memory that is not mapped anywhere else.
Definition: rm.h:42
mask for caching flags
Definition: dataspace.h:62
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.
Cache bits for uncached memory.
Definition: rm.h:63
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:54
l4_cap_idx_t rm
Region map object-capability.
Definition: env.h:111
Eagerly map the attached data space in.
Definition: rm.h:68
l4_cap_idx_t l4re_ds_t
Dataspace type.
Definition: dataspace.h:39
Cache bits for buffered (write combining) memory.
Definition: rm.h:60
#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:271
#define L4_CV
Define calling convention.
Definition: linkage.h:44
request normal memory mapping
Definition: dataspace.h:58
request uncacheable memory mappings
Definition: dataspace.h:61
void l4re_rm_show_lists(void) L4_NOTHROW
Dump region map internal data structures.
Definition: rm.h:305
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:291
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:278
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:298
int l4re_rm_free_area(l4_addr_t addr) L4_NOTHROW
Definition: rm.h:255
int l4re_rm_reserve_area(l4_addr_t *start, unsigned long size, unsigned flags, unsigned char align) L4_NOTHROW
Definition: rm.h:247
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
request bufferable (write buffered) mappings
Definition: dataspace.h:60
unsigned long l4_addr_t
Address type.
Definition: l4int.h:45
Cache bits for normal cacheable memory.
Definition: rm.h:57
#define L4_NOTHROW
Mark a function declaration and definition as never throwing an exception.
Definition: compiler.h:185