16#include <l4/bid_config.h>
19#if defined(CONFIG_L4RE_BITMAP_CAP_ALLOC)
23namespace L4Re {
namespace Util {
25using _Cap_alloc_impl = Cap_alloc_base;
29#elif defined(CONFIG_L4RE_COUNTING_CAP_ALLOC)
32#include <l4/re/util/debug>
34namespace L4Re {
namespace Util {
39#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1) || defined(ARCH_arm) || defined(ARCH_riscv)
41 = Counting_cap_alloc<L4Re::Util::Counter_atomic<unsigned char>,
43#elif defined(ARCH_sparc)
45 = Counting_cap_alloc<L4Re::Util::Counter<unsigned char>,
47#warning "Thread-safe capability allocator not available!"
49#error "Unsupported platform"
55#error "No supported capability allocator selected"
58namespace L4Re {
namespace Util {
69 template <
unsigned COUNT>
70 using Storage = _Cap_alloc_impl::Storage<COUNT>;
72 using _Cap_alloc_impl::_Cap_alloc_impl;
73 void operator delete(
void *) {}
76 {
return _Cap_alloc_impl::alloc(); }
78 template<
typename T >
80 {
return L4::cap_cast<T>(
alloc()); }
83 { _Cap_alloc_impl::take(cap); }
87 { _Cap_alloc_impl::free(cap, task, unmap_flags); }
90 unsigned unmap_flags)
noexcept override
91 {
return _Cap_alloc_impl::release(cap, task, unmap_flags); }
93 using _Cap_alloc_impl::last;
Bitmap capability allocator.
Abstract capability-allocator interface.
Capability allocator interface.
Adapter to expose the cap allocator implementation as L4Re::Cap_alloc compatible class.
L4::Cap< void > alloc() noexcept override
Allocate a capability.
void free(L4::Cap< void > cap, l4_cap_idx_t task=L4_INVALID_CAP, unsigned unmap_flags=L4_FP_ALL_SPACES) noexcept override
Free a capability.
L4::Cap< T > alloc() noexcept
Allocate a capability.
C++ interface for capabilities.
Reference-counting capability allocator.
unsigned long l4_cap_idx_t
Capability selector type.
@ L4_INVALID_CAP
Invalid capability selector.
@ L4_FP_ALL_SPACES
Flag to tell the unmap operation to revoke permissions from all child mappings including the mapping ...