summaryrefslogtreecommitdiff
path: root/kernel/exec.c
diff options
context:
space:
mode:
authorFrans Kaashoek <[email protected]>2019-07-02 09:14:47 -0400
committerFrans Kaashoek <[email protected]>2019-07-02 09:14:47 -0400
commit67702cf706bce7adef472f0caa48d81ddfaeb33a (patch)
treefd61e4036c4f5ec0944c987a7dffc9c04422d8c6 /kernel/exec.c
parent535ac52efadc5c5cdb0483ad55c306cfaff71d50 (diff)
downloadxv6-labs-67702cf706bce7adef472f0caa48d81ddfaeb33a.tar.gz
xv6-labs-67702cf706bce7adef472f0caa48d81ddfaeb33a.tar.bz2
xv6-labs-67702cf706bce7adef472f0caa48d81ddfaeb33a.zip
Checkpoint switching to per-process locks, in attempt clarify xv6's
locking plan, which is a difficult to understand because ptable lock protects many invariants. This implementation has a bug: once in a while xv6 unlocks a proc lock that is locked by another core.
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);