L4Re - L4 Runtime Environment
|
Interface for memory-like objects. More...
Data Structures | |
struct | Stats |
Information about the dataspace. More... | |
Public Types | |
enum | Map_flags { Map_ro = 0, Map_rw = 1, Map_normal = 0x00, Map_cacheable = Map_normal, Map_bufferable = 0x10, Map_uncacheable = 0x20, Map_caching_mask = 0x30, Map_caching_shift = 4 } |
Flags for map operations. More... | |
Public Member Functions | |
long | map (l4_addr_t offset, unsigned long flags, l4_addr_t local_addr, l4_addr_t min_addr, l4_addr_t max_addr) const throw () |
Request a flex-page mapping from the dataspace. More... | |
long | map_region (l4_addr_t offset, unsigned long flags, l4_addr_t min_addr, l4_addr_t max_addr) const throw () |
Map a part of a dataspace completely. More... | |
long | clear (l4_addr_t offset, unsigned long size) |
Clear parts of a dataspace. More... | |
long | allocate (l4_addr_t offset, l4_size_t size) |
Allocate a range in the dataspace. More... | |
long | copy_in (l4_addr_t dst_offs, L4::Ipc::Cap< Dataspace > src, l4_addr_t src_offs, unsigned long size) |
Copy contents from another dataspace. More... | |
long | phys (l4_addr_t offset, l4_addr_t &phys_addr, l4_size_t &phys_size) |
Get the physical addresses of a dataspace. More... | |
unsigned long | size () const throw () |
Get size of a dataspace. More... | |
long | flags () const throw () |
Get flags of the dataspace. More... | |
long | info (Stats *stats) |
Get information on the dataspace. More... | |
![]() | |
l4_msgtag_t | dec_refcnt (l4_mword_t diff, l4_utcb_t *utcb=l4_utcb()) |
Decrement the in kernel reference counter for the object. More... | |
Additional Inherited Members | |
![]() | |
typedef Dataspace | Class |
The target interface type (inheriting from Kobject_t) | |
typedef Typeid::Iface< PROTO, Dataspace > | __Iface |
The interface description for the derived class. | |
typedef Typeid::Merge_list< Typeid::Iface_list< __Iface >, typename L4::Kobject ::__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_idx_t | cap () const throw () |
Return capability selector. More... | |
![]() | |
static void | __check_protocols__ () |
Helper to check for protocol conflicts. | |
Interface for memory-like objects.
Dataspaces are a central abstraction provided by L4Re. A dataspace is an abstraction for any thing that is available via usual memory access instructions. A dataspace can be a file, as well as the memory-mapped registers of a device, or anonymous memory, such as a heap.
The dataspace interface defines a set of methods that allow any kind of dataspace to be attached (mapped) to the virtual address space of an L4 task and then be accessed via memory-access instructions. The L4Re::Rm interface can be used to attach a dataspace to a virtual address space of a task paged by a certain instance of a region map.
Flags for map operations.
Allocate a range in the dataspace.
offset | Offset in the dataspace, in bytes. |
size | Size of the range, in bytes. |
L4_EOK | Success |
-L4_ERANGE | Given range is outside the dataspace. (A dataspace provider may also silently ignore areas outside the dataspace.) |
-L4_ENOMEM | Not enough memory available. |
<0 | IPC errors |
On success, at least the given range is guaranteed to be allocated. The dataspace manager may also allocate more memory due to page granularity.
The memory is allocated with the same rights as the dataspace capability.
long L4Re::Dataspace::clear | ( | l4_addr_t | offset, |
unsigned long | size | ||
) |
Clear parts of a dataspace.
offset | Offset within dataspace (in bytes). |
size | Size of region to clear (in bytes). |
>=0 | Success. |
-L4_ERANGE | Given range is outside the dataspace. (A dataspace provider may also silently ignore areas outside the dataspace.) |
-L4_EACCESS | Dataspace is read-only. |
<0 | IPC errors |
Zeroes out the memory. Depending on the type of memory the memory could also be deallocated and replaced by a shared zero-page.
long L4Re::Dataspace::copy_in | ( | l4_addr_t | dst_offs, |
L4::Ipc::Cap< Dataspace > | src, | ||
l4_addr_t | src_offs, | ||
unsigned long | size | ||
) |
Copy contents from another dataspace.
dst_offs | Offset in destination dataspace. |
src | Source dataspace to copy from. |
src_offs | Offset in the source dataspace. |
size | Size to copy (in bytes). |
L4_EOK | Success |
-L4_EACCESS | Destination dataspace not writable. |
-L4_EINVAL | Invalid parameter supplied. |
<0 | IPC errors |
The copy operation may use copy-on-write mechanisms. The operation may also fail if both dataspaces are not from the same dataspace manager or the dataspace managers do not cooperate.
long L4Re::Dataspace::flags | ( | ) | const | |
throw | ( | |||
) |
Get flags of the dataspace.
>=0 | Flags of the dataspace |
<0 | IPC errors |
Definition at line 116 of file dataspace_impl.h.
long L4Re::Dataspace::info | ( | Stats * | stats | ) |
Get information on the dataspace.
[out] | stats | Dataspace information |
0 | Success |
<0 | IPC errors |
long L4Re::Dataspace::map | ( | l4_addr_t | offset, |
unsigned long | flags, | ||
l4_addr_t | local_addr, | ||
l4_addr_t | min_addr, | ||
l4_addr_t | max_addr | ||
) | const | ||
throw | ( | ||
) |
Request a flex-page mapping from the dataspace.
offset | Offset to start within dataspace |
flags | map flags, see Map_flags. |
local_addr | Local address to map to. |
min_addr | Defines start of receive window. (Rounded down to page size.) |
max_addr | Defines end of receive window. (Rounded up to page size.) |
L4_EOK | Success |
-L4_ERANGE | Invalid offset. |
-L4_EPERM | Insufficient permission to map with requested rights. |
<0 | IPC errors |
The map call will attempt to map the largest possible flexpage that covers the given local address and still fits into the region defined by min_addr
and max_addr
. If the given region is invalid or does not overlap the local address, the smallest valid page size is used.
Definition at line 92 of file dataspace_impl.h.
References l4_fpage_max_order(), L4_LOG2_PAGESIZE, l4_round_page(), and l4_trunc_page().
long L4Re::Dataspace::map_region | ( | l4_addr_t | offset, |
unsigned long | flags, | ||
l4_addr_t | min_addr, | ||
l4_addr_t | max_addr | ||
) | const | ||
throw | ( | ||
) |
Map a part of a dataspace completely.
offset | Offset to start within dataspace |
flags | map flags, see Map_flags. |
min_addr | Defines start of receive window. (Rounded down to page size.) |
max_addr | Defines end of receive window. (Rounded up to page size.) |
L4_EOK | Success |
-L4_ERANGE | Invalid offset. |
-L4_EPERM | Insufficient permission to map with requested rights. |
<0 | IPC errors |
Definition at line 55 of file dataspace_impl.h.
References l4_fpage_max_order(), L4_LOG2_PAGESIZE, l4_round_page(), l4_round_size(), l4_trunc_page(), l4_trunc_size(), and L4_UNLIKELY.
Referenced by L4Re::Rm::attach().
Get the physical addresses of a dataspace.
offset | Offset in dataspace |
phys_addr | Physical address. |
phys_size | Size of largest physically contiguous region in the dataspace after phys_addr (in bytes). |
L4_EOK | Success |
-L4_EINVAL | Dataspace is not pinned. |
<0 | IPC errors |
This call will only succeed on pinned memory dataspaces.
unsigned long L4Re::Dataspace::size | ( | ) | const | |
throw | ( | |||
) |
Get size of a dataspace.
Definition at line 106 of file dataspace_impl.h.