X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/21fc45696e24471453a14ff496c8de5fe3cad6a8..9461d582084ab8c0d85e8dca1df276945366a84b:/lunaix-os/kernel/sched.c diff --git a/lunaix-os/kernel/sched.c b/lunaix-os/kernel/sched.c index be99525..4a0e254 100644 --- a/lunaix-os/kernel/sched.c +++ b/lunaix-os/kernel/sched.c @@ -145,6 +145,12 @@ redo: run(next); } +void +sched_yieldk() +{ + cpu_int(LUNAIX_SCHED); +} + __DEFINE_LXSYSCALL1(unsigned int, sleep, unsigned int, seconds) { if (!seconds) { @@ -219,7 +225,6 @@ _wait(pid_t wpid, int* status, int options) } wpid = wpid ? wpid : -__current->pgid; - cpu_enable_interrupt(); repeat: llist_for_each(proc, n, &__current->children, siblings) { @@ -238,11 +243,10 @@ repeat: return 0; } // 放弃当前的运行机会 - sched_yield(); + sched_yieldk(); goto repeat; done: - cpu_disable_interrupt(); status_flags |= PEXITSIG * (proc->sig_inprogress != 0); if (status) { *status = proc->exit_code | status_flags; @@ -330,7 +334,7 @@ destroy_process(pid_t pid) struct mm_region *pos, *n; llist_for_each(pos, n, &proc->mm.regions.head, head) { - lxfree(pos); + vfree(pos); } vmm_mount_pd(PD_MOUNT_1, proc->page_table);