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, Haldeneggsteig 4, 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
20/// Node in the meta-data, corresponds to an actual VNode object
21struct vnode { // NB: misnomer :)
22    uint16_t      entry;       ///< Page table entry of this VNode
23    bool          is_vnode;    ///< Is this a vnode, or a (leaf) page mapping
24    struct vnode  *next;       ///< Next entry in list of siblings
25    struct capref mapping;     ///< mapping cap associated with this node
26    union {
27        struct {
28            struct capref cap;         ///< VNode cap
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 (maps another vnode)
32        struct {
33            struct capref cap;         ///< Frame cap
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 an actual page)
38    } u;
39};
40
41struct pmap_x86 {
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_x86 *); ///< 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_X86_BARRELFISH_PMAP_H
54