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 <autoconf.h>
16#include <sel4vka/gen_config.h>
17#include <vka/vka.h>
18#include <vka/kobject_t.h>
19#include <utils/util.h>
20
21static inline int vka_alloc_vspace_root(vka_t *vka, vka_object_t *result)
22{
23    return vka_alloc_page_directory(vka, result);
24}
25
26/*
27 * Get the size (in bits) of the untyped memory required to create an object of
28 * the given size.
29 */
30static inline unsigned long vka_arm_mode_get_object_size(seL4_Word objectType)
31{
32    switch (objectType) {
33    case seL4_ARM_SectionObject:
34        return seL4_SectionBits;
35    case seL4_ARM_SuperSectionObject:
36        return seL4_SuperSectionBits;
37    default:
38        /* Unknown object type. */
39        ZF_LOGE("Unknown object type");
40        return -1;
41    }
42}
43
44