X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/b60166b327a9108b07e3069fa6568a451529ffd9..6f65553ca5d2740738f399d88b3a4eb298255427:/lunaix-os/kernel/process/process.c diff --git a/lunaix-os/kernel/process/process.c b/lunaix-os/kernel/process/process.c index 91fe240..bb5008d 100644 --- a/lunaix-os/kernel/process/process.c +++ b/lunaix-os/kernel/process/process.c @@ -12,8 +12,8 @@ #include #include -#include -#include +#include +#include LOG_MODULE("PROC") @@ -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); + procvm_initvms_mount(mm); - vmm_mount_pd(VMS_MOUNT_1, vmroot(kproc)); - - 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,39 +91,38 @@ 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; } - struct exec_container container; + struct exec_host container; exec_init_container(&container, main_thread, VMS_MOUNT_1, argv, envp); if ((errno = exec_load_byname(&container, path))) { goto fail; } 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; }