summaryrefslogtreecommitdiffstats
path: root/sys/amd64/amd64/pmap.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2015-05-15 08:30:29 +0000
committerkib <kib@FreeBSD.org>2015-05-15 08:30:29 +0000
commitc3a04ab331a24533e7a7470d0f8a347a23ea974d (patch)
tree3a0f03e2ecfbd97c3e46af633b49d098932a0a81 /sys/amd64/amd64/pmap.c
parent7531e6e70ecfbbf822fff6ef7e6165cac9d7e5fd (diff)
downloadFreeBSD-src-c3a04ab331a24533e7a7470d0f8a347a23ea974d.zip
FreeBSD-src-c3a04ab331a24533e7a7470d0f8a347a23ea974d.tar.gz
On amd64, make proc0 pmap initialization slightly more correct. In
particular, switch to the proc0 pmap to have expected %cr3 and PCID for the thread0 during initialization, and the up to date pm_active mask. pmap_pinit0() should be done after proc0->p_vmspace is assigned so that the amd64 pmap_activate() find the correct curproc pmap. Sponsored by: The FreeBSD Foundation MFC after: 3 weeks
Diffstat (limited to 'sys/amd64/amd64/pmap.c')
-rw-r--r--sys/amd64/amd64/pmap.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index 2829d07..118bb34 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -2129,7 +2129,6 @@ pmap_pinit0(pmap_t pmap)
pmap->pm_cr3 = KPML4phys;
pmap->pm_root.rt_root = 0;
CPU_ZERO(&pmap->pm_active);
- PCPU_SET(curpmap, pmap);
TAILQ_INIT(&pmap->pm_pvchunk);
bzero(&pmap->pm_stats, sizeof pmap->pm_stats);
pmap->pm_flags = pmap_flags;
@@ -2137,6 +2136,9 @@ pmap_pinit0(pmap_t pmap)
pmap->pm_pcids[i].pm_pcid = PMAP_PCID_NONE;
pmap->pm_pcids[i].pm_gen = 0;
}
+ PCPU_SET(curpmap, kernel_pmap);
+ pmap_activate(curthread);
+ CPU_FILL(&kernel_pmap->pm_active);
}
/*
OpenPOWER on IntegriCloud