提交 d3ecf3eb 创建 作者: Austin Clements's avatar Austin Clements

Slight simplification of copyuvm. We could simplify other things now that…

Slight simplification of copyuvm. We could simplify other things now that processes are contiguous, but we'd have to think harder about the error paths.
上级 b1d41d67
...@@ -310,14 +310,14 @@ copyuvm(pde_t *pgdir, uint sz) ...@@ -310,14 +310,14 @@ copyuvm(pde_t *pgdir, uint sz)
for(i = 0; i < sz; i += PGSIZE){ for(i = 0; i < sz; i += PGSIZE){
if(!(pte = walkpgdir(pgdir, (void *)i, 0))) if(!(pte = walkpgdir(pgdir, (void *)i, 0)))
panic("copyuvm: pte should exist\n"); panic("copyuvm: pte should exist\n");
if(*pte & PTE_P){ if(!(*pte & PTE_P))
pa = PTE_ADDR(*pte); panic("copyuvm: page not present\n");
if(!(mem = kalloc())) pa = PTE_ADDR(*pte);
goto bad; if(!(mem = kalloc()))
memmove(mem, (char *)pa, PGSIZE); goto bad;
if(!mappages(d, (void *)i, PGSIZE, PADDR(mem), PTE_W|PTE_U)) memmove(mem, (char *)pa, PGSIZE);
goto bad; if(!mappages(d, (void *)i, PGSIZE, PADDR(mem), PTE_W|PTE_U))
} goto bad;
} }
return d; return d;
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论