Always ONDEMAND ELF segments

上级 6de329b7
...@@ -18,8 +18,6 @@ ...@@ -18,8 +18,6 @@
#define USTACKPAGES 2 #define USTACKPAGES 2
#define BRK (USERTOP >> 1) #define BRK (USERTOP >> 1)
static const int odp = 1;
struct eargs { struct eargs {
struct proc *proc; struct proc *proc;
struct inode *ip; struct inode *ip;
...@@ -53,7 +51,7 @@ dosegment(struct eargs *args, u64 off) ...@@ -53,7 +51,7 @@ dosegment(struct eargs *args, u64 off)
in_sz = ph.filesz + PGOFFSET(ph.vaddr); in_sz = ph.filesz + PGOFFSET(ph.vaddr);
npg = (va_end - va_start) / PGSIZE; npg = (va_end - va_start) / PGSIZE;
if ((vmn = new vmnode(npg, odp ? ONDEMAND : EAGER, if ((vmn = new vmnode(npg, ONDEMAND,
args->ip, in_off, in_sz)) == 0) args->ip, in_off, in_sz)) == 0)
goto bad; goto bad;
...@@ -75,12 +73,15 @@ dostack(struct eargs *args) ...@@ -75,12 +73,15 @@ dostack(struct eargs *args)
uptr ustack[1+MAXARG+1]; uptr ustack[1+MAXARG+1];
const char *s, *last; const char *s, *last;
// Allocate a one-page stack at the top of the (user) address space // Allocate a one-page stack at the top of the (user) address space
if((vmn = new vmnode(USTACKPAGES)) == 0) if((vmn = new vmnode(USTACKPAGES)) == 0)
goto bad; goto bad;
if(args->vmap->insert(vmn, USERTOP-(USTACKPAGES*PGSIZE), 1) < 0) if(args->vmap->insert(vmn, USERTOP-(USTACKPAGES*PGSIZE), 1) < 0)
goto bad; goto bad;
// Fake return %rip between stack
ustack[0] = 0ull;
// Push argument strings, prepare rest of stack in ustack. // Push argument strings, prepare rest of stack in ustack.
sp = USERTOP; sp = USERTOP;
for(argc = 0; args->argv[argc]; argc++) { for(argc = 0; args->argv[argc]; argc++) {
...@@ -94,7 +95,6 @@ dostack(struct eargs *args) ...@@ -94,7 +95,6 @@ dostack(struct eargs *args)
} }
ustack[1+argc] = 0; ustack[1+argc] = 0;
ustack[0] = 0xffffffffffffffffull; // fake return PC
args->proc->tf->rdi = argc; args->proc->tf->rdi = argc;
args->proc->tf->rsi = sp - (argc+1)*8; args->proc->tf->rsi = sp - (argc+1)*8;
...@@ -182,14 +182,6 @@ exec(const char *path, char **argv) ...@@ -182,14 +182,6 @@ exec(const char *path, char **argv)
cilk_call(dosegment, &args, off); cilk_call(dosegment, &args, off);
} }
if (odp) {
// iunlock(ip);
} else {
// iunlockput(ip);
iput(ip);
ip = 0;
}
cilk_call(doheap, &args); cilk_call(doheap, &args);
// dostack reads from the user vm space. wq workers don't switch // dostack reads from the user vm space. wq workers don't switch
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论