Added struct proc pointer to base of the executable args block
authorDavide Libenzi <dlibenzi@google.com>
Thu, 22 Oct 2015 17:32:37 +0000 (10:32 -0700)
committerBarret Rhoden <brho@cs.berkeley.edu>
Wed, 18 Nov 2015 17:53:32 +0000 (09:53 -0800)
Added struct proc pointer to base of the executable args block.
This allows kernel code to be able to access the executable startup
info, which previous code would have discarded.

Signed-off-by: Davide Libenzi <dlibenzi@google.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/include/env.h
kern/src/elf.c

index 7c6135e..7163415 100644 (file)
@@ -62,7 +62,13 @@ struct proc {
 
        /* Keeps track of this process's current memory allocation 
      * (i.e. its heap pointer) */
 
        /* Keeps track of this process's current memory allocation 
      * (i.e. its heap pointer) */
-       void* heap_top;
+       void *heap_top;
+
+       /* The args_base pointer is a user pointer which points to the base of
+        * the executable boot block (where args, environment, aux vectors, ...)
+        * are stored.
+        */
+       void *args_base;
 
        // Address space
        pgdir_t env_pgdir;                      // Kernel virtual address of page dir
 
        // Address space
        pgdir_t env_pgdir;                      // Kernel virtual address of page dir
index ddcac84..e73e457 100644 (file)
@@ -398,6 +398,7 @@ int load_elf(struct proc* p, struct file* f,
         * loaded. */
        p->heap_top = (void*)ei.highest_addr;
        p->procinfo->heap_bottom = p->heap_top;
         * loaded. */
        p->heap_top = (void*)ei.highest_addr;
        p->procinfo->heap_bottom = p->heap_top;
+       p->args_base = (void *) stack_top;
 
        return 0;
 }
 
        return 0;
 }