1/** 2 * \file 3 * \brief pmap datastructure header for array pmap. This file is 4 * included by selecting the right include dir in lib/barrelfish/Hakefile 5 */ 6 7/* 8 * Copyright (c) 2018, ETH Zurich. 9 * All rights reserved. 10 * 11 * This file is distributed under the terms in the attached LICENSE file. 12 * If you do not find this file, copies can be found by writing to: 13 * ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group. 14 */ 15 16#ifndef LIBBF_INCLUDE_PMAP_DS_H 17#define LIBBF_INCLUDE_PMAP_DS_H 18 19//#define INIT_SLAB_BUFFER_SIZE SLAB_STATIC_SIZE(INIT_SLAB_COUNT, sizeof(struct vnode)) 20//#define PTSLAB_SLABSIZE (sizeof(struct vnode *)*PTABLE_ENTRIES) 21//#define INIT_PTSLAB_BUFFER_SIZE SLAB_STATIC_SIZE(INIT_SLAB_COUNT, PTSLAB_SLABSIZE) 22 23/** 24 * \brief find next non-null child starting from index i in children array of 25 * `root`. 26 * \returns the index of the next non-null child starting from i. 27 */ 28static inline int pmap_next_child(struct vnode *root, int i, struct vnode **n) 29{ 30 assert(n); 31 struct vnode *tmp; 32 do { 33 // check child i 34 tmp = root->v.u.vnode.children[i]; 35 i++; 36 } while (!tmp && i < PTABLE_ENTRIES); 37 *n = tmp; 38 return i; 39} 40 41/** 42 * \brief a macro that provides a datastructure-independent way of iterating 43 * through the non-null children of the vnode `root`. 44 * Internally this uses `pmap_next_child` to skip children which do not exist. 45 * 46 * Note: this macro requires both root and iter to be 'struct vnode *'. 47 */ 48#define pmap_foreach_child(root, iter) \ 49 for (int i = pmap_next_child(root, 0, &iter); i < PTABLE_ENTRIES; i = pmap_next_child(root, i, &iter)) 50 51/* currently defined in include/barrelfish/pmap_ds.h 52struct pmap_vnode_mgmt { 53 struct slab_allocator slab; ///< Slab allocator for the shadow page table entries 54 struct slab_allocator ptslab; ///< Slab allocator for the page table children arrays 55 struct vregion vregion; ///< Vregion used to reserve virtual address for metadata 56 genvaddr_t vregion_offset; ///< Offset into amount of reserved virtual address used 57}; 58*/ 59 60#endif // LIBBF_INCLUDE_PMAP_DS_H 61