X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/db7fc030e9e04c881f5f12a0e23baa8db4e20ee1..986ce23ace2f7875a1a561bd947f435a7594146c:/lunaix-os/kernel/proc0.c diff --git a/lunaix-os/kernel/proc0.c b/lunaix-os/kernel/proc0.c index ef97c77..d765691 100644 --- a/lunaix-os/kernel/proc0.c +++ b/lunaix-os/kernel/proc0.c @@ -1,9 +1,10 @@ #include #include +#include #include #include +#include #include -#include #include #include #include @@ -48,14 +49,14 @@ mount_bootmedium() { struct v_dnode* dnode; int errno = 0; - if ((errno = vfs_walk_proc("/dev/sdb", &dnode, NULL, 0))) { + struct device* dev = probe_boot_medium(); + if (!dev) { kprintf(KERROR "fail to acquire device. (%d)", errno); return 0; } - struct device* dev = (struct device*)dnode->inode->data; if ((errno = vfs_mount("/mnt/lunaix-os", "iso9660", dev, 0))) { - kprintf(KERROR "fail to boot medium. (%d)", errno); + kprintf(KERROR "fail to mount boot medium. (%d)", errno); return 0; } @@ -66,31 +67,11 @@ int exec_initd() { int errno = 0; - struct ld_param param; - char filename[] = "/mnt/lunaix-os/usr/initd"; - ld_create_param(¶m, __current, VMS_SELF); - - if ((errno = exec_load_byname(¶m, filename, NULL, NULL))) { + if (exec_kexecve("/mnt/lunaix-os/usr/init", NULL, NULL)) { goto fail; } - // user space - asm volatile("movw %0, %%ax\n" - "movw %%ax, %%es\n" - "movw %%ax, %%ds\n" - "movw %%ax, %%fs\n" - "movw %%ax, %%gs\n" - "pushl %0\n" - "pushl %1\n" - "pushl %2\n" - "pushl %3\n" - "retf" ::"i"(UDATA_SEG), - "r"(param.info.stack_top), - "i"(UCODE_SEG), - "r"(param.info.entry) - : "eax", "memory"); - fail("should not reach"); fail: