Loading...
Searching...
No Matches
rm.h
Go to the documentation of this file.
/*
* (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
* Alexander Warg <warg@os.inf.tu-dresden.de>
* economic rights: Technische Universität Dresden (Germany)
*
* License: see LICENSE.spdx (in this directory or the directories above)
*/
#pragma once
#include <l4/re/env.h>
#include <l4/re/c/dataspace.h>
#include <l4/sys/compiler.h>
L4_BEGIN_DECLS
enum l4re_rm_flags_values {
L4RE_RM_F_R = L4RE_DS_F_R,
L4RE_RM_F_W = L4RE_DS_F_W,
L4RE_RM_F_X = L4RE_DS_F_X,
L4RE_RM_F_RX = L4RE_DS_F_RX,
L4RE_RM_F_RW = L4RE_DS_F_RW,
L4RE_RM_F_RWX = L4RE_DS_F_RWX,
L4RE_RM_F_KERNEL = 0x100,
L4RE_RM_F_DETACH_FREE = 0x200,
L4RE_RM_F_PAGER = 0x400,
L4RE_RM_F_RESERVED = 0x800,
L4RE_RM_CACHING_SHIFT = 4,
L4RE_RM_F_CACHING = L4RE_DS_F_CACHING_MASK,
L4RE_RM_REGION_FLAGS = 0xffff,
L4RE_RM_F_CACHE_NORMAL = L4RE_DS_F_NORMAL,
L4RE_RM_F_CACHE_BUFFERED = L4RE_DS_F_BUFFERABLE,
L4RE_RM_F_CACHE_UNCACHED = L4RE_DS_F_UNCACHEABLE,
L4RE_RM_F_SEARCH_ADDR = 0x020000,
L4RE_RM_F_IN_AREA = 0x040000,
L4RE_RM_F_EAGER_MAP = 0x080000,
L4RE_RM_F_NO_EAGER_MAP = 0x100000,
L4RE_RM_F_ATTACH_FLAGS = 0x1f0000,
};
typedef l4_uint32_t l4re_rm_flags_t;
typedef l4_uint64_t l4re_rm_offset_t;
L4_CV L4_INLINE int
l4re_rm_reserve_area(l4_addr_t *start, unsigned long size,
l4re_rm_flags_t flags, unsigned char align) L4_NOTHROW;
L4_CV L4_INLINE int
l4re_rm_free_area(l4_addr_t addr) L4_NOTHROW;
L4_CV L4_INLINE 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;
L4_CV L4_INLINE int
l4re_rm_detach(void *addr) L4_NOTHROW;
L4_CV L4_INLINE int
l4re_rm_detach_ds(void *addr, l4re_ds_t *ds) L4_NOTHROW;
L4_CV L4_INLINE int
l4re_rm_detach_unmap(l4_addr_t addr, l4_cap_idx_t task) L4_NOTHROW;
L4_CV L4_INLINE int
l4re_rm_detach_ds_unmap(void *addr, l4re_ds_t *ds,
l4_cap_idx_t task) L4_NOTHROW;
L4_CV L4_INLINE 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;
L4_CV L4_INLINE int
l4re_rm_get_info(l4_addr_t addr,
char *name, unsigned int len,
l4re_rm_offset_t *backing_offset) L4_NOTHROW;
L4_CV L4_INLINE void
l4re_rm_show_lists(void) L4_NOTHROW;
/*
* Variants of functions that also take a capability of the region map
* service.
*/
L4_CV 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;
L4_CV int
l4re_rm_free_area_srv(l4_cap_idx_t rm, l4_addr_t addr) L4_NOTHROW;
L4_CV 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;
L4_CV 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;
L4_CV 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;
L4_CV int
l4re_rm_get_info_srv(l4_cap_idx_t rm, l4_addr_t addr,
char *name, unsigned int len,
l4re_rm_offset_t *backing_offset) L4_NOTHROW;
L4_CV void
l4re_rm_show_lists_srv(l4_cap_idx_t rm) L4_NOTHROW;
/********** Implementations ***************************/
L4_CV L4_INLINE int
l4re_rm_reserve_area(l4_addr_t *start, unsigned long size,
l4re_rm_flags_t flags, unsigned char align) L4_NOTHROW
{
return l4re_rm_reserve_area_srv(l4re_global_env->rm, start, size,
flags, align);
}
L4_CV L4_INLINE int
l4re_rm_free_area(l4_addr_t addr) L4_NOTHROW
{
return l4re_rm_free_area_srv(l4re_global_env->rm, addr);
}
L4_CV L4_INLINE 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
{
return l4re_rm_attach_srv(l4re_global_env->rm, start, size,
flags, mem, offs, align);
}
L4_CV L4_INLINE int
l4re_rm_detach(void *addr) L4_NOTHROW
{
return l4re_rm_detach_srv(l4re_global_env->rm,
(l4_addr_t)addr, 0, L4_BASE_TASK_CAP);
}
L4_CV L4_INLINE int
l4re_rm_detach_unmap(l4_addr_t addr, l4_cap_idx_t task) L4_NOTHROW
{
return l4re_rm_detach_srv(l4re_global_env->rm, addr, 0, task);
}
L4_CV L4_INLINE int
l4re_rm_detach_ds(void *addr, l4re_ds_t *ds) L4_NOTHROW
{
return l4re_rm_detach_srv(l4re_global_env->rm, (l4_addr_t)addr,
ds, L4_BASE_TASK_CAP);
}
L4_CV L4_INLINE int
l4re_rm_detach_ds_unmap(void *addr, l4re_ds_t *ds, l4_cap_idx_t task) L4_NOTHROW
{
return l4re_rm_detach_srv(l4re_global_env->rm, (l4_addr_t)addr,
ds, task);
}
L4_CV L4_INLINE 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
{
return l4re_rm_find_srv(l4re_global_env->rm, addr, size, offset, flags, m);
}
L4_CV L4_INLINE void
l4re_rm_show_lists(void) L4_NOTHROW
{
l4re_rm_show_lists_srv(l4re_global_env->rm);
}
L4_CV L4_INLINE int
l4re_rm_get_info(l4_addr_t addr, char *name, unsigned int len,
l4re_rm_offset_t *backing_offset) L4_NOTHROW
{
return l4re_rm_get_info_srv(l4re_global_env->rm, addr, name, len,
backing_offset);
}
L4_END_DECLS
compiler.h
L4 compiler related defines.
dataspace.h
Data space C interface.
env.h
Environment interface.
l4re_ds_t
L4_BEGIN_DECLS typedef l4_cap_idx_t l4re_ds_t
Dataspace type.
Definition dataspace.h:29
L4RE_DS_F_BUFFERABLE
@ L4RE_DS_F_BUFFERABLE
request bufferable (write buffered) mappings
Definition dataspace.h:60
L4RE_DS_F_NORMAL
@ L4RE_DS_F_NORMAL
request normal memory mapping
Definition dataspace.h:58
L4RE_DS_F_CACHING_MASK
@ L4RE_DS_F_CACHING_MASK
mask for caching flags
Definition dataspace.h:62
L4RE_DS_F_UNCACHEABLE
@ L4RE_DS_F_UNCACHEABLE
request uncacheable memory mappings
Definition dataspace.h:61
l4re_rm_attach
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:342
l4re_rm_detach
int l4re_rm_detach(void *addr) L4_NOTHROW
Detach and unmap a region from the address space in the current task.
Definition rm.h:352
l4re_rm_show_lists_srv
void l4re_rm_show_lists_srv(l4_cap_idx_t rm) L4_NOTHROW
Dump region map internal data structures.
l4re_rm_attach_srv
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
l4re_rm_reserve_area_srv
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
l4re_rm_show_lists
void l4re_rm_show_lists(void) L4_NOTHROW
Dump region map internal data structures.
Definition rm.h:387
l4re_rm_find
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:379
l4re_rm_get_info
int l4re_rm_get_info(l4_addr_t addr, char *name, unsigned int len, l4re_rm_offset_t *backing_offset) L4_NOTHROW
Return auxiliary information of a region.
Definition rm.h:395
l4re_rm_detach_ds
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:365
l4re_rm_detach_srv
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_detach_unmap
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:359
l4re_rm_flags_values
l4re_rm_flags_values
Flags for region operations.
Definition rm.h:30
l4re_rm_find_srv
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
l4re_rm_free_area_srv
int l4re_rm_free_area_srv(l4_cap_idx_t rm, l4_addr_t addr) L4_NOTHROW
l4re_rm_reserve_area
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:328
l4re_rm_detach_ds_unmap
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:372
l4re_rm_free_area
int l4re_rm_free_area(l4_addr_t addr) L4_NOTHROW
Free an area from the region map.
Definition rm.h:336
l4re_rm_get_info_srv
int l4re_rm_get_info_srv(l4_cap_idx_t rm, l4_addr_t addr, char *name, unsigned int len, l4re_rm_offset_t *backing_offset) L4_NOTHROW
L4RE_RM_F_CACHE_BUFFERED
@ L4RE_RM_F_CACHE_BUFFERED
Cache bits for buffered (write combining) memory.
Definition rm.h:54
L4RE_RM_REGION_FLAGS
@ L4RE_RM_REGION_FLAGS
Mask of all region flags.
Definition rm.h:48
L4RE_RM_F_CACHE_UNCACHED
@ L4RE_RM_F_CACHE_UNCACHED
Cache bits for uncached memory.
Definition rm.h:57
L4RE_RM_CACHING_SHIFT
@ L4RE_RM_CACHING_SHIFT
Start of region mapper cache bits.
Definition rm.h:43
L4RE_RM_F_NO_EAGER_MAP
@ L4RE_RM_F_NO_EAGER_MAP
Prevent eager mapping of the attached data space.
Definition rm.h:62
L4RE_RM_F_SEARCH_ADDR
@ L4RE_RM_F_SEARCH_ADDR
Search for a suitable address range.
Definition rm.h:59
L4RE_RM_F_DETACH_FREE
@ L4RE_RM_F_DETACH_FREE
Free the portion of the data space after detach.
Definition rm.h:39
L4RE_RM_F_KERNEL
@ L4RE_RM_F_KERNEL
Kernel-provided memory (KUMEM).
Definition rm.h:38
L4RE_RM_F_PAGER
@ L4RE_RM_F_PAGER
Region has a pager.
Definition rm.h:40
L4RE_RM_F_R
@ L4RE_RM_F_R
Region is read-only.
Definition rm.h:31
L4RE_RM_F_IN_AREA
@ L4RE_RM_F_IN_AREA
Search only in area, or map into area.
Definition rm.h:60
L4RE_RM_F_CACHE_NORMAL
@ L4RE_RM_F_CACHE_NORMAL
Cache bits for normal cacheable memory.
Definition rm.h:51
L4RE_RM_F_ATTACH_FLAGS
@ L4RE_RM_F_ATTACH_FLAGS
Mask of all attach flags.
Definition rm.h:63
L4RE_RM_F_RESERVED
@ L4RE_RM_F_RESERVED
Region is reserved (blocked).
Definition rm.h:41
L4RE_RM_F_EAGER_MAP
@ L4RE_RM_F_EAGER_MAP
Eagerly map the attached data space in.
Definition rm.h:61
L4RE_RM_F_CACHING
@ L4RE_RM_F_CACHING
Mask of all region manager cache bits.
Definition rm.h:46
l4_addr_t
unsigned long l4_addr_t
Address type.
Definition l4int.h:34
l4_uint32_t
unsigned int l4_uint32_t
Unsigned 32bit value.
Definition l4int.h:29
l4_uint64_t
unsigned long long l4_uint64_t
Unsigned 64bit value.
Definition l4int.h:31
l4_cap_idx_t
unsigned long l4_cap_idx_t
Capability selector type.
Definition types.h:336
L4_BASE_TASK_CAP
@ L4_BASE_TASK_CAP
Capability selector for the current task.
Definition consts.h:327
L4_CV
#define L4_CV
Define calling convention.
Definition linkage.h:33
L4_NOTHROW
#define L4_NOTHROW
Mark a function declaration and definition as never throwing an exception.
Definition compiler.h:161
L4_INLINE
#define L4_INLINE
L4 Inline function attribute.
Definition compiler.h:51
L4_BEGIN_DECLS
#define L4_BEGIN_DECLS
Start section with C types and functions.
Definition compiler.h:165
L4_END_DECLS
#define L4_END_DECLS
End section with C types and functions.
Definition compiler.h:166