diff options
author | Austin Clements <[email protected]> | 2010-09-01 17:14:58 -0400 |
---|---|---|
committer | Austin Clements <[email protected]> | 2010-09-01 17:14:58 -0400 |
commit | d3ecf3eb44379f12b47da9d08e4d1b52cf7c2601 (patch) | |
tree | 9274d9fe6e838a33864d4dd38d5e9f25495853fe | |
parent | b1d41d678888fd1a51e4844ab583f7c47f9fb218 (diff) | |
download | xv6-labs-d3ecf3eb44379f12b47da9d08e4d1b52cf7c2601.tar.gz xv6-labs-d3ecf3eb44379f12b47da9d08e4d1b52cf7c2601.tar.bz2 xv6-labs-d3ecf3eb44379f12b47da9d08e4d1b52cf7c2601.zip |
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.
-rw-r--r-- | vm.c | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -310,14 +310,14 @@ copyuvm(pde_t *pgdir, uint sz) for(i = 0; i < sz; i += PGSIZE){ if(!(pte = walkpgdir(pgdir, (void *)i, 0))) panic("copyuvm: pte should exist\n"); - if(*pte & PTE_P){ - pa = PTE_ADDR(*pte); - if(!(mem = kalloc())) - goto bad; - memmove(mem, (char *)pa, PGSIZE); - if(!mappages(d, (void *)i, PGSIZE, PADDR(mem), PTE_W|PTE_U)) - goto bad; - } + if(!(*pte & PTE_P)) + panic("copyuvm: page not present\n"); + pa = PTE_ADDR(*pte); + if(!(mem = kalloc())) + goto bad; + memmove(mem, (char *)pa, PGSIZE); + if(!mappages(d, (void *)i, PGSIZE, PADDR(mem), PTE_W|PTE_U)) + goto bad; } return d; |