summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
authorFrans Kaashoek <[email protected]>2017-01-31 20:21:14 -0500
committerFrans Kaashoek <[email protected]>2017-01-31 20:21:14 -0500
commitfbb4c0944422f860484142010bb9f366f3e87bf8 (patch)
tree5e339842d43d09a4d23f1a2165391f00af30e308 /vm.c
parentabf847a083888bbed4260ecacf849ea19f23e810 (diff)
downloadxv6-labs-fbb4c0944422f860484142010bb9f366f3e87bf8.tar.gz
xv6-labs-fbb4c0944422f860484142010bb9f366f3e87bf8.tar.bz2
xv6-labs-fbb4c0944422f860484142010bb9f366f3e87bf8.zip
Read curproc from cpu structure, but be careful because after a schedule event
myproc() points to a different thread. myproc(); sched(); myproc(); // this proc maybe different than the one before sched Thus, in a function that operates on one thread better to retrieve the current process once at the start of the function.
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/vm.c b/vm.c
index cb159ad..d1640e8 100644
--- a/vm.c
+++ b/vm.c
@@ -27,13 +27,11 @@ seginit(void)
c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER);
c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER);
c->cpu = c;
+ c->proc = 0;
// Map cpu and proc -- these are private per cpu.
c->gdt[SEG_KCPU] = SEG(STA_W, &c->cpu, 4, 0);
lgdt(c->gdt, sizeof(c->gdt));
loadgs(SEG_KCPU << 3);
- // Initialize cpu-local storage.
- // setcpu(c);
- setproc(0);
}
// Return the address of the PTE in page table pgdir