7 * Copyright (c) 2010, 2011, ETH Zurich.
8 * Copyright (c) 2014, HP Labs.
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, Universitaetstr. 6, CH-8092 Zurich. Attn: Systems Group.
16 #ifndef LIBBARRELFISH_VSPACE_MMU_AWARE_H
17 #define LIBBARRELFISH_VSPACE_MMU_AWARE_H
19 #include <barrelfish/vregion.h>
20 #include <sys/cdefs.h>
24 struct vspace_mmu_vregion_list {
25 struct vregion vregion;
26 struct vspace_mmu_vregion_list *next;
29 /// Struct to support mmu_aware memory management
30 struct vspace_mmu_aware {
34 struct vregion vregion; ///< Needs just one vregion
35 struct memobj_anon memobj; ///< Needs just one memobj
36 lvaddr_t offset; ///< Offset of free space in anon
37 lvaddr_t mapoffset; ///< Offset into the anon that has been mapped in
40 errval_t vspace_mmu_aware_init(struct vspace_mmu_aware *state, size_t size);
41 errval_t vspace_mmu_aware_init_aligned(struct vspace_mmu_aware *state,
42 size_t size, size_t alignment,
43 vregion_flags_t flags);
44 errval_t vspace_mmu_aware_reset(struct vspace_mmu_aware *state,
45 struct capref frame, size_t size);
46 errval_t vspace_mmu_aware_map(struct vspace_mmu_aware *state,
47 struct capref frame, size_t req_size,
48 void **retbuf, size_t *retsize);
49 errval_t vspace_mmu_aware_unmap(struct vspace_mmu_aware *state,
50 lvaddr_t base, size_t bytes);
54 #endif // LIBBARRELFISH_VSPACE_MMU_AWARE_H