Barrelfish
Functions
vspace.c File Reference

vspace management More...

Functions

errval_t vspace_current_init (bool init_domain)
 Initialize the current vspace structure. More...
 
errval_t vspace_add_vregion (struct vspace *vspace, struct vregion *region)
 Add a new region into the vspace. More...
 
errval_t vspace_remove_vregion (struct vspace *vspace, struct vregion *region)
 remove a region from the vspace More...
 
errval_t vspace_init (struct vspace *vspace, struct pmap *pmap)
 Initialize a vspace. More...
 
errval_t vspace_destroy (struct vspace *vspace)
 Destroy a vspace.
 
struct vregion * vspace_get_region (struct vspace *vspace, const void *addr)
 Get the region corresponding to the given virtual address. More...
 
errval_t vspace_pagefault_handler (struct vspace *vspace, lvaddr_t lvaddr, vm_fault_type_t type)
 Page fault handler. More...
 

Detailed Description

vspace management

A vspace consists of a set of vregions and one pmap. The current vspace is setup by the (domain/dispatcher?) spawning it.

Warning: slot_alloc_init calls vregion_map which calls vspace_add_vregion. vspace_add_vregion uses malloc to increase it's slab. Since malloc depends upon slot_alloc_init being called successfully, vspace_add_vregion should have enough initial slab space to not use malloc.

Function Documentation

errval_t vspace_add_vregion ( struct vspace *  vspace,
struct vregion *  region 
)

Add a new region into the vspace.

Parameters
pointThe vspace struct
regionThe region to add

pmap implementation rely on vspace maintaining an ordered list of vregions

errval_t vspace_current_init ( bool  init_domain)

Initialize the current vspace structure.

This code is coupled with pmap_current_init()

struct vregion* vspace_get_region ( struct vspace *  vspace,
const void *  addr 
)

Get the region corresponding to the given virtual address.

Parameters
addrThe virtual address
errval_t vspace_init ( struct vspace *  vspace,
struct pmap *  pmap 
)

Initialize a vspace.

Parameters
vspaceThe vspace to initialize
pmapThe pmap to associate with the vspace

Initializes a vspace, associating it with a pmap

errval_t vspace_pagefault_handler ( struct vspace *  vspace,
lvaddr_t  lvaddr,
vm_fault_type_t  type 
)

Page fault handler.

Parameters
pointThe vspace page fault occured in
addrThe faulting address
typeThe fault type

Lookup the appropriate vregion and forward the fault to it

errval_t vspace_remove_vregion ( struct vspace *  vspace,
struct vregion *  region 
)

remove a region from the vspace

Parameters
pointThe vspace struct
regionThe region to remove

Library internal function