summaryrefslogtreecommitdiff
path: root/kernel/exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/exec.c')
-rw-r--r--kernel/exec.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/kernel/exec.c b/kernel/exec.c
index c9af395..b21afbb 100644
--- a/kernel/exec.c
+++ b/kernel/exec.c
@@ -2,6 +2,7 @@
#include "param.h"
#include "memlayout.h"
#include "riscv.h"
+#include "spinlock.h"
#include "proc.h"
#include "defs.h"
#include "elf.h"
@@ -19,7 +20,6 @@ exec(char *path, char **argv)
struct proghdr ph;
pagetable_t pagetable = 0, oldpagetable;
struct proc *p = myproc();
- uint64 oldsz = p->sz;
begin_op();
@@ -60,6 +60,9 @@ exec(char *path, char **argv)
end_op();
ip = 0;
+ p = myproc();
+ uint64 oldsz = p->sz;
+
// Allocate two pages at the next page boundary.
// Use the second as the user stack.
sz = PGROUNDUP(sz);