xv6

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 5a97613bab27b3bf5f94d1ebc815be92f1e1a7c2
parent 4e015d81aabb19d319fa73f2da11cd6b7ca5c2c3
Author: Austin Clements <amdragon@mit.edu>
Date:   Fri,  2 Sep 2011 15:27:41 -0400

Fit exec on a page.  Again

Diffstat:
Mexec.c | 7++-----
1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/exec.c b/exec.c @@ -50,8 +50,7 @@ exec(char *path, char **argv) ip = 0; // Allocate two pages at the next page boundary. - // Make the first inaccessible. - // Use the second as the user stack. + // Make the first inaccessible. Use the second as the user stack. sz = PGROUNDUP(sz); if((sz = allocuvm(pgdir, sz, sz + 2*PGSIZE)) == 0) goto bad; @@ -62,8 +61,7 @@ exec(char *path, char **argv) for(argc = 0; argv[argc]; argc++) { if(argc >= MAXARG) goto bad; - sp -= strlen(argv[argc]) + 1; - sp &= ~3; + sp = (sp - strlen(argv[argc]) + 1) & ~3; if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0) goto bad; ustack[3+argc] = sp; @@ -92,7 +90,6 @@ exec(char *path, char **argv) proc->tf->esp = sp; switchuvm(proc); freevm(oldpgdir); - return 0; bad: