L4Re – L4 Runtime Environment
|
Documentation of the L4 Runtime Environment utility functionality in C++. More...
Data Structures | |
class | Cap_alloc_base |
Capability allocator. More... | |
class | Br_manager |
Buffer-register (BR) manager for L4::Server. More... | |
struct | Br_manager_hooks |
Predefined server-loop hooks for a server loop using the Br_manager. More... | |
struct | Br_manager_timeout_hooks |
Predefined server-loop hooks for a server with using the Br_manager and a timeout queue. More... | |
class | Smart_cap_auto |
Helper for Unique_cap and Unique_del_cap. More... | |
class | Smart_count_cap |
Helper for Ref_cap and Ref_del_cap. More... | |
struct | Ref_cap |
Automatic capability that implements automatic free and unmap of the capability selector. More... | |
struct | Ref_del_cap |
Automatic capability that implements automatic free and unmap+delete of the capability selector. More... | |
struct | Counter |
Counter for Counting_cap_alloc with variable data width. More... | |
class | Counting_cap_alloc |
Internal reference-counting cap allocator. More... | |
class | Dataspace_svr |
Dataspace server class. More... | |
class | Event_t |
Convenience wrapper for getting access to an event object. More... | |
class | Event_buffer_t |
Event_buffer utility class. More... | |
class | Event_buffer_consumer_t |
An event buffer consumer. More... | |
class | Event_svr |
Convenience wrapper for implementing an event server. More... | |
class | Item_alloc_base |
Item allocator. More... | |
class | Object_registry |
A registry that manages server objects and their attached IPC gates for a single server loop for a specific thread. More... | |
class | Registry_server |
A server loop object which has a Object_registry included. More... | |
class | Vcon_svr |
Console server template class. More... | |
Typedefs | |
template<typename T > | |
using | Shared_cap = L4::Detail::Shared_cap_impl< T, Smart_count_cap< L4_FP_ALL_SPACES > > |
Shared capability that implements automatic free and unmap of the capability selector. More... | |
template<typename T > | |
using | shared_cap = L4::Detail::Shared_cap_impl< T, Smart_count_cap< L4_FP_ALL_SPACES > > |
Shared capability that implements automatic free and unmap of the capability selector. More... | |
template<typename T > | |
using | Shared_del_cap = L4::Detail::Shared_cap_impl< T, Smart_count_cap< L4_FP_DELETE_OBJ > > |
Shared capability that implements automatic free and unmap+delete of the capability selector. More... | |
template<typename T > | |
using | shared_del_cap = L4::Detail::Shared_cap_impl< T, Smart_count_cap< L4_FP_DELETE_OBJ > > |
Shared capability that implements automatic free and unmap+delete of the capability selector. More... | |
template<typename T > | |
using | Unique_cap = L4::Detail::Unique_cap_impl< T, Smart_cap_auto< L4_FP_ALL_SPACES > > |
Unique capability that implements automatic free and unmap of the capability selector. More... | |
template<typename T > | |
using | unique_cap = L4::Detail::Unique_cap_impl< T, Smart_cap_auto< L4_FP_ALL_SPACES > > |
Unique capability that implements automatic free and unmap of the capability selector. More... | |
template<typename T > | |
using | Unique_del_cap = L4::Detail::Unique_cap_impl< T, Smart_cap_auto< L4_FP_DELETE_OBJ > > |
Unique capability that implements automatic free and unmap+delete of the capability selector. More... | |
template<typename T > | |
using | unique_del_cap = L4::Detail::Unique_cap_impl< T, Smart_cap_auto< L4_FP_DELETE_OBJ > > |
Unique capability that implements automatic free and unmap+delete of the capability selector. More... | |
Functions | |
template<typename T > | |
Ref_cap< T >::Cap | make_ref_cap () |
Allocate a capability slot and wrap it in a Ref_cap. More... | |
template<typename T > | |
Ref_del_cap< T >::Cap | make_ref_del_cap () |
Allocate a capability slot and wrap it in a Ref_del_cap. More... | |
int | kumem_alloc (l4_addr_t *mem, unsigned pages_order, L4::Cap< L4::Task > task=L4Re::Env::env() ->task(), L4::Cap< L4Re::Rm > rm=L4Re::Env::env() ->rm()) noexcept |
Allocate state area. More... | |
template<typename T > | |
Shared_cap< T > | make_shared_cap () |
Allocate a capability slot and wrap it in a Shared_cap. More... | |
template<typename T > | |
Shared_del_cap< T > | make_shared_del_cap () |
Allocate a capability slot and wrap it in a Shared_del_cap. More... | |
template<typename T > | |
Unique_cap< T > | make_unique_cap () |
Allocate a capability slot and wrap it in an Unique_cap. More... | |
template<typename T > | |
Unique_del_cap< T > | make_unique_del_cap () |
Allocate a capability slot and wrap it in an Unique_del_cap. More... | |
Variables | |
_Cap_alloc & | cap_alloc |
Capability allocator. More... | |
Documentation of the L4 Runtime Environment utility functionality in C++.
using L4Re::Util::Shared_cap = typedef L4::Detail::Shared_cap_impl<T, Smart_count_cap<L4_FP_ALL_SPACES> > |
Shared capability that implements automatic free and unmap of the capability selector.
T | Type of the object the capability refers to. |
This shared capability implements a counted reference to a capability selector. The capability shall be unmapped and freed when the reference count in the allocator goes to zero.
Usage:
L4Re::Util::Shared_cap<L4Re::Dataspace> global_ds_cap; { L4Re::Util::Shared_cap<L4Re::Dataspace> ds_cap = make_shared_cap<L4Re::Dataspace>(); // reference count for the allocated cap selector is now 1 // use the dataspace cap L4Re::chksys(mem_alloc->alloc(4096, ds_cap.get())); global_ds_cap = ds_cap; // reference count is now 2 ... } // reference count dropped to 1 (ds_cap is no longer existing).
Definition at line 59 of file shared_cap.
using L4Re::Util::shared_cap = typedef L4::Detail::Shared_cap_impl<T, Smart_count_cap<L4_FP_ALL_SPACES> > |
Shared capability that implements automatic free and unmap of the capability selector.
T | Type of the object the capability refers to. |
This shared capability implements a counted reference to a capability selector. The capability shall be unmapped and freed when the reference count in the allocator goes to zero.
Usage:
L4Re::Util::Shared_cap<L4Re::Dataspace> global_ds_cap; { L4Re::Util::Shared_cap<L4Re::Dataspace> ds_cap = make_shared_cap<L4Re::Dataspace>(); // reference count for the allocated cap selector is now 1 // use the dataspace cap L4Re::chksys(mem_alloc->alloc(4096, ds_cap.get())); global_ds_cap = ds_cap; // reference count is now 2 ... } // reference count dropped to 1 (ds_cap is no longer existing).
Definition at line 62 of file shared_cap.
using L4Re::Util::Shared_del_cap = typedef L4::Detail::Shared_cap_impl<T, Smart_count_cap<L4_FP_DELETE_OBJ> > |
Shared capability that implements automatic free and unmap+delete of the capability selector.
T | Type of the object the capability refers to. |
This shared capability implements a counted reference to a capability selector. The capability shall be unmapped and freed when the reference count in the allocator goes to zero. The main difference to Shared_cap is that the unmap is done with the deletion flag enabled and this leads to the deletion of the object if the current task holds appropriate deletion rights.
Usage:
L4Re::Util::Shared_del_cap<L4Re::Dataspace> global_ds_cap; { L4Re::Util::Shared_del_cap<L4Re::Dataspace> ds_cap = make_shared_del_cap<L4Re::Dataspace>(); // reference count for the allocated cap selector is now 1 // use the dataspace cap L4Re::chksys(mem_alloc->alloc(4096, ds_cap.get())); global_ds_cap = ds_cap; // reference count is now 2 ... } // reference count dropped to 1 (ds_cap is no longer existing). ... global_ds_cap = L4_INVALID_CAP; // reference count dropped to 0 (data space shall be deleted).
Definition at line 109 of file shared_cap.
using L4Re::Util::shared_del_cap = typedef L4::Detail::Shared_cap_impl<T, Smart_count_cap<L4_FP_DELETE_OBJ> > |
Shared capability that implements automatic free and unmap+delete of the capability selector.
T | Type of the object the capability refers to. |
This shared capability implements a counted reference to a capability selector. The capability shall be unmapped and freed when the reference count in the allocator goes to zero. The main difference to Shared_cap is that the unmap is done with the deletion flag enabled and this leads to the deletion of the object if the current task holds appropriate deletion rights.
Usage:
L4Re::Util::Shared_del_cap<L4Re::Dataspace> global_ds_cap; { L4Re::Util::Shared_del_cap<L4Re::Dataspace> ds_cap = make_shared_del_cap<L4Re::Dataspace>(); // reference count for the allocated cap selector is now 1 // use the dataspace cap L4Re::chksys(mem_alloc->alloc(4096, ds_cap.get())); global_ds_cap = ds_cap; // reference count is now 2 ... } // reference count dropped to 1 (ds_cap is no longer existing). ... global_ds_cap = L4_INVALID_CAP; // reference count dropped to 0 (data space shall be deleted).
Definition at line 112 of file shared_cap.
using L4Re::Util::Unique_cap = typedef L4::Detail::Unique_cap_impl<T, Smart_cap_auto<L4_FP_ALL_SPACES> > |
Unique capability that implements automatic free and unmap of the capability selector.
T | Type of the object the capability refers to. |
The ownership of the capability is managed in the same way as unique_ptr.
Usage:
{ L4Re::Util::Unique_cap<L4Re::Dataspace> ds_cap = L4Re::Util::make_unique_cap<L4Re::Dataspace>(); // use the dataspace cap L4Re::chksys(mem_alloc->alloc(L4_PAGESIZE, ds_cap.get())); ... // At the end of the scope ds_cap is unmapped and the capability // selector is freed. }
Definition at line 54 of file unique_cap.
using L4Re::Util::unique_cap = typedef L4::Detail::Unique_cap_impl<T, Smart_cap_auto<L4_FP_ALL_SPACES> > |
Unique capability that implements automatic free and unmap of the capability selector.
T | Type of the object the capability refers to. |
The ownership of the capability is managed in the same way as unique_ptr.
Usage:
{ L4Re::Util::Unique_cap<L4Re::Dataspace> ds_cap = L4Re::Util::make_unique_cap<L4Re::Dataspace>(); // use the dataspace cap L4Re::chksys(mem_alloc->alloc(L4_PAGESIZE, ds_cap.get())); ... // At the end of the scope ds_cap is unmapped and the capability // selector is freed. }
Definition at line 57 of file unique_cap.
using L4Re::Util::Unique_del_cap = typedef L4::Detail::Unique_cap_impl<T, Smart_cap_auto<L4_FP_DELETE_OBJ> > |
Unique capability that implements automatic free and unmap+delete of the capability selector.
T | Type of the object the capability refers to. |
The main difference to Unique_cap is that the unmap is done with the deletion flag enabled and this leads to the deletion of the object if the current task holds appropriate deletion rights.
Usage:
{ L4Re::Util::Unique_del_cap<L4Re::Dataspace> ds_cap = make_unique_del_cap<L4Re::Dataspace>()); // use the dataspace cap L4Re::chksys(mem_alloc->alloc(L4_PAGESIZE, ds_cap.get())); ... // At the end of the scope ds_cap is unmapped and the capability // selector is freed. Because the deletion flag is set the data space // shall also be deleted (even if there are other references to this // data space). }
Definition at line 97 of file unique_cap.
using L4Re::Util::unique_del_cap = typedef L4::Detail::Unique_cap_impl<T, Smart_cap_auto<L4_FP_DELETE_OBJ> > |
Unique capability that implements automatic free and unmap+delete of the capability selector.
T | Type of the object the capability refers to. |
The main difference to Unique_cap is that the unmap is done with the deletion flag enabled and this leads to the deletion of the object if the current task holds appropriate deletion rights.
Usage:
{ L4Re::Util::Unique_del_cap<L4Re::Dataspace> ds_cap = make_unique_del_cap<L4Re::Dataspace>()); // use the dataspace cap L4Re::chksys(mem_alloc->alloc(L4_PAGESIZE, ds_cap.get())); ... // At the end of the scope ds_cap is unmapped and the capability // selector is freed. Because the deletion flag is set the data space // shall also be deleted (even if there are other references to this // data space). }
Definition at line 100 of file unique_cap.
|
noexcept |
Allocate state area.
[out] | mem | Pointer to memory that has been allocated. |
pages_order | Size to allocate, in log2 pages. | |
task | Task to use for allocation. | |
rm | Region manager to use for allocation. |
0 | for success |
<0 | error code on failure |
Ref_cap<T>::Cap L4Re::Util::make_ref_cap | ( | ) |
Allocate a capability slot and wrap it in a Ref_cap.
T | Type of capability the slot is used for. |
Definition at line 218 of file cap_alloc.
References L4Re::Util::Counting_cap_alloc< COUNTERTYPE >::alloc(), and cap_alloc.
Ref_del_cap<T>::Cap L4Re::Util::make_ref_del_cap | ( | ) |
Allocate a capability slot and wrap it in a Ref_del_cap.
T | Type of capability the slot is used for. |
Definition at line 227 of file cap_alloc.
References L4Re::Util::Counting_cap_alloc< COUNTERTYPE >::alloc(), and cap_alloc.
Shared_cap<T> L4Re::Util::make_shared_cap | ( | ) |
Allocate a capability slot and wrap it in a Shared_cap.
T | Type of the object the capability refers to. |
Definition at line 71 of file shared_cap.
References L4Re::Util::Counting_cap_alloc< COUNTERTYPE >::alloc(), and cap_alloc.
Shared_del_cap<T> L4Re::Util::make_shared_del_cap | ( | ) |
Allocate a capability slot and wrap it in a Shared_del_cap.
T | Type of the object the capability refers to. |
Definition at line 121 of file shared_cap.
References L4Re::Util::Counting_cap_alloc< COUNTERTYPE >::alloc(), and cap_alloc.
Unique_cap<T> L4Re::Util::make_unique_cap | ( | ) |
Allocate a capability slot and wrap it in an Unique_cap.
T | Type of the object the capability refers to. |
Definition at line 66 of file unique_cap.
References L4Re::Util::Counting_cap_alloc< COUNTERTYPE >::alloc(), and cap_alloc.
Unique_del_cap<T> L4Re::Util::make_unique_del_cap | ( | ) |
Allocate a capability slot and wrap it in an Unique_del_cap.
T | Type of the object the capability refers to. |
Definition at line 109 of file unique_cap.
References L4Re::Util::Counting_cap_alloc< COUNTERTYPE >::alloc(), and cap_alloc.
|
extern |
Capability allocator.
This is the instance of the capability allocator that is used by usual applications. The actual implementation of the allocator depends on the configuration of the system.
Per default we use Counting_cap_alloc, a reference-counting capability allocator, that keeps a reference counter for each managed capability selector.
Referenced by L4Re::Util::Smart_count_cap< Unmap_flags >::copy(), L4Re::Util::Smart_cap_auto< Unmap_flags >::free(), L4Re::Util::Smart_count_cap< Unmap_flags >::free(), make_ref_cap(), make_ref_del_cap(), make_shared_cap(), make_shared_del_cap(), make_unique_cap(), make_unique_del_cap(), and L4Re::Util::Object_registry::unregister_obj().