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.
This commit is contained in:
parent
b1d41d6788
commit
d3ecf3eb44
4
vm.c
4
vm.c
|
@ -310,7 +310,8 @@ 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))
|
||||||
|
panic("copyuvm: page not present\n");
|
||||||
pa = PTE_ADDR(*pte);
|
pa = PTE_ADDR(*pte);
|
||||||
if(!(mem = kalloc()))
|
if(!(mem = kalloc()))
|
||||||
goto bad;
|
goto bad;
|
||||||
|
@ -318,7 +319,6 @@ copyuvm(pde_t *pgdir, uint sz)
|
||||||
if(!mappages(d, (void *)i, PGSIZE, PADDR(mem), PTE_W|PTE_U))
|
if(!mappages(d, (void *)i, PGSIZE, PADDR(mem), PTE_W|PTE_U))
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return d;
|
return d;
|
||||||
|
|
||||||
bad:
|
bad:
|
||||||
|
|
Loading…
Reference in a new issue