diff options
author | Frans Kaashoek <[email protected]> | 2017-02-01 18:04:13 -0500 |
---|---|---|
committer | Frans Kaashoek <[email protected]> | 2017-02-01 18:04:13 -0500 |
commit | ed396c068b881877330f7d40bfce02db9b1199b3 (patch) | |
tree | 69103a78128b46d6bae179b0440cca0a9c7f0b0c /vm.c | |
parent | fbb4c0944422f860484142010bb9f366f3e87bf8 (diff) | |
download | xv6-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.c | 7 |
1 files changed, 1 insertions, 6 deletions
@@ -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 |