summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
authorFrans Kaashoek <[email protected]>2017-02-01 18:04:13 -0500
committerFrans Kaashoek <[email protected]>2017-02-01 18:04:13 -0500
commited396c068b881877330f7d40bfce02db9b1199b3 (patch)
tree69103a78128b46d6bae179b0440cca0a9c7f0b0c /vm.c
parentfbb4c0944422f860484142010bb9f366f3e87bf8 (diff)
downloadxv6-labs-ed396c068b881877330f7d40bfce02db9b1199b3.tar.gz
xv6-labs-ed396c068b881877330f7d40bfce02db9b1199b3.tar.bz2
xv6-labs-ed396c068b881877330f7d40bfce02db9b1199b3.zip
Eliminate code for gs trick to track per-cpu state. We rely on lapiccpunum()
to find a per-cpu id with which we locate a cpu's cpu struct.
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/vm.c b/vm.c
index d1640e8..9ac7401 100644
--- a/vm.c
+++ b/vm.c
@@ -21,17 +21,12 @@ seginit(void)
// Cannot share a CODE descriptor for both kernel and user
// because it would have to have DPL_USR, but the CPU forbids
// an interrupt from CPL=0 to DPL=3.
- c = &cpus[lapiccpunum()];
+ c = &cpus[cpuid()];
c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0);
c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0);
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);
}
// Return the address of the PTE in page table pgdir