1/**
2 * \file
3 * \brief Pmap definition common for the AARCH64 archs
4 */
5
6/*
7 * Copyright (c) 2015, 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, Universitaetstr. 6, CH-8092 Zurich. Attn: Systems Group.
13 */
14
15#ifndef TARGET_AARCH64_BARRELFISH_PMAP_H
16#define TARGET_AARCH64_BARRELFISH_PMAP_H
17
18#include <barrelfish/pmap.h>
19
20/// Node in the meta-data, corresponds to an actual VNode object
21struct vnode {
22    uint16_t      entry;       ///< Page table entry of this VNode
23    bool          is_vnode;    ///< Is this a page table or a page mapping
24    struct vnode  *next;       ///< Next entry in list of siblings
25    struct capref mapping;     ///< the mapping for this vnode
26    union {
27        struct {
28            struct capref cap;         ///< Capability of this VNode
29            struct capref invokable;    ///< Copy of VNode cap that is invokable
30            struct vnode  *children;   ///< Children of this VNode
31        } vnode; // for non-leaf node
32        struct {
33            struct capref cap;         ///< Capability of this VNode
34            genvaddr_t    offset;      ///< Offset within mapped frame cap
35            vregion_flags_t flags;     ///< Flags for mapping
36            size_t        pte_count;   ///< number of mapped PTEs in this mapping
37        } frame; // for leaf node (maps page(s))
38    } u;
39};
40
41struct pmap_aarch64 {
42    struct pmap p;
43    struct vregion vregion;     ///< Vregion used to reserve virtual address for metadata
44    genvaddr_t vregion_offset;  ///< Offset into amount of reserved virtual address used
45    struct vnode root;          ///< Root of the vnode tree
46    errval_t (*refill_slabs)(struct pmap_aarch64 *); ///< Function to refill slabs
47    struct slab_allocator slab;     ///< Slab allocator for the vnode lists
48    genvaddr_t min_mappable_va; ///< Minimum mappable virtual address
49    genvaddr_t max_mappable_va; ///< Maximum mappable virtual address
50    uint8_t slab_buffer[512];   ///< Initial buffer to back the allocator
51};
52
53#endif // TARGET_AARCH64_BARRELFISH_PMAP_H
54