L4Re - L4 Runtime Environment
|
Reference-counting cap allocator. More...
Public Member Functions | |
L4::Cap< void > | alloc () throw () |
Allocated a new capability. More... | |
template<typename T > | |
L4::Cap< T > | alloc () throw () |
Allocated a new capability. More... | |
void | take (L4::Cap< void > cap) throw () |
Increase the reference counter for the capability. More... | |
bool | free (L4::Cap< void > cap, l4_cap_idx_t task=L4_INVALID_CAP, unsigned unmap_flags=L4_FP_ALL_SPACES) throw () |
Free the capability. More... | |
bool | release (L4::Cap< void > cap, l4_cap_idx_t task=L4_INVALID_CAP, unsigned unmap_flags=L4_FP_ALL_SPACES) throw () |
Decrease the reference counter for a capability. More... | |
long | last () throw () |
Return highest capability id managed by this allocator. | |
Protected Member Functions | |
Counting_cap_alloc () throw () | |
Create a new, empty allocator. More... | |
void | setup (void *m, long capacity, long bias) throw () |
Set up the backing memory for the allocator. More... | |
Reference-counting cap allocator.
Definition at line 56 of file counting_cap_alloc.
|
inlineprotected |
Create a new, empty allocator.
Needs to be initialized with setup() before it can be used.
Definition at line 85 of file counting_cap_alloc.
|
inline |
Allocated a new capability.
Definition at line 110 of file counting_cap_alloc.
References L4::Cap_base::Invalid, and L4_CAP_SHIFT.
|
inline |
Allocated a new capability.
Definition at line 131 of file counting_cap_alloc.
References L4::cap_cast().
|
inline |
Free the capability.
cap | Capability to free. |
task | If set, task to unmap the capability from. |
unmap_flags | Flags for unmap, see l4_unmap_flags_t. |
Definition at line 172 of file counting_cap_alloc.
References l4_assert, L4_CAP_SHIFT, L4_INVALID_CAP, and l4_task_unmap().
Referenced by L4Re::Util::Object_registry::unregister_obj().
|
inline |
Decrease the reference counter for a capability.
cap | Capability to release. |
task | If set, task to unmap the capability from. |
unmap_flags | Flags for unmap, see l4_unmap_flags_t. |
Definition at line 211 of file counting_cap_alloc.
References L4::dec, l4_assert, L4_CAP_SHIFT, L4_INVALID_CAP, and l4_task_unmap().
|
inlineprotected |
Set up the backing memory for the allocator.
m | Pointer to backing memory. |
capacity | Number of capabilities that can be stored. |
bias | First capability id to use by this allocator. |
Definition at line 96 of file counting_cap_alloc.
|
inline |
Increase the reference counter for the capability.
cap | Capability, whose reference counter should be increased. |
If the capability was still free, it will be automatically allocated. Silently does nothing if the capability is not managed by this allocator.
Definition at line 146 of file counting_cap_alloc.
References L4_CAP_SHIFT.