1/*
2 * Copyright 2017, Data61
3 * Commonwealth Scientific and Industrial Research Organisation (CSIRO)
4 * ABN 41 687 119 230.
5 *
6 * This software may be distributed and modified according to the terms of
7 * the BSD 2-Clause license. Note that NO WARRANTY is provided.
8 * See "LICENSE_BSD2.txt" for details.
9 *
10 * @TAG(DATA61_BSD)
11 */
12
13#pragma once
14
15#include <sel4/sel4.h>
16#include <stdlib.h>
17
18/* Provide a resource to the (initially empty) cap allocator. You are expected
19 * to describe the type, CSpace pointer to it and its attributes if relevant.
20 * Returns 0 on success.
21 */
22int camkes_provide(seL4_ObjectType type, seL4_CPtr ptr, size_t size,
23                   unsigned attributes);
24
25/* Allocate a seL4 object. Flags should be specified as a bitmask of the
26 * attributes the caller requires of the object. Returns a pointer to a cap to
27 * the object on success or seL4_CapNull on failure.
28 */
29seL4_CPtr camkes_alloc(seL4_ObjectType type, size_t size, unsigned flags);
30
31/* Free a pointer that was allocated through this interface. Behaviour is
32 * undefined if you pass in a pointer that was not allocated by this allocator.
33 */
34void camkes_free(seL4_CPtr ptr);
35