X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/707c6653985f55463e8a59a58b248ba8af3b44b2..b6ff3c7dbab3f40d03389808d95ac27d416c35e3:/lunaix-os/kernel/proc0.c diff --git a/lunaix-os/kernel/proc0.c b/lunaix-os/kernel/proc0.c index abd0ac0..2029bc5 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/init"; - ld_create_param(¶m, __current, VMS_SELF); - - if ((errno = exec_load_byname(¶m, filename, NULL, NULL))) { + if ((errno = 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: