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

lcd-create-v2: Update microkernel, kliblcd memory code for vmalloc.

Add vmalloc memory type in places where memory objects are
used (memory object lookup, map/unmap, resource trees, global
memory interval tree).
parent e9246e5a
......@@ -131,6 +131,7 @@ static int mo_insert_in_trees(struct task_struct *t,
t->lcd_resource_trees[LCD_RESOURCE_TREE_DEV_MEM_IDX],
mo,
mo_cptr);
case LCD_MICROKERNEL_TYPE_ID_VMALLOC_MEM:
case LCD_MICROKERNEL_TYPE_ID_VOLUNTEERED_VMALLOC_MEM:
return mo_insert_in_tree(
t->lcd_resource_trees[LCD_RESOURCE_TREE_VMALLOC_MEM_IDX],
......@@ -167,6 +168,7 @@ static int mo_in_trees(struct task_struct *t, struct lcd_memory_object *mo)
return mo_in_tree(
t->lcd_resource_trees[LCD_RESOURCE_TREE_DEV_MEM_IDX],
mo);
case LCD_MICROKERNEL_TYPE_ID_VMALLOC_MEM:
case LCD_MICROKERNEL_TYPE_ID_VOLUNTEERED_VMALLOC_MEM:
return mo_in_tree(
t->lcd_resource_trees[LCD_RESOURCE_TREE_VMALLOC_MEM_IDX],
......@@ -213,6 +215,7 @@ static void mo_remove_from_trees(struct task_struct *t,
return mo_remove_from_tree(
t->lcd_resource_trees[LCD_RESOURCE_TREE_DEV_MEM_IDX],
mo);
case LCD_MICROKERNEL_TYPE_ID_VMALLOC_MEM:
case LCD_MICROKERNEL_TYPE_ID_VOLUNTEERED_VMALLOC_MEM:
return mo_remove_from_tree(
t->lcd_resource_trees[LCD_RESOURCE_TREE_VMALLOC_MEM_IDX],
......
......@@ -15,6 +15,7 @@ unsigned long __lcd_memory_object_start(struct lcd_memory_object *mo)
case LCD_MICROKERNEL_TYPE_ID_PAGE:
case LCD_MICROKERNEL_TYPE_ID_VOLUNTEERED_PAGE:
return va2hpa(page_address(mo->object));
case LCD_MICROKERNEL_TYPE_ID_VMALLOC_MEM:
case LCD_MICROKERNEL_TYPE_ID_VOLUNTEERED_DEV_MEM:
case LCD_MICROKERNEL_TYPE_ID_VOLUNTEERED_VMALLOC_MEM:
return (unsigned long)mo->object;
......@@ -209,6 +210,7 @@ static int lookup_memory_object(struct cspace *cspace, cptr_t slot,
*/
t = cap_cnode_type(*cnode);
if (t != __lcd_get_libcap_type(LCD_MICROKERNEL_TYPE_ID_PAGE) &&
t != __lcd_get_libcap_type(LCD_MICROKERNEL_TYPE_ID_VMALLOC_MEM) &&
t != __lcd_get_libcap_type(LCD_MICROKERNEL_TYPE_ID_VOLUNTEERED_PAGE) &&
t != __lcd_get_libcap_type(LCD_MICROKERNEL_TYPE_ID_VOLUNTEERED_DEV_MEM) &&
t != __lcd_get_libcap_type(LCD_MICROKERNEL_TYPE_ID_VOLUNTEERED_VMALLOC_MEM)) {
......@@ -390,6 +392,7 @@ static int isolated_map_memory_object(struct lcd *lcd,
case LCD_MICROKERNEL_TYPE_ID_VOLUNTEERED_PAGE:
case LCD_MICROKERNEL_TYPE_ID_VOLUNTEERED_DEV_MEM:
return isolated_map_contiguous_mem(lcd, mo, meta, base);
case LCD_MICROKERNEL_TYPE_ID_VMALLOC_MEM:
case LCD_MICROKERNEL_TYPE_ID_VOLUNTEERED_VMALLOC_MEM:
return isolated_map_vmalloc_mem(lcd, mo, meta, base);
default:
......@@ -533,6 +536,7 @@ static void isolated_unmap_memory_object(struct lcd *lcd,
case LCD_MICROKERNEL_TYPE_ID_VOLUNTEERED_PAGE:
case LCD_MICROKERNEL_TYPE_ID_VOLUNTEERED_DEV_MEM:
return isolated_unmap_contiguous_mem(lcd, mo, meta);
case LCD_MICROKERNEL_TYPE_ID_VMALLOC_MEM:
case LCD_MICROKERNEL_TYPE_ID_VOLUNTEERED_VMALLOC_MEM:
return isolated_unmap_vmalloc_mem(lcd, mo, meta);
default:
......
......@@ -53,6 +53,7 @@ int __lcd_mem_itree_insert(struct lcd_memory_object *mo, unsigned int flags)
return do_mem_itree_insert(&lcd_physical_mem_itree,
mo,
flags);
case LCD_MICROKERNEL_TYPE_ID_VMALLOC_MEM:
case LCD_MICROKERNEL_TYPE_ID_VOLUNTEERED_VMALLOC_MEM:
return do_mem_itree_insert(&lcd_vmalloc_mem_itree,
mo,
......@@ -111,6 +112,7 @@ int __lcd_mem_itree_get(unsigned long addr,
return do_mem_itree_lookup(&lcd_physical_mem_itree,
addr,
node_out);
case LCD_MICROKERNEL_TYPE_ID_VMALLOC_MEM:
case LCD_MICROKERNEL_TYPE_ID_VOLUNTEERED_VMALLOC_MEM:
return do_mem_itree_lookup(&lcd_vmalloc_mem_itree,
addr,
......@@ -164,6 +166,7 @@ void __lcd_mem_itree_delete(struct lcd_memory_object *mo)
case LCD_MICROKERNEL_TYPE_ID_VOLUNTEERED_PAGE:
case LCD_MICROKERNEL_TYPE_ID_VOLUNTEERED_DEV_MEM:
return do_mem_itree_delete(&lcd_physical_mem_itree, mo);
case LCD_MICROKERNEL_TYPE_ID_VMALLOC_MEM:
case LCD_MICROKERNEL_TYPE_ID_VOLUNTEERED_VMALLOC_MEM:
return do_mem_itree_delete(&lcd_vmalloc_mem_itree, mo);
default:
......
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