Commit 196c1151 authored by Charlie Jacobsen's avatar Charlie Jacobsen Committed by Vikram Narayanan

Finished some of the failure crap. Going to try build.

parent 0c27d3a5
......@@ -219,10 +219,6 @@ static int lcd_kthread_main(void *__info)
info->m->gmain(info->cptr_len, info->cptrs);
/*
* How to listen for kthread stop?
*/
return 0;
}
......@@ -380,9 +376,10 @@ void tear_down_lcd_thread(struct lcd_thread *lcd_thread)
int ret;
struct lcd_rvp *rvp;
/*
* Free tcb
* Free tcb and gmain args
*/
kfree(lcd_thread->tcb);
kfree(lcd_thread->gmain_args);
/*
* Look up rvp using calling cptr.
*
......@@ -506,6 +503,11 @@ int boot_lcd(struct lcd *lcd, cptr_t *cptrs, unsigned int cptr_len)
ret = setup_lcd_thread(lcd, t);
if (ret)
goto fail3;
/*
* Store pointer to gmain args so we can free them when the
* lcd_thread is torn down.
*/
t->lcd_thread->gmain_args = cptrs;
/*
* Wake up kthread
*/
......@@ -563,7 +565,7 @@ static int __handle_api_create_lcd(struct lcd_thread *t, struct lcd **out)
/*
* Install capabilities (including microkernel cap) in lcd's cspace
*/
out_cptrs = kmalloc(sizeof(unsigned int) * cptr_len);
out_cptrs = kmalloc(sizeof(*out_cptrs) * cptr_len);
if (!out_cptrs)
goto fail2;
ret = install_caps(lcd, cptrs, rights, cptr_len, &out_cptrs);
......@@ -577,15 +579,17 @@ static int __handle_api_create_lcd(struct lcd_thread *t, struct lcd **out)
goto fail4;
*out = lcd;
/* out_cptrs freed when lcd_thread torn down */
return;
fail4:
/* any cap tear down necessary? */
fail3:
/* tear down lcd */
/* dealloc out_cptrs */
kfree(out_cptrs);
fail2:
/* unload module? */
tear_down_lcd(lcd);
fail1:
return -EIO;
}
......
......@@ -100,6 +100,8 @@ struct lcd_thread {
atomic_t should_stop; /* set to 1 when lcd_thread should stop */
struct completion exited; /* signal when I'm done exiting */
cptr_t *gmain_args; /* so we can free them later ... */
};
enum lcd_type {
......
......@@ -24,6 +24,9 @@
#include <linux/percpu.h>
#include <asm/module.h>
/* Pour lcd's */
#include <lcd-prototype/lcd.h>
/* In stripped ARM and x86-64 modules, ~ is surprisingly rare. */
#define MODULE_SIG_STRING "~Module signature appended~\n"
......@@ -396,6 +399,9 @@ struct module {
struct module_layout core_layout __module_layout_align;
struct module_layout init_layout;
/* Startup for lcd's */
int (*gmain)(int, cptr_t *);
/* Arch-specific module values */
struct mod_arch_specific arch;
......
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