From ed396c068b881877330f7d40bfce02db9b1199b3 Mon Sep 17 00:00:00 2001 From: Frans Kaashoek Date: Wed, 1 Feb 2017 18:04:13 -0500 Subject: 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. --- vm.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'vm.c') 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 -- cgit v1.2.3