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/types.h>
16#include <assert.h>
17#include <autoconf.h>
18#include <sel4vka/gen_config.h>
19#include <utils/util.h>
20
21enum _x86_mode_kobject_type {
22    KOBJECT_PDPT,
23    KOBJECT_FRAME,
24    KOBJECT_MODE_NUM_TYPES,
25};
26
27typedef int kobject_t;
28
29/*
30 * Get the size (in bits) of the untyped memory required to
31 * create an object of the given size.
32 */
33static inline seL4_Word x86_mode_kobject_get_size(kobject_t type, seL4_Word UNUSED objectSize)
34{
35    switch (type) {
36    case KOBJECT_PDPT:
37        return seL4_PDPTBits;
38    default:
39        ZF_LOGE("Unknown object type");
40        return 0;
41    }
42}
43
44static inline seL4_Word x86_mode_kobject_get_type(kobject_t type, seL4_Word UNUSED objectSize)
45{
46    switch (type) {
47    case KOBJECT_PDPT:
48        return seL4_IA32_PDPTObject;
49    default:
50        /* Unknown object type. */
51        ZF_LOGE("Unknown object type %d", type);
52        return -1;
53    }
54}
55
56