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
This commit is contained in:
parent
f83e0dcb3a
commit
100ac78be1
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=282947
@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -561,9 +561,9 @@ proc0_init(void *dummy __unused)
|
||||
p->p_stats = pstats_alloc();
|
||||
|
||||
/* Allocate a prototype map so we have something to fork. */
|
||||
pmap_pinit0(vmspace_pmap(&vmspace0));
|
||||
p->p_vmspace = &vmspace0;
|
||||
vmspace0.vm_refcnt = 1;
|
||||
pmap_pinit0(vmspace_pmap(&vmspace0));
|
||||
|
||||
/*
|
||||
* proc0 is not expected to enter usermode, so there is no special
|
||||
|
Loading…
Reference in New Issue
Block a user