From 67702cf706bce7adef472f0caa48d81ddfaeb33a Mon Sep 17 00:00:00 2001 From: Frans Kaashoek Date: Tue, 2 Jul 2019 09:14:47 -0400 Subject: 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. --- kernel/exec.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'kernel/exec.c') 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); -- cgit v1.2.3