diff options
author | Austin Clements <[email protected]> | 2010-09-02 18:28:36 -0400 |
---|---|---|
committer | Austin Clements <[email protected]> | 2010-09-02 18:28:36 -0400 |
commit | 79cd8b3eedeb1f85d3b19fb6119bd5224c4c532a (patch) | |
tree | f9afe121e2b9298b35d3ccd61a329f03421c97fa /proc.c | |
parent | d49d31381df93b40c1c4bc18c97ca42c3256e414 (diff) | |
download | xv6-labs-79cd8b3eedeb1f85d3b19fb6119bd5224c4c532a.tar.gz xv6-labs-79cd8b3eedeb1f85d3b19fb6119bd5224c4c532a.tar.bz2 xv6-labs-79cd8b3eedeb1f85d3b19fb6119bd5224c4c532a.zip |
Simplify allocuvm/deallocuvm to operate in a contiguous memory model. This makes their interface match up better with proc->sz and also simplifies the callers (it even gets the main body of exec on one page).
Diffstat (limited to 'proc.c')
-rw-r--r-- | proc.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -142,14 +142,15 @@ userinit(void) int growproc(int n) { + uint sz = proc->sz; if(n > 0){ - if(!allocuvm(proc->pgdir, (char *)proc->sz, n)) + if(!(sz = allocuvm(proc->pgdir, sz, sz + n))) return -1; } else if(n < 0){ - if(!deallocuvm(proc->pgdir, (char *)(proc->sz + n), 0 - n)) + if(!(sz = deallocuvm(proc->pgdir, sz, sz + n))) return -1; } - proc->sz += n; + proc->sz = sz; switchuvm(proc); return 0; } |