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

minor

上级 dfdbb22d
...@@ -200,18 +200,18 @@ vmap::copy(int share) ...@@ -200,18 +200,18 @@ vmap::copy(int share)
scoped_acquire sa(&lock); scoped_acquire sa(&lock);
for (range *r: cr) { for (range *r: cr) {
struct vma *e = (struct vma *) r->value;
struct vma *ne = new vma(); struct vma *ne = new vma();
if (ne == 0) if (ne == 0)
goto err; goto err;
struct vma *e = (struct vma *) r->value;
scoped_acquire sae(&e->lock);
ne->vma_start = e->vma_start; ne->vma_start = e->vma_start;
ne->vma_end = e->vma_end; ne->vma_end = e->vma_end;
if (share) { if (share) {
ne->n = e->n; ne->n = e->n;
ne->va_type = COW; ne->va_type = COW;
scoped_acquire sae(&e->lock);
e->va_type = COW; e->va_type = COW;
updatepages(pml4, e->vma_start, e->vma_end, [](atomic<pme_t>* p) { updatepages(pml4, e->vma_start, e->vma_end, [](atomic<pme_t>* p) {
for (;;) { for (;;) {
...@@ -236,8 +236,10 @@ vmap::copy(int share) ...@@ -236,8 +236,10 @@ vmap::copy(int share)
span.replace(new range(&nm->cr, ne->vma_start, ne->vma_end - ne->vma_start, ne, 0)); span.replace(new range(&nm->cr, ne->vma_start, ne->vma_end - ne->vma_start, ne, 0));
} }
if (share) if (share) {
lcr3(v2p(pml4)); // Reload hardware page table // XXX should really be tlbflush(), but callers hold some locks..
lcr3(rcr3()); // Reload hardware page table
}
return nm; return nm;
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论