1/**
2 * \file
3 * \brief Vspace definitions
4 */
5
6/*
7 * Copyright (c) 2009, 2010, 2011, 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 LIBBARRELFISH_VSPACE_H
16#define LIBBARRELFISH_VSPACE_H
17
18#include <sys/cdefs.h>
19
20__BEGIN_DECLS
21
22struct vspace {
23    struct pmap *pmap;           ///< Pmap associated with the vspace
24    struct vspace_layout layout; ///< The layout of the address space
25    struct vregion *head;        ///< List of vregions in the vspace
26};
27
28/**
29 * \brief Get the pmap for the vspace
30 *
31 * \param vspace The vspace to get the pmap for
32 */
33static inline struct pmap* vspace_get_pmap(struct vspace *vspace)
34{
35    return vspace->pmap;
36}
37
38genvaddr_t vspace_lvaddr_to_genvaddr(lvaddr_t lvaddr);
39lvaddr_t vspace_genvaddr_to_lvaddr(genvaddr_t genvaddr);
40
41errval_t vspace_current_init(bool init_domain);
42errval_t vspace_init(struct vspace* vspace, struct pmap *pmap);
43errval_t vspace_destroy(struct vspace* vspace);
44struct vregion* vspace_get_region(struct vspace* vspace, const void *addr);
45errval_t vspace_pagefault_handler(struct vspace* vspace, lvaddr_t addr,
46                                  vm_fault_type_t type);
47
48__END_DECLS
49
50#endif // LIBBARRELFISH_VSPACE_H
51