X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/b60166b327a9108b07e3069fa6568a451529ffd9..270869139db617e29a35bb9ded41087bb702f9ac:/lunaix-os/kernel/lunad.c diff --git a/lunaix-os/kernel/lunad.c b/lunaix-os/kernel/lunad.c index 99cd066..d9e138f 100644 --- a/lunaix-os/kernel/lunad.c +++ b/lunaix-os/kernel/lunad.c @@ -41,8 +41,10 @@ int exec_initd() { int errno = 0; + const char* argv[] = { "/mnt/lunaix-os/usr/bin/init", 0 }; + const char* envp[] = { 0 }; - if ((errno = exec_kexecve("/mnt/lunaix-os/usr/bin/init", NULL, NULL))) { + if ((errno = exec_kexecve(argv[0], argv, envp))) { goto fail; } @@ -56,8 +58,8 @@ fail: static void lunad_do_usr() { // No, these are not preemptive - cpu_disable_interrupt(); - + no_preemption(); + if (!mount_bootmedium() || !exec_initd()) { fail("failed to initd"); } @@ -74,12 +76,6 @@ lunad_do_usr() { void _preemptible lunad_main() { - /* - * We must defer boot code/data cleaning to here, after we successfully - * escape that area - */ - boot_cleanup(); - spawn_kthread((ptr_t)init_platform); /* @@ -93,11 +89,11 @@ lunad_main() thread (which is preemptive!) */ - cpu_enable_interrupt(); + set_preemption(); while (1) { cleanup_detached_threads(); - sched_pass(); + yield_current(); } }