L4Re - L4 Runtime Environment
|
Region map. More...
#include <l4/re/rm>
Public Types | |
enum | Detach_result { Detached_ds = 0, Kept_ds = 1, Split_ds = 2 , Detach_again = 4 } |
Result values for detach operation. More... | |
enum | Region_flags { Read_only = 0x01, Detach_free = 0x02, Pager = 0x04, Reserved = 0x08, Caching_shift = 8, Caching_ds_shift = Caching_shift - Dataspace::Map_caching_shift, Caching = Dataspace::Map_caching_mask << Caching_ds_shift, Cache_normal = Dataspace::Map_normal << Caching_ds_shift, Cache_buffered = Dataspace::Map_bufferable << Caching_ds_shift, Cache_uncached = Dataspace::Map_uncacheable << Caching_ds_shift, Region_flags = Caching | 0x0f } |
Flags for regions. More... | |
enum | Attach_flags { Search_addr = 0x20, In_area = 0x40, Eager_map = 0x80, Attach_flags = 0xf0 } |
Flags for attach operation. More... | |
enum | Detach_flags { Detach_exact = 1, Detach_overlap = 2, Detach_keep = 4 } |
Flags for detach operation. More... | |
Public Member Functions | |
long | reserve_area (l4_addr_t *start, unsigned long size, unsigned flags=0, unsigned char align=L4_PAGESHIFT) const throw () |
Reserve the given area in the region map. More... | |
template<typename T > | |
long | reserve_area (T **start, unsigned long size, unsigned flags=0, unsigned char align=L4_PAGESHIFT) const throw () |
Reserve the given area in the region map. More... | |
long | free_area (l4_addr_t addr) |
Free an area from the region map. More... | |
long | attach (l4_addr_t *start, unsigned long size, unsigned long flags, L4::Ipc::Cap< Dataspace > mem, l4_addr_t offs=0, unsigned char align=L4_PAGESHIFT) const throw () |
Attach a data space to a region. More... | |
template<typename T > | |
long | attach (T **start, unsigned long size, unsigned long flags, L4::Ipc::Cap< Dataspace > mem, l4_addr_t offs=0, unsigned char align=L4_PAGESHIFT) const throw () |
Attach a data space to a region. More... | |
int | detach (l4_addr_t addr, L4::Cap< Dataspace > *mem, L4::Cap< L4::Task > const &task=This_task) const throw () |
Detach a region from the address space. More... | |
int | detach (void *addr, L4::Cap< Dataspace > *mem, L4::Cap< L4::Task > const &task=This_task) const throw () |
Detach a region from the address space. More... | |
int | detach (l4_addr_t start, unsigned long size, L4::Cap< Dataspace > *mem, L4::Cap< L4::Task > const &task) const throw () |
Detach all regions of the specified interval. More... | |
int | find (l4_addr_t *addr, unsigned long *size, l4_addr_t *offset, unsigned *flags, L4::Cap< Dataspace > *m) throw () |
Find a region given an address and size. More... | |
![]() | |
l4_msgtag_t | page_fault (l4_umword_t pfa, l4_umword_t pc, L4::Ipc::Opt< l4_mword_t &> result, L4::Ipc::Rcv_fpage rwin, L4::Ipc::Opt< L4::Ipc::Snd_fpage &> fp) |
Page-fault protocol message. More... | |
![]() | |
l4_msgtag_t | io_page_fault (l4_fpage_t io_pfa, l4_umword_t pc, L4::Ipc::Opt< l4_mword_t &> result, L4::Ipc::Rcv_fpage rwin, L4::Ipc::Opt< L4::Ipc::Snd_fpage &> fp) |
IO page fault protocol message. More... | |
Additional Inherited Members | |
![]() | |
typedef Rm | Class |
The target interface type (inheriting from Kobject_t) | |
typedef Typeid::Iface< PROTO, Rm > | __Iface |
The interface description for the derived class. | |
typedef Typeid::Merge_list< Typeid::Iface_list< __Iface >, typename L4::Pager ::__Iface_list > | __Iface_list |
The list of all RPC interfaces provided directly or through inheritance. | |
![]() | |
typedef Pager | Class |
The target interface type (inheriting from Kobject_t) | |
typedef Typeid::Iface< PROTO, Pager > | __Iface |
The interface description for the derived class. | |
typedef Typeid::Merge_list< Typeid::Iface_list< __Iface >, typename Io_pager ::__Iface_list > | __Iface_list |
The list of all RPC interfaces provided directly or through inheritance. | |
![]() | |
L4::Cap< Class > | c () const |
Get the capability to ourselves. | |
![]() | |
L4::Cap< Class > | c () const |
Get the capability to ourselves. | |
![]() | |
static void | __check_protocols__ () |
Helper to check for protocol conflicts. | |
![]() | |
static void | __check_protocols__ () |
Helper to check for protocol conflicts. | |
Flags for detach operation.
Enumerator | |
---|---|
Detach_exact | Do an unmap of the exact region given. |
Detach_overlap | Do an unmap of all overlapping regions. |
Detach_keep | Do not free the detached data space, ignore the Detach_free. |
Flags for regions.
Enumerator | |
---|---|
Read_only | Region is read-only. |
Detach_free | Free the portion of the data space after detach. |
Pager | Region has a pager. |
Reserved | Region is reserved (blocked) |
Caching_shift | Start of Rm cache bits. |
Caching_ds_shift | |
Caching | Mask of all Rm cache bits. |
Cache_normal | Cache bits for normal cacheable memory. |
Cache_buffered | Cache bits for buffered (write combining) memory. |
Cache_uncached | Cache bits for uncached memory. |
Region_flags | Mask of all region flags. |
long L4Re::Rm::attach | ( | l4_addr_t * | start, |
unsigned long | size, | ||
unsigned long | flags, | ||
L4::Ipc::Cap< Dataspace > | mem, | ||
l4_addr_t | offs = 0 , |
||
unsigned char | align = L4_PAGESHIFT |
||
) | const | ||
throw | ( | ||
) |
Attach a data space to a region.
[in,out] | start | Virtual start address where the region manager shall attach the data space. If L4Re::Rm::Search_addr is given this value is used as the start address to search for a free virtual memory region and the resulting address is returned here. If L4Re::Rm::In_area is given the value is used as a selector for the area (see L4Re::Rm::reserve_area) to attach the data space to. |
size | Size of the data space to attach (in bytes) | |
flags | Flags, see L4Re::Rm::Attach_flags and L4Re::Rm::Region_flags. If the Eager_map flag is set this function may also return L4Re::Dataspace::map error codes if the mapping fails. | |
mem | Data space | |
offs | Offset into the data space to use | |
align | Alignment of the virtual region, log2-size, default: a page (L4_PAGESHIFT). This is only meaningful if the L4Re::Rm::Search_addr flag is used. |
0 | Success |
-L4_ENOENT | No area could be found (see L4Re::Rm::In_area) |
-L4_EPERM | Operation not allowed. |
-L4_EINVAL | |
-L4_EADDRNOTAVAIL | The given address is not available. |
<0 | IPC errors |
Makes the whole or parts of a data space visible in the virtual memory of the corresponding task. The corresponding region in the virtual address space is backed with the contents of the dataspace.
Definition at line 43 of file rm_impl.h.
References L4::Ipc::Cap< T >::cap(), detach(), L4::Cap_base::is_valid(), L4_FP_ALL_SPACES, l4_fpage(), L4_FPAGE_RWX, L4_INVALID_CAP, L4_LOG2_PAGESIZE, l4_round_page(), L4_UNLIKELY, L4Re::Dataspace::map_region(), L4Re::Dataspace::Map_ro, L4Re::Dataspace::Map_rw, and L4::Task::unmap().
|
inline |
Attach a data space to a region.
[in,out] | start | Virtual start address where the region manager shall attach the data space. If L4Re::Rm::Search_addr is given this value is used as the start address to search for a free virtual memory region and the resulting address is returned here. If L4Re::Rm::In_area is given the value is used as a selector for the area (see L4Re::Rm::reserve_area) to attach the data space to. |
size | Size of the data space to attach (in bytes) | |
flags | Flags, see L4Re::Rm::Attach_flags and L4Re::Rm::Region_flags. If the Eager_map flag is set this function may also return L4Re::Dataspace::map error codes if the mapping fails. | |
mem | Data space | |
offs | Offset into the data space to use | |
align | Alignment of the virtual region, log2-size, default: a page (L4_PAGESHIFT). This is only meaningful if the L4Re::Rm::Search_addr flag is used. |
0 | Success |
-L4_ENOENT | No area could be found (see L4Re::Rm::In_area) |
-L4_EPERM | Operation not allowed. |
-L4_EINVAL | |
-L4_EADDRNOTAVAIL | The given address is not available. |
<0 | IPC errors |
Makes the whole or parts of a data space visible in the virtual memory of the corresponding task. The corresponding region in the virtual address space is backed with the contents of the dataspace.
Definition at line 347 of file rm.
References L4::Cap_base::is_valid(), and L4_PAGESHIFT.
|
inline |
Detach a region from the address space.
addr | Virtual address of region, any address within the region is valid. | |
[out] | mem | Dataspace that is affected. Give 0 if not interested. |
task | This argument specifies the task where the pages are unmapped. Provide L4::Cap<L4::Task>::Invalid for none. The default is the current task. |
Detach_result | On success. |
-L4_ENOENT | No region found. |
<0 | IPC errors |
Frees a region in the virtual address space given by addr (address type). The corresponding part of the address space is now available again.
Definition at line 591 of file rm.
Referenced by attach().
|
inline |
Detach a region from the address space.
addr | Virtual address of region, any address within the region is valid. | |
[out] | mem | Dataspace that is affected. Give 0 if not interested. |
task | This argument specifies the task where the pages are unmapped. Provide L4::Cap<L4::Task>::Invalid for none. The default is the current task. |
Detach_result | On success. |
-L4_ENOENT | No region found. |
<0 | IPC errors |
Frees a region in the virtual address space given by addr (address type). The corresponding part of the address space is now available again.
|
inline |
Detach all regions of the specified interval.
start | Start of area to detach, must be within region. | |
size | Size of of area to detach (in bytes). | |
[out] | mem | Dataspace that is affected. Give 0 if not interested. |
task | This argument specifies the task where the pages are unmapped. Provide L4::Cap<L4::Task>::Invalid for none. The default is the current task. |
Detach_result | On success. |
-L4_ENOENT | No region found. |
<0 | IPC errors |
Frees all regions within the interval given by start and size. If a region overlaps the start or the end of the interval this region is only detached partly. If the interval is within one region the original region is split up into two separate regions.
|
inline |
Find a region given an address and size.
addr | Address to look for | |
size | Size of the area to look for (in bytes). | |
[out] | addr | Start address of the found region. |
[out] | size | Size of the found region (in bytes). |
[out] | offset | Offset at the beginning of the region within the associated dataspace. |
[out] | flags | Region flags, see Region_flags (and In_area). |
[out] | m | Associated dataspace or paging service. |
0 | Success |
-L4_EPERM | Operation not allowed. |
-L4_ENOENT | No region found. |
<0 | IPC errors |
This function returns the properties of the region that contains the area described by the addr and size parameter. If no such region is found but a reserved area, the area is returned and In_area is set in `flags`. Note, in the case of an area the `offset` and `m` return values are invalid.
size-out / \ / \ addr-out \ ^________________\ ------------|----------------|------------------ | | Region | Dataspace | | |_______|___|____| | ------------|-------|---|----------------------- \ / |\ / \ / | |> size-in offset-out | |> addr-in
long L4Re::Rm::free_area | ( | l4_addr_t | addr | ) |
Free an area from the region map.
addr | An address within the area to free. |
0 | Success |
-L4_ENOENT | No area found. |
<0 | IPC errors |
|
inline |
Reserve the given area in the region map.
[in,out] | start | The virtual start address of the area to reserve. Returns the start address of the area. |
size | The size of the area to reserve (in bytes). | |
flags | Flags for the reserved area (see L4Re::Rm::Region_flags and L4Re::Rm::Attach_flags). | |
align | Alignment of area if searched as bits (log2 value). |
0 | Success |
-L4_EADDRNOTAVAIL | The given area cannot be reserved. |
<0 | IPC errors |
This function reserves an area within the virtual address space implemented by the region map. There are two kinds of areas available:
Definition at line 241 of file rm.
References L4_RPC_NF.
|
inline |
Reserve the given area in the region map.
[in,out] | start | The virtual start address of the area to reserve. Returns the start address of the area. |
size | The size of the area to reserve (in bytes). | |
flags | Flags for the reserved area (see Region_flags and Attach_flags). | |
align | Alignment of area if searched as bits (log2 value). |
0 | Success |
-L4_EADDRNOTAVAIL | The given area cannot be reserved. |
<0 | IPC errors |
For more information, please refer to the analogous function
Definition at line 267 of file rm.
References L4_PAGESHIFT, L4_RPC, and L4_RPC_NF.