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.
This commit is contained in:
parent
abf847a083
commit
fbb4c09444
7 changed files with 97 additions and 62 deletions
4
vm.c
4
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue