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
72};
73
74typedef l4_uint32_t l4re_rm_flags_t;
75typedef l4_uint64_t l4re_rm_offset_t;
76
86l4re_rm_reserve_area(l4_addr_t *start, unsigned long size,
87 l4re_rm_flags_t flags, unsigned char align) L4_NOTHROW;
88
99
109l4re_rm_attach(void **start, unsigned long size, l4re_rm_flags_t flags,
110 l4re_ds_t mem,
111 l4re_rm_offset_t offs,
112 unsigned char align) L4_NOTHROW;
113
114
133l4re_rm_detach(void *addr) L4_NOTHROW;
134
155l4re_rm_detach_ds(void *addr, l4re_ds_t *ds) L4_NOTHROW;
156
170
186l4re_rm_detach_ds_unmap(void *addr, l4re_ds_t *ds,
188
189
197l4re_rm_find(l4_addr_t *addr, unsigned long *size,
198 l4re_rm_offset_t *offset,
199 l4re_rm_flags_t *flags, l4re_ds_t *m) L4_NOTHROW;
200
207L4_CV L4_INLINE void
209
210
211/*
212 * Variants of functions that also take a capability of the region map
213 * service.
214 */
215
216
221L4_CV int
222l4re_rm_reserve_area_srv(l4_cap_idx_t rm, l4_addr_t *start, unsigned long size,
223 l4re_rm_flags_t flags, unsigned char align) L4_NOTHROW;
224
229L4_CV int
231
236L4_CV int
237l4re_rm_attach_srv(l4_cap_idx_t rm, void **start, unsigned long size,
238 l4re_rm_flags_t flags, l4re_ds_t mem,
239 l4re_rm_offset_t offs,
240 unsigned char align) L4_NOTHROW;
241
242
247L4_CV int
250
251
256L4_CV int
258 unsigned long *size, l4re_rm_offset_t *offset,
259 l4re_rm_flags_t *flags, l4re_ds_t *m) L4_NOTHROW;
260
265L4_CV void
267
268
269/********** Implementations ***************************/
270
272l4re_rm_reserve_area(l4_addr_t *start, unsigned long size,
273 l4re_rm_flags_t flags, unsigned char align) L4_NOTHROW
274{
275 return l4re_rm_reserve_area_srv(l4re_global_env->rm, start, size,
276 flags, align);
277}
278
281{
282 return l4re_rm_free_area_srv(l4re_global_env->rm, addr);
283}
284
286l4re_rm_attach(void **start, unsigned long size, l4re_rm_flags_t flags,
287 l4re_ds_t mem, l4re_rm_offset_t offs,
288 unsigned char align) L4_NOTHROW
289{
290 return l4re_rm_attach_srv(l4re_global_env->rm, start, size,
291 flags, mem, offs, align);
292}
293
294
297{
298 return l4re_rm_detach_srv(l4re_global_env->rm,
299 (l4_addr_t)addr, 0, L4_BASE_TASK_CAP);
300}
301
304{
305 return l4re_rm_detach_srv(l4re_global_env->rm, addr, 0, task);
306}
307
310{
311 return l4re_rm_detach_srv(l4re_global_env->rm, (l4_addr_t)addr,
312 ds, L4_BASE_TASK_CAP);
313}
314
317{
318 return l4re_rm_detach_srv(l4re_global_env->rm, (l4_addr_t)addr,
319 ds, task);
320}
321
323l4re_rm_find(l4_addr_t *addr, unsigned long *size,
324 l4re_rm_offset_t *offset,
325 l4re_rm_flags_t *flags, l4re_ds_t *m) L4_NOTHROW
326{
327 return l4re_rm_find_srv(l4re_global_env->rm, addr, size, offset, flags, m);
328}
329
330L4_CV L4_INLINE void
332{
333 l4re_rm_show_lists_srv(l4re_global_env->rm);
334}
335
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:286
int l4re_rm_detach(void *addr) L4_NOTHROW
Detach and unmap a region from the address space in the current task.
Definition rm.h:296
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:331
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:323
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:309
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:303
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:272
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:316
int l4re_rm_free_area(l4_addr_t addr) L4_NOTHROW
Free an area from the region map.
Definition rm.h:280
@ 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_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:71
@ 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:358
@ 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