X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/4b6190b935dd75d8ddd514a05c7c7343e32c0cdc..e6416905c4afb34e61276cdc07c44813a3ebc5e7:/lunaix-os/kernel/process/sched.c diff --git a/lunaix-os/kernel/process/sched.c b/lunaix-os/kernel/process/sched.c index 0a9cea2..caec0e6 100644 --- a/lunaix-os/kernel/process/sched.c +++ b/lunaix-os/kernel/process/sched.c @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -171,7 +172,8 @@ __DEFINE_LXSYSCALL1(unsigned int, sleep, unsigned int, seconds) llist_append(&root_proc->sleep.sleepers, &__current->sleep.sleepers); __current->intr_ctx.registers.eax = seconds; - __current->state = PS_BLOCKED; + + block_current(); schedule(); } @@ -281,6 +283,8 @@ alloc_process() proc->created = clock_systime(); proc->pgid = proc->pid; proc->fdtable = vzalloc(sizeof(struct v_fdtable)); + proc->fxstate = + vzalloc_dma(512); // FXSAVE需要十六位对齐地址,使用DMA块(128位对齐) llist_init_head(&proc->mm.regions.head); llist_init_head(&proc->tasks); @@ -335,6 +339,8 @@ destroy_process(pid_t pid) llist_delete(&proc->tasks); llist_delete(&proc->sleep.sleepers); + taskfs_invalidate(pid); + if (proc->cwd) { vfs_unref_dnode(proc->cwd); } @@ -346,6 +352,7 @@ destroy_process(pid_t pid) } vfree(proc->fdtable); + vfree_dma(proc->fxstate); struct mm_region *pos, *n; llist_for_each(pos, n, &proc->mm.regions.head, head)