31#include <l4/sys/task.h>
33namespace L4Re {
namespace Util {
46 template <
unsigned COUNT>
52 enum State { Free = 0, Allocated, Unknown };
54 noexcept : _bias(bias), _items(max, mem) {}
58 long cap = _items.alloc();
65 long hint()
const {
return _items.hint(); }
70 template<
typename T >
82 if (idx >= _items.size())
85 return _items.is_allocated(idx) ? Allocated : Free;
100 if (idx >= _items.size())
119 return _items.size() + _bias - 1;
124class Cap_alloc :
public Cap_alloc_base
127 typename Bitmap_base::Word<Size>::Type _bits[Bitmap_base::Word<Size>::Size];
130 explicit Cap_alloc(
long bias = 0) noexcept
131 : Cap_alloc_base(Size, _bits, bias) {}
L4::Cap related definitions.
L4::Cap< T > alloc() noexcept
Allocate a capability slot.
void free(L4::Cap< T > const &cap, l4_cap_idx_t task=L4_INVALID_CAP, l4_umword_t unmap_flags=L4_FP_ALL_SPACES) noexcept
Free a capability slot.
C++ interface for capabilities.
Helper abstraction for a word contained in the bitmap.
unsigned long l4_umword_t
Unsigned machine word.
unsigned long l4_cap_idx_t
Capability selector type.
unsigned l4_is_valid_cap(l4_cap_idx_t c) L4_NOTHROW
Test if a capability selector is a valid selector.
@ L4_CAP_SHIFT
Capability index shift.
@ L4_INVALID_CAP
Invalid capability selector.
l4_msgtag_t l4_task_unmap(l4_cap_idx_t task, l4_fpage_t fpage, l4_umword_t map_mask) L4_NOTHROW
Revoke rights from the task.
@ L4_FP_ALL_SPACES
Flag to tell the unmap operation to revoke permissions from all child mappings including the mapping ...
Low-level assert implementation.
#define l4_assert(expr)
Low-level assert.