33typedef TokenKey SKey __attribute__((deprecated(
"SKey renamed to TokenKey")));
73__cheri_compartment(
"allocator")
75 AllocatorCapability heapCapability,
87__cheri_compartment(
"allocator")
89 AllocatorCapability heapCapability,
108[[cheriot::interrupt_state(disabled)]]
void *
121[[cheriot::interrupt_state(disabled)]]
void *
135[[cheriot::interrupt_state(disabled)]]
void *
146extern "C++" template<
typename T>
152 return static_cast<CHERI_SEALED(T *)
>(
162 return __builtin_cheri_address_get(
object) & 0x7;
173int __cheri_compartment(
"allocator")
176 CHERI_SEALED(
void *));
185int __cheri_compartment(
"allocator")
188 CHERI_SEALED(
void *)
object);
206# if __has_extension(cheri_sealed_pointers) && \
207 !defined(CHERIOT_NO_SEALED_POINTERS)
247 return __builtin_cheri_tag_get(get());
258__always_inline std::pair<T *, Sealed<T>>
260 AllocatorCapability heapCapability,
267 void *unsealed =
nullptr;
270 timeout, heapCapability, key,
sizeof(T), &unsealed);
271 return {
static_cast<T *
>(unsealed),
272#
if __has_extension(cheri_sealed_pointers) && \
273 !defined(CHERIOT_NO_SEALED_POINTERS)
274 static_cast<CHERI_SEALED(T *)
>(sealed)
299#if __has_extension(cheri_sealed_pointers) && \
300 !defined(CHERIOT_NO_SEALED_POINTERS)
308# define token_unseal(key, sealed) \
309 ((__typeof__(*(sealed)) *)token_obj_unseal(key, sealed))
Helper template for representing a sealed capability created by the allocator's token API.
CHERI_SEALED(T *) get()
Explicitly convert to the real type.
bool is_valid()
Return the tag of the underlying pointer.
Sealed(U *sealedPointer)
Explicit constructor from a sealed T*.
operator decltype sealedPointer()
Implicitly convert back to the wrapped value.
This file contains the types used for timeouts across scheduler APIs.
token_sealed_alloc(TimeoutArgument timeout, AllocatorCapability heapCapability, TokenKey, size_t)
Same as token_sealed_unsealed_alloc() without getting the unsealed capability.
T * token_unseal(TokenKey key, Sealed< T > sealed)
Type-safe helper that unseal a Sealed<T> and returns a T*.
std::pair< T *, Sealed< T > > token_allocate(TimeoutArgument timeout, AllocatorCapability heapCapability, TokenKey key)
Type-safe helper to allocate a sealed T*.
TokenKey SKey
The old name for TokenKey, do not use in new code.
token_sealed_unsealed_alloc(TimeoutArgument timeout, AllocatorCapability heapCapability, TokenKey key, size_t sz, void **unsealed)
Allocate a new object with size sz.
static int token_permissions_get(CHERI_SEALED(void *) object)
Returns the user permissions bitmap for the sealed object.
void *__cheri_libcall token_obj_unseal_dynamic(TokenKey, CHERI_SEALED(void *))
Unseal the object given the key.
int token_obj_can_destroy(AllocatorCapability heapCapability, TokenKey key, CHERI_SEALED(void *) object)
Check whether the pair of a sealing key and a heap capability can free a sealed object.
void *__cheri_libcall token_obj_unseal_static(TokenKey, CHERI_SEALED(void *))
Unseal the object given the key.
TokenKey token_key_new(void)
Create a new sealing key.
int token_obj_destroy(AllocatorCapability heapCapability, TokenKey, CHERI_SEALED(void *))
Destroy the object given its key, freeing memory.
token_permissions_and(CHERI_SEALED(T *) object, int permissions)
Mask the user permissions of a sealed object.
void *__cheri_libcall token_obj_unseal(TokenKey, CHERI_SEALED(void *))
Unseal the object given the key.
struct TokenKeyType * TokenKey
Sealing keys in CHERI are represented as capabilities.