Mercurial > hvf > hvf-old
changeset 507:354fc5b6cbd9
cp: move the late init code into a separate task
This let's us use schedule() as much as we want!
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
---|---|
date | Sat, 23 Apr 2011 17:43:33 -0400 |
parents | 5cb01f04b0eb |
children | 8188966f0cc5 |
files | cp/nucleus/init.c |
diffstat | 1 files changed, 32 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/cp/nucleus/init.c Sat Apr 23 17:29:58 2011 -0400 +++ b/cp/nucleus/init.c Sat Apr 23 17:43:33 2011 -0400 @@ -78,6 +78,35 @@ BUG(); } +static int __finish_loading(void *data) +{ + struct console *opcon; /* operator's console */ + u32 iplsch; + + iplsch = (u32) (u64) data; + + /* + * Load the config file + */ + if (load_config(iplsch)) + BUG(); + + /* + * IPL is more or less done + */ + get_parsed_tod(&ipltime); + + opcon = start_oper_console(); + + con_printf(opcon, "NOW %02d:%02d:%02d UTC %04d-%02d-%02d\n\n", + ipltime.th, ipltime.tm, ipltime.ts, ipltime.dy, + ipltime.dm, ipltime.dd); + + spawn_oper_shell(opcon); + + return 0; +} + /* * This is where everything starts */ @@ -86,7 +115,6 @@ u64 first_free_page; u64 struct_page_bytes; struct psw psw; - struct console *opcon; /* operator's console */ /* * ticks starts at 0 @@ -191,26 +219,12 @@ ldep_on(); /* - * Load the config file + * Create a thread that'll finish setting everything up for us */ - if (load_config(__iplsch)) - BUG(); + create_task("*finish-loading", __finish_loading, (void*) (u64) __iplsch); /* - * IPL is more or less done - */ - get_parsed_tod(&ipltime); - - opcon = start_oper_console(); - - con_printf(opcon, "NOW %02d:%02d:%02d UTC %04d-%02d-%02d\n\n", - ipltime.th, ipltime.tm, ipltime.ts, ipltime.dy, - ipltime.dm, ipltime.dd); - - spawn_oper_shell(opcon); - - /* - * THIS IS WHERE THE IDLE TASK BEGINS, NOW WE CAN USE schedule() + * THIS IS WHERE THE IDLE TASK BEGINS */ idle_task_body();