From 79cd8b3eedeb1f85d3b19fb6119bd5224c4c532a Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Thu, 2 Sep 2010 18:28:36 -0400 Subject: 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). --- proc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'proc.c') diff --git a/proc.c b/proc.c index 853eb0a..6f7bdb6 100644 --- a/proc.c +++ b/proc.c @@ -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; } -- cgit v1.2.3