1/** 2 * \file 3 * \brief Pmap definition common for the x86 archs 4 */ 5 6/* 7 * Copyright (c) 2009, ETH Zurich. 8 * All rights reserved. 9 * 10 * This file is distributed under the terms in the attached LICENSE file. 11 * If you do not find this file, copies can be found by writing to: 12 * ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group. 13 */ 14 15#ifndef TARGET_X86_BARRELFISH_PMAP_H 16#define TARGET_X86_BARRELFISH_PMAP_H 17 18#include <barrelfish/pmap.h> 19#include <barrelfish_kpi/capabilities.h> 20#include <barrelfish_kpi/paging_arch.h> // for PTABLE_ENTRIES 21#include <barrelfish/pmap_ds.h> 22 23#define MCN_COUNT DIVIDE_ROUND_UP(PTABLE_ENTRIES, L2_CNODE_SLOTS) 24 25/// Node in the meta-data, corresponds to an actual VNode object 26struct vnode { // NB: misnomer :) 27 struct vnode_public v; ///< public part of vnode 28 bool is_pinned; ///< is this a pinned vnode (do not reclaim automatically) 29 bool is_cloned; ///< For copy-on-write: indicate whether we 30 // still have to clone this vnode 31 struct vnode *orig; ///< vnode from which this one is cloned, for copy-on-write 32 union { 33 struct { 34 lvaddr_t base; ///< Virtual address start of page (upper level bits) 35 struct capref mcn[MCN_COUNT]; ///< CNodes to store mappings (caprefs) 36 struct cnoderef mcnode[MCN_COUNT]; ///< CNodeRefs of mapping cnodes 37 lvaddr_t virt_base; ///< vaddr of mapped RO page table in user-space 38 struct capref page_table_frame; 39 } vnode; // for non-leaf node (maps another vnode) 40 struct { 41 lvaddr_t vaddr; ///< The virtual address this frame has 42 uint16_t cloned_count; ///< counter for #times a page of this range was cloned 43 } frame; // for leaf node (maps an actual page) 44 } u; 45}; 46 47STATIC_ASSERT(sizeof(struct vnode) <= VNODE_SLAB_SIZE, "vnode slab size estimate big enough"); 48 49struct pmap_x86 { 50 struct pmap p; 51 struct vnode root; ///< Root of the vnode tree 52 genvaddr_t min_mappable_va; ///< Minimum mappable virtual address 53 genvaddr_t max_mappable_va; ///< Maximum mappable virtual address 54 size_t used_cap_slots; ///< Current count of capability slots allocated by pmap code 55}; 56 57#endif // TARGET_X86_BARRELFISH_PMAP_H 58