提交 f47148e1 创建 作者: Nickolai Zeldovich's avatar Nickolai Zeldovich

fork: inherit exec_cpuid_ from parent

wait: push finishproc to the exec_cpuid_ core
上级 567366af
......@@ -14,6 +14,7 @@
#include "vm.hh"
#include "ns.hh"
#include "fcntl.h"
#include "wq.hh"
u64
proc_hash(const u32 &p)
......@@ -368,6 +369,7 @@ fork(int flags)
np->parent = myproc();
*np->tf = *myproc()->tf;
np->cpu_pin = myproc()->cpu_pin;
np->exec_cpuid_ = myproc()->exec_cpuid_;
// Clear %eax so that fork returns 0 in the child.
np->tf->rax = 0;
......@@ -408,8 +410,6 @@ finishproc(struct proc *p)
p->uwq->dec();
ksfree(slab_stack, p->kstack);
p->kstack = 0;
if (!xnspid->remove(p->pid, &p))
panic("wait: ns_remove");
p->pid = 0;
p->parent = 0;
p->name[0] = 0;
......@@ -437,7 +437,16 @@ wait(void)
pid = p->pid;
SLIST_REMOVE(&myproc()->childq, p, proc, child_next);
release(&myproc()->lock);
finishproc(p);
cwork *w = new cwork();
assert(w);
w->rip = (void*) finishproc;
w->arg0 = p;
assert(wq_pushto(w, p->exec_cpuid_) >= 0);
if (!xnspid->remove(pid, &p))
panic("wait: ns_remove");
return pid;
}
release(&p->lock);
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论