1/* 2 * Copyright 2014, General Dynamics C4 Systems 3 * 4 * This software may be distributed and modified according to the terms of 5 * the GNU General Public License version 2. Note that NO WARRANTY is provided. 6 * See "LICENSE_GPLv2.txt" for details. 7 * 8 * @TAG(GD_GPL) 9 */ 10 11#ifndef __ARCH_MODE_KERNEL_VSPACE_H 12#define __ARCH_MODE_KERNEL_VSPACE_H 13 14#include <config.h> 15#include <types.h> 16#include <api/failures.h> 17#include <object/structures.h> 18 19/* PD slot reserved for storing the PD's allocated hardware ASID */ 20#define PD_ASID_SLOT (0xff000000 >> (PT_INDEX_BITS + PAGE_BITS)) 21 22enum pde_pte_tag { 23 ME_PDE, 24 ME_PTE 25}; 26typedef word_t pde_pte_tag_t; 27 28struct createMappingEntries_ret { 29 exception_t status; 30 pde_pte_tag_t tag; 31 void *pde_pte_ptr; 32 unsigned int offset; 33 word_t size; 34}; 35typedef struct createMappingEntries_ret createMappingEntries_ret_t; 36 37struct findPDForASID_ret { 38 exception_t status; 39 pde_t *pd; 40}; 41typedef struct findPDForASID_ret findPDForASID_ret_t; 42 43struct lookupPTSlot_ret { 44 exception_t status; 45 pte_t *ptSlot; 46}; 47typedef struct lookupPTSlot_ret lookupPTSlot_ret_t; 48 49#ifdef CONFIG_ARM_HYPERVISOR_SUPPORT 50hw_asid_t getHWASID(asid_t asid); 51#endif 52void copyGlobalMappings(pde_t *newPD); 53findPDForASID_ret_t findPDForASID(asid_t asid); 54lookupPTSlot_ret_t lookupPTSlot(pde_t *pd, vptr_t vptr); 55pde_t* CONST lookupPDSlot(pde_t *pd, vptr_t vptr); 56void deleteASIDPool(asid_t base, asid_pool_t* pool); 57void deleteASID(asid_t asid, pde_t* pd); 58void unmapPageTable(asid_t asid, vptr_t vaddr, pte_t* pt); 59void unmapPage(vm_page_size_t page_size, asid_t asid, vptr_t vptr, void *pptr); 60hw_asid_t getHWASID(asid_t asid); 61hw_asid_t findFreeHWASID(void); 62void flushPage(vm_page_size_t page_size, pde_t* pd, asid_t asid, word_t vptr); 63void flushTable(pde_t* pd, asid_t asid, word_t vptr, pte_t* pt); 64void flushSpace(asid_t asid); 65void invalidateTLBByASID(asid_t asid); 66 67bool_t CONST isIOSpaceFrameCap(cap_t cap); 68 69/* Reserved memory ranges */ 70static const region_t BOOT_RODATA mode_reserved_region[] = { 71 { 72 (PD_ASID_SLOT + 0) << ARMSectionBits, 73 (PD_ASID_SLOT + 1) << ARMSectionBits 74 } 75}; 76 77#endif /* __ARCH_MODE_KERNEL_VSPACE_H */ 78