svn commit: r255683 - projects/bhyve_npt_pmap/sys/amd64/amd64
Neel Natu
neel at FreeBSD.org
Thu Sep 19 01:12:59 UTC 2013
Author: neel
Date: Thu Sep 19 01:12:59 2013
New Revision: 255683
URL: http://svnweb.freebsd.org/changeset/base/255683
Log:
For a nested pmap make sure that its 'pm_cr3' is invalid and thus is
guaranteed to trigger an exception if loaded into the host's %cr3.
Requested by: kib@
Modified:
projects/bhyve_npt_pmap/sys/amd64/amd64/pmap.c
Modified: projects/bhyve_npt_pmap/sys/amd64/amd64/pmap.c
==============================================================================
--- projects/bhyve_npt_pmap/sys/amd64/amd64/pmap.c Thu Sep 19 00:32:07 2013 (r255682)
+++ projects/bhyve_npt_pmap/sys/amd64/amd64/pmap.c Thu Sep 19 01:12:59 2013 (r255683)
@@ -2139,6 +2139,7 @@ pmap_pinit_type(pmap_t pmap, enum pmap_t
{
vm_page_t pml4pg;
pt_entry_t PG_A, PG_M;
+ vm_paddr_t pml4phys;
int i;
/*
@@ -2148,9 +2149,10 @@ pmap_pinit_type(pmap_t pmap, enum pmap_t
VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL)
VM_WAIT;
- pmap->pm_cr3 = VM_PAGE_TO_PHYS(pml4pg);
- pmap->pm_pml4 = (pml4_entry_t *)PHYS_TO_DMAP(pmap->pm_cr3);
+ pml4phys = VM_PAGE_TO_PHYS(pml4pg);
+ pmap->pm_pml4 = (pml4_entry_t *)PHYS_TO_DMAP(pml4phys);
pmap->pm_pcid = -1;
+ pmap->pm_cr3 = ~0; /* initialize to an invalid value */
if ((pml4pg->flags & PG_ZERO) == 0)
pagezero(pmap->pm_pml4);
@@ -2164,6 +2166,8 @@ pmap_pinit_type(pmap_t pmap, enum pmap_t
PG_A = pmap_accessed_bit(pmap);
PG_M = pmap_modified_bit(pmap);
+ pmap->pm_cr3 = pml4phys;
+
/* Wire in kernel global address entries. */
for (i = 0; i < NKPML4E; i++) {
pmap->pm_pml4[KPML4BASE + i] = (KPDPphys + ptoa(i)) |
More information about the svn-src-projects
mailing list