X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/965940833071025bf0d386f4a9c70a5258453dbd..69777bdcab284335651a8002e2896f3862fa423d:/lunaix-os/kernel/process/process.c diff --git a/lunaix-os/kernel/process/process.c b/lunaix-os/kernel/process/process.c index 91fe240..cdaa12a 100644 --- a/lunaix-os/kernel/process/process.c +++ b/lunaix-os/kernel/process/process.c @@ -61,23 +61,22 @@ int spawn_process(struct thread** created, ptr_t entry, bool with_ustack) { struct proc_info* kproc = alloc_process(); + struct proc_mm* mm = vmspace(kproc); - procvm_init_clean(kproc); - - vmm_mount_pd(VMS_MOUNT_1, vmroot(kproc)); + procvm_initvms_mount(mm); - struct thread* kthread = create_thread(kproc, VMS_MOUNT_1, with_ustack); + struct thread* kthread = create_thread(kproc, with_ustack); if (!kthread) { - vmm_unmount_pd(VMS_MOUNT_1); + procvm_unmount(mm); delete_process(kproc); return -1; } commit_process(kproc); - start_thread(kthread, VMS_MOUNT_1, entry); + start_thread(kthread, entry); - vmm_unmount_pd(VMS_MOUNT_1); + procvm_unmount(mm); if (created) { *created = kthread; @@ -92,17 +91,16 @@ spawn_process_usr(struct thread** created, char* path, { // FIXME remote injection of user stack not yet implemented - struct proc_info* proc = alloc_process(); + struct proc_info* proc = alloc_process(); + struct proc_mm* mm = vmspace(proc); assert(!kernel_process(proc)); - procvm_init_clean(proc); - - vmm_mount_pd(VMS_MOUNT_1, vmroot(proc)); + procvm_initvms_mount(mm); int errno = 0; struct thread* main_thread; - if (!(main_thread = create_thread(proc, VMS_MOUNT_1, true))) { + if (!(main_thread = create_thread(proc, true))) { errno = ENOMEM; goto fail; } @@ -114,17 +112,17 @@ spawn_process_usr(struct thread** created, char* path, } commit_process(proc); - start_thread(main_thread, VMS_MOUNT_1, container.exe.entry); + start_thread(main_thread, container.exe.entry); if (created) { *created = main_thread; } - vmm_unmount_pd(VMS_MOUNT_1); + procvm_unmount(mm); return 0; fail: - vmm_unmount_pd(VMS_MOUNT_1); + procvm_unmount(mm); delete_process(proc); return errno; }