Commit 6390c4c5 authored by Charles Jacobsen's avatar Charles Jacobsen Committed by Vikram Narayanan

test-v2: Fix cap types bug and sync create endpoint bug.

Need to ensure types array and microkernel types enum order
match.

Wasn't setting out parameter for create sync endpoint.

Allocate two cptr's to reserve call/reply endpoints for
LCD (in module create).
parent cd6e20a1
......@@ -276,6 +276,33 @@ static void destroy_create_ctx(struct lcd_create_ctx *ctx)
kfree(ctx);
}
static int do_cptr_cache_init(struct cptr_cache *cache)
{
int ret;
cptr_t unused;
ret = cptr_cache_init(cache);
if (ret) {
LIBLCD_ERR("error init'ing cptr cache");
return ret;
}
/*
* Reserve first two slots for call/reply caps (just alloc them)
*/
ret = cptr_alloc(cache, &unused);
if (ret) {
LIBLCD_ERR("cptr cache alloc1");
return ret;
}
ret = cptr_alloc(cache, &unused);
if (ret) {
LIBLCD_ERR("cptr cache alloc2");
return ret;
}
return 0;
}
static int get_pages_for_lcd(struct lcd_create_ctx *ctx)
{
struct page *p1, *p2, *p3;
......@@ -297,7 +324,7 @@ static int get_pages_for_lcd(struct lcd_create_ctx *ctx)
/*
* Initialize boot cptr cache
*/
ret = cptr_cache_init(lcd_to_boot_cptr_cache(ctx));
ret = do_cptr_cache_init(lcd_to_boot_cptr_cache(ctx));
if (ret) {
LIBLCD_ERR("failed to init cptr cache");
goto fail2;
......
......@@ -375,14 +375,20 @@ void __lcd_destroy(struct lcd *lcd);
* cap_types.c
*/
enum lcd_microkernel_type_id {
LCD_MICROKERNEL_TYPE_ID_PAGE,
/*
* XXX: If you change these, or the order, make sure you
* update the internal array in cap_types.c (otherwise, you'll
* mess up the types assigned to objects inserted in cspaces,
* and the wrong delete/revoke callbacks will fire).
*/
LCD_MICROKERNEL_TYPE_ID_PAGE = 0,
LCD_MICROKERNEL_TYPE_ID_VMALLOC_MEM,
LCD_MICROKERNEL_TYPE_ID_VOLUNTEERED_PAGE,
LCD_MICROKERNEL_TYPE_ID_VOLUNTEERED_DEV_MEM,
LCD_MICROKERNEL_TYPE_ID_VOLUNTEERED_VMALLOC_MEM,
LCD_MICROKERNEL_TYPE_ID_SYNC_EP,
LCD_MICROKERNEL_TYPE_ID_LCD,
LCD_MICROKERNEL_TYPE_ID_KLCD,
LCD_MICROKERNEL_TYPE_ID_SYNC_EP,
LCD_MICROKERNEL_NUM_CAP_TYPES,
};
......
......@@ -11,6 +11,7 @@
void lcd_cap_delete(cptr_t slot)
{
cap_delete(current->lcd->cspace, slot);
lcd_cptr_free(slot);
}
int lcd_cap_revoke(cptr_t slot)
......
......@@ -66,7 +66,7 @@ int lcd_enter(void)
/*
* Create our call endpoint (for receiving rpc replies)
*/
ret = __lcd_create_sync_endpoint(current->lcd, LCD_CPTR_CALL_ENDPOINT);
ret = _lcd_create_sync_endpoint(LCD_CPTR_CALL_ENDPOINT);
if (ret) {
LCD_ERR("creating call endpoint");
goto fail6;
......
......@@ -21,6 +21,7 @@ int cap_debug_level = LIBLCD_LIBCAP_DEBUG_LVL;
void lcd_cap_delete(cptr_t slot)
{
lcd_syscall_cap_delete(slot);
lcd_cptr_free(slot);
}
int lcd_cap_revoke(cptr_t slot)
......
......@@ -269,7 +269,7 @@ static int lcd_delete(struct cspace *cspace, struct cnode *cnode,
static int klcd_delete(struct cspace *cspace, struct cnode *cnode,
void *object)
{
__lcd_destroy(object);
__lcd_destroy_no_vm(object);
return 0;
}
......
......@@ -35,6 +35,8 @@ int __lcd_create_sync_endpoint__(struct lcd_sync_endpoint **ep_out)
*/
mutex_init(&e->lock);
*ep_out = e;
return 0;
fail1:
......
#! /bin/bash
#! /bin/bash -e
make libcap.microkernel
make microkernel
......
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