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 <vka/vka.h> 16#include <vka/kobject_t.h> 17#include <utils/util.h> 18 19static inline int vka_alloc_pdpt(vka_t *vka, vka_object_t *result) 20{ 21 return vka_alloc_object(vka, kobject_get_type(KOBJECT_PDPT, 0), seL4_PDPTBits, result); 22} 23 24LEAKY(pdpt) 25 26static inline unsigned long 27vka_x86_mode_get_object_size(seL4_Word objectType) 28{ 29 switch (objectType) { 30 case seL4_IA32_PDPTObject: 31 return seL4_PDPTBits; 32 default: 33 /* Unknown object type. */ 34 ZF_LOGE("Unknown object type %ld", (long)objectType); 35 return -1; 36 } 37} 38 39static inline int vka_alloc_vspace_root(vka_t *vka, vka_object_t *result) 40{ 41#ifdef CONFIG_PAE_PAGING 42 return vka_alloc_pdpt(vka, result); 43#else 44 return vka_alloc_page_directory(vka, result); 45#endif 46} 47 48