L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
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
41 L4RE_RM_F_R = L4RE_DS_F_R,
42 L4RE_RM_F_W = L4RE_DS_F_W,
43 L4RE_RM_F_X = L4RE_DS_F_X,
44 L4RE_RM_F_RX = L4RE_DS_F_RX,
45 L4RE_RM_F_RW = L4RE_DS_F_RW,
46 L4RE_RM_F_RWX = L4RE_DS_F_RWX,
47
56
61
64
67
69 L4RE_RM_F_IN_AREA = 0x040000,
73};
74
75typedef l4_uint32_t l4re_rm_flags_t;
76typedef l4_uint64_t l4re_rm_offset_t;
77
87l4re_rm_reserve_area(l4_addr_t *start, unsigned long size,
88 l4re_rm_flags_t flags, unsigned char align) L4_NOTHROW;
89
100
110l4re_rm_attach(void **start, unsigned long size, l4re_rm_flags_t flags,
111 l4re_ds_t mem,
112 l4re_rm_offset_t offs,
113 unsigned char align) L4_NOTHROW;
114
115
134l4re_rm_detach(void *addr) L4_NOTHROW;
135
156l4re_rm_detach_ds(void *addr, l4re_ds_t *ds) L4_NOTHROW;
157
171
187l4re_rm_detach_ds_unmap(void *addr, l4re_ds_t *ds,
189
190
198l4re_rm_find(l4_addr_t *addr, unsigned long *size,
199 l4re_rm_offset_t *offset,
200 l4re_rm_flags_t *flags, l4re_ds_t *m) L4_NOTHROW;
201
208L4_CV L4_INLINE void
210
211
212/*
213 * Variants of functions that also take a capability of the region map
214 * service.
215 */
216
217
222L4_CV int
223l4re_rm_reserve_area_srv(l4_cap_idx_t rm, l4_addr_t *start, unsigned long size,
224 l4re_rm_flags_t flags, unsigned char align) L4_NOTHROW;
225
230L4_CV int
232
237L4_CV int
238l4re_rm_attach_srv(l4_cap_idx_t rm, void **start, unsigned long size,
239 l4re_rm_flags_t flags, l4re_ds_t mem,
240 l4re_rm_offset_t offs,
241 unsigned char align) L4_NOTHROW;
242
243
248L4_CV int
251
252
257L4_CV int
259 unsigned long *size, l4re_rm_offset_t *offset,
260 l4re_rm_flags_t *flags, l4re_ds_t *m) L4_NOTHROW;
261
266L4_CV void
268
269
270/********** Implementations ***************************/
271
273l4re_rm_reserve_area(l4_addr_t *start, unsigned long size,
274 l4re_rm_flags_t flags, unsigned char align) L4_NOTHROW
275{
276 return l4re_rm_reserve_area_srv(l4re_global_env->rm, start, size,
277 flags, align);
278}
279
282{
283 return l4re_rm_free_area_srv(l4re_global_env->rm, addr);
284}
285
287l4re_rm_attach(void **start, unsigned long size, l4re_rm_flags_t flags,
288 l4re_ds_t mem, l4re_rm_offset_t offs,
289 unsigned char align) L4_NOTHROW
290{
291 return l4re_rm_attach_srv(l4re_global_env->rm, start, size,
292 flags, mem, offs, align);
293}
294
295
298{
299 return l4re_rm_detach_srv(l4re_global_env->rm,
300 (l4_addr_t)addr, 0, L4_BASE_TASK_CAP);
301}
302
305{
306 return l4re_rm_detach_srv(l4re_global_env->rm, addr, 0, task);
307}
308
311{
312 return l4re_rm_detach_srv(l4re_global_env->rm, (l4_addr_t)addr,
313 ds, L4_BASE_TASK_CAP);
314}
315
318{
319 return l4re_rm_detach_srv(l4re_global_env->rm, (l4_addr_t)addr,
320 ds, task);
321}
322
324l4re_rm_find(l4_addr_t *addr, unsigned long *size,
325 l4re_rm_offset_t *offset,
326 l4re_rm_flags_t *flags, l4re_ds_t *m) L4_NOTHROW
327{
328 return l4re_rm_find_srv(l4re_global_env->rm, addr, size, offset, flags, m);
329}
330
331L4_CV L4_INLINE void
333{
334 l4re_rm_show_lists_srv(l4re_global_env->rm);
335}
336
Data space C interface.
Environment interface.
l4_cap_idx_t l4re_ds_t
Dataspace type.
Definition dataspace.h:39
@ L4RE_DS_F_BUFFERABLE
request bufferable (write buffered) mappings
Definition dataspace.h:70
@ L4RE_DS_F_NORMAL
request normal memory mapping
Definition dataspace.h:68
@ L4RE_DS_F_CACHING_MASK
mask for caching flags
Definition dataspace.h:72
@ L4RE_DS_F_UNCACHEABLE
request uncacheable memory mappings
Definition dataspace.h:71
int l4re_rm_attach(void **start, unsigned long size, l4re_rm_flags_t flags, l4re_ds_t mem, l4re_rm_offset_t offs, unsigned char align) L4_NOTHROW
Attach a data space to a region.
Definition rm.h:287
int l4re_rm_detach(void *addr) L4_NOTHROW
Detach and unmap a region from the address space in the current task.
Definition rm.h:297
void l4re_rm_show_lists_srv(l4_cap_idx_t rm) L4_NOTHROW
Dump region map internal data structures.
int l4re_rm_attach_srv(l4_cap_idx_t rm, void **start, unsigned long size, l4re_rm_flags_t flags, l4re_ds_t mem, l4re_rm_offset_t offs, unsigned char align) L4_NOTHROW
int l4re_rm_reserve_area_srv(l4_cap_idx_t rm, l4_addr_t *start, unsigned long size, l4re_rm_flags_t flags, unsigned char align) L4_NOTHROW
void l4re_rm_show_lists(void) L4_NOTHROW
Dump region map internal data structures.
Definition rm.h:332
int l4re_rm_find(l4_addr_t *addr, unsigned long *size, l4re_rm_offset_t *offset, l4re_rm_flags_t *flags, l4re_ds_t *m) L4_NOTHROW
Find a region given an address and size.
Definition rm.h:324
int l4re_rm_detach_ds(void *addr, l4re_ds_t *ds) L4_NOTHROW
Detach and unmap a region and return affected dataspace in the current task.
Definition rm.h:310
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
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:304
l4re_rm_flags_values
Flags for region operations.
Definition rm.h:40
int l4re_rm_find_srv(l4_cap_idx_t rm, l4_addr_t *addr, unsigned long *size, l4re_rm_offset_t *offset, l4re_rm_flags_t *flags, l4re_ds_t *m) L4_NOTHROW
int l4re_rm_free_area_srv(l4_cap_idx_t rm, l4_addr_t addr) L4_NOTHROW
int l4re_rm_reserve_area(l4_addr_t *start, unsigned long size, l4re_rm_flags_t flags, unsigned char align) L4_NOTHROW
Reserve the given area in the region map.
Definition rm.h:273
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:317
int l4re_rm_free_area(l4_addr_t addr) L4_NOTHROW
Free an area from the region map.
Definition rm.h:281
@ L4RE_RM_F_CACHE_BUFFERED
Cache bits for buffered (write combining) memory.
Definition rm.h:63
@ L4RE_RM_REGION_FLAGS
Mask of all region flags.
Definition rm.h:57
@ L4RE_RM_F_CACHE_UNCACHED
Cache bits for uncached memory.
Definition rm.h:66
@ L4RE_RM_CACHING_SHIFT
Start of region mapper cache bits.
Definition rm.h:52
@ L4RE_RM_F_NO_EAGER_MAP
Prevent eager mapping of the attached data space.
Definition rm.h:71
@ L4RE_RM_F_SEARCH_ADDR
Search for a suitable address range.
Definition rm.h:68
@ L4RE_RM_F_PAGER
Region has a pager.
Definition rm.h:49
@ L4RE_RM_F_R
Region is read-only.
Definition rm.h:41
@ L4RE_RM_F_IN_AREA
Search only in area, or map into area.
Definition rm.h:69
@ L4RE_RM_F_CACHE_NORMAL
Cache bits for normal cacheable memory.
Definition rm.h:60
@ L4RE_RM_F_ATTACH_FLAGS
Mask of all attach flags.
Definition rm.h:72
@ L4RE_RM_F_RESERVED
Region is reserved (blocked)
Definition rm.h:50
@ L4RE_RM_F_EAGER_MAP
Eagerly map the attached data space in.
Definition rm.h:70
@ L4RE_RM_F_NO_ALIAS
The region contains exclusive memory that is not mapped anywhere else.
Definition rm.h:48
@ L4RE_RM_F_CACHING
Mask of all region manager cache bits.
Definition rm.h:55
unsigned long l4_addr_t
Address type.
Definition l4int.h:45
unsigned int l4_uint32_t
Unsigned 32bit value.
Definition l4int.h:40
unsigned long long l4_uint64_t
Unsigned 64bit value.
Definition l4int.h:42
unsigned long l4_cap_idx_t
Capability selector type.
Definition types.h:359
@ L4_BASE_TASK_CAP
Capability selector for the current task.
Definition consts.h:316
#define L4_CV
Define calling convention.
Definition linkage.h:44
#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
#define EXTERN_C_BEGIN
Start section with C types and functions.
Definition compiler.h:192
#define EXTERN_C_END
End section with C types and functions.
Definition compiler.h:193
l4_cap_idx_t rm
Region map object-capability.
Definition env.h:112