Commit e9246e5a authored by Charlie Jacobsen's avatar Charlie Jacobsen Committed by Vikram Narayanan
Browse files

libcap-create-v2: Add vmalloc memory type to capability types.

This is different from *volunteered* vmalloc memory. Volunteered
vmalloc memory is not freed when the last capability goes
away.
parent b49acd30
......@@ -21,7 +21,7 @@ struct type_ops_id {
/* REVOCATION CALLBACKS ---------------------------------------- */
static void page_revoke(struct cspace *cspace, struct cnode *cnode,
static void mem_object_revoke(struct cspace *cspace, struct cnode *cnode,
void *object)
{
struct lcd_mapping_metadata *m;
......@@ -37,22 +37,34 @@ static void page_revoke(struct cspace *cspace, struct cnode *cnode,
kfree(m);
}
static void page_revoke(struct cspace *cspace, struct cnode *cnode,
void *object)
{
mem_object_revoke(cspace, cnode, object);
}
static void vmalloc_mem_revoke(struct cspace *cspace, struct cnode *cnode,
void *object)
{
mem_object_revoke(cspace, cnode, object);
}
static void volunteered_page_revoke(struct cspace *cspace, struct cnode *cnode,
void *object)
{
page_revoke(cspace, cnode, object);
mem_object_revoke(cspace, cnode, object);
}
static void volunteered_dev_mem_revoke(struct cspace *cspace,
struct cnode *cnode, void *object)
{
page_revoke(cspace, cnode, object);
mem_object_revoke(cspace, cnode, object);
}
static void volunteered_vmalloc_mem_revoke(struct cspace *cspace,
struct cnode *cnode, void *object)
{
page_revoke(cspace, cnode, object);
mem_object_revoke(cspace, cnode, object);
}
static void sync_endpoint_revoke(struct cspace *cspace, struct cnode *cnode,
......@@ -138,6 +150,25 @@ static void page_delete(struct cspace *cspace, struct cnode *cnode,
kfree(mo);
}
static void vmalloc_mem_delete(struct cspace *cspace, struct cnode *cnode,
void *object)
{
struct lcd_memory_object *mo = object;
/*
* Remove memory object from global memory interval tree
*/
__lcd_mem_itree_delete(mo);
/*
* vmalloc memory should be unmapped from all LCDs and not in use
* by any code. Free it.
*/
vfree(mo->object);
/*
* Free mo, no one else should have a reference.
*/
kfree(mo);
}
static void volunteered_page_delete(struct cspace *cspace, struct cnode *cnode,
void *object)
{
......@@ -225,6 +256,13 @@ static struct type_ops_id mk_type_ops_id[LCD_MICROKERNEL_NUM_CAP_TYPES] = {
.revoke = page_revoke,
}
},
{
{
.name = "vmalloc memory",
.delete = vmalloc_mem_delete,
.revoke = vmalloc_mem_revoke,
}
},
{
{
.name = "volunteered page",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment