1/* 2 * Copyright 2018, 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#include <vspace/mapping.h> 14 15int vspace_get_map_obj(seL4_Word failed_bits, vspace_map_obj_t *obj) { 16 if (unlikely(obj == NULL)) { 17 return EINVAL; 18 } 19 20 switch (failed_bits) { 21 case SEL4_MAPPING_LOOKUP_NO_PT: 22 obj->size_bits = seL4_PageTableBits; 23 obj->type = seL4_X86_PageTableObject; 24 obj->map_fn = seL4_X86_PageTable_Map; 25 return 0; 26 case SEL4_MAPPING_LOOKUP_NO_PD: 27 obj->size_bits = seL4_PageDirBits; 28 obj->type = seL4_X86_PageDirectoryObject; 29 obj->map_fn = seL4_X86_PageDirectory_Map; 30 return 0; 31 case SEL4_MAPPING_LOOKUP_NO_PDPT: 32 obj->size_bits = seL4_PDPTBits, 33 obj->type = seL4_X86_PDPTObject; 34 obj->map_fn = seL4_X86_PDPT_Map; 35 return 0; 36 default: 37 return EINVAL; 38 } 39} 40