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_ARM_PageTableObject; 24 obj->map_fn = seL4_ARM_PageTable_Map; 25 return 0; 26 case SEL4_MAPPING_LOOKUP_NO_PD: 27 obj->size_bits = seL4_PageDirBits; 28 obj->type = seL4_ARM_PageDirectoryObject; 29 obj->map_fn = seL4_ARM_PageDirectory_Map; 30 return 0; 31#if !(defined CONFIG_ARM_HYPERVISOR_SUPPORT && defined CONFIG_ARM_PA_SIZE_BITS_40) 32 case SEL4_MAPPING_LOOKUP_NO_PUD: 33 obj->size_bits = seL4_PUDBits; 34 obj->type = seL4_ARM_PageUpperDirectoryObject; 35 obj->map_fn = seL4_ARM_PageUpperDirectory_Map; 36 return 0; 37#endif 38 default: 39 return EINVAL; 40 } 41} 42