Date: Fri, 15 May 2015 08:30:30 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r282947 - in head/sys: amd64/amd64 kern Message-ID: <201505150830.t4F8UU5o093361@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Fri May 15 08:30:29 2015 New Revision: 282947 URL: https://svnweb.freebsd.org/changeset/base/282947 Log: 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 Modified: head/sys/amd64/amd64/pmap.c head/sys/kern/init_main.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Fri May 15 08:29:24 2015 (r282946) +++ head/sys/amd64/amd64/pmap.c Fri May 15 08:30:29 2015 (r282947) @@ -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); } /* Modified: head/sys/kern/init_main.c ============================================================================== --- head/sys/kern/init_main.c Fri May 15 08:29:24 2015 (r282946) +++ head/sys/kern/init_main.c Fri May 15 08:30:29 2015 (r282947) @@ -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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201505150830.t4F8UU5o093361>