Fixed a trapframe-initialization bug in sys_exec
authorAndrew Waterman <waterman@parcad.millennium.berkeley.edu>
Fri, 5 Mar 2010 22:20:41 +0000 (14:20 -0800)
committerKevin Klues <klueska@cs.berkeley.edu>
Thu, 3 Nov 2011 00:35:36 +0000 (17:35 -0700)
load_elf sets up the entry point in env_tf, but that change
must be propagated to current_tf

kern/src/elf.c

index 28f4bb8..69e8b50 100644 (file)
@@ -153,13 +153,13 @@ intreg_t sys_exec(struct proc* p, const char fn[MAX_PATH_LEN], procinfo_t* pi)
        proc_init_procinfo(p);
 
        env_segment_free(p,0,USTACKTOP);
-       proc_init_trapframe(current_tf,0);
 
        if(load_elf(p,kfn))
        {
                proc_destroy(p);
                return -1;
        }
+       *current_tf = p->env_tf;
 
        return 0;
 }