Changeset View
Changeset View
Standalone View
Standalone View
sys/amd64/amd64/pmap.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 6,519 Lines • ▼ Show 20 Lines | if (pml4e == NULL || (*pml4e & PG_V) == 0) { | ||||
*/ | */ | ||||
goto restart; | goto restart; | ||||
} | } | ||||
pdpe = pmap_pdpe(pmap, va); | pdpe = pmap_pdpe(pmap, va); | ||||
KASSERT(pdpe != NULL, ("va %#lx lost pdpe", va)); | KASSERT(pdpe != NULL, ("va %#lx lost pdpe", va)); | ||||
origpte = *pdpe; | origpte = *pdpe; | ||||
MPASS(origpte == 0); | MPASS(origpte == 0); | ||||
} else { | } else { | ||||
mp = PHYS_TO_VM_PAGE(*pml4e & PG_FRAME); | |||||
pdpe = pmap_pdpe(pmap, va); | pdpe = pmap_pdpe(pmap, va); | ||||
KASSERT(pdpe != NULL, ("va %#lx lost pdpe", va)); | KASSERT(pdpe != NULL, ("va %#lx lost pdpe", va)); | ||||
origpte = *pdpe; | origpte = *pdpe; | ||||
if ((origpte & PG_V) == 0) | if ((origpte & PG_V) == 0) { | ||||
mp = PHYS_TO_VM_PAGE(*pml4e & PG_FRAME); | |||||
mp->ref_count++; | mp->ref_count++; | ||||
} | } | ||||
} | |||||
KASSERT((origpte & PG_V) == 0 || ((origpte & PG_PS) != 0 && | KASSERT((origpte & PG_V) == 0 || ((origpte & PG_PS) != 0 && | ||||
(origpte & PG_FRAME) == (pten & PG_FRAME)), | (origpte & PG_FRAME) == (pten & PG_FRAME)), | ||||
("va %#lx changing 1G phys page pdpe %#lx pten %#lx", | ("va %#lx changing 1G phys page pdpe %#lx pten %#lx", | ||||
va, origpte, pten)); | va, origpte, pten)); | ||||
if ((pten & PG_W) != 0 && (origpte & PG_W) == 0) | if ((pten & PG_W) != 0 && (origpte & PG_W) == 0) | ||||
pmap->pm_stats.wired_count += NBPDP / PAGE_SIZE; | pmap->pm_stats.wired_count += NBPDP / PAGE_SIZE; | ||||
else if ((pten & PG_W) == 0 && (origpte & PG_W) != 0) | else if ((pten & PG_W) == 0 && (origpte & PG_W) != 0) | ||||
pmap->pm_stats.wired_count -= NBPDP / PAGE_SIZE; | pmap->pm_stats.wired_count -= NBPDP / PAGE_SIZE; | ||||
Show All 15 Lines | if (pde == NULL) { | ||||
} | } | ||||
pde = (pd_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(mp)); | pde = (pd_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(mp)); | ||||
pde = &pde[pmap_pde_index(va)]; | pde = &pde[pmap_pde_index(va)]; | ||||
origpte = *pde; | origpte = *pde; | ||||
MPASS(origpte == 0); | MPASS(origpte == 0); | ||||
} else { | } else { | ||||
pdpe = pmap_pdpe(pmap, va); | pdpe = pmap_pdpe(pmap, va); | ||||
MPASS(pdpe != NULL && (*pdpe & PG_V) != 0); | MPASS(pdpe != NULL && (*pdpe & PG_V) != 0); | ||||
mp = PHYS_TO_VM_PAGE(*pdpe & PG_FRAME); | |||||
origpte = *pde; | origpte = *pde; | ||||
if ((origpte & PG_V) == 0) | if ((origpte & PG_V) == 0) { | ||||
mp = PHYS_TO_VM_PAGE(*pdpe & PG_FRAME); | |||||
mp->ref_count++; | mp->ref_count++; | ||||
} | |||||
} | } | ||||
KASSERT((origpte & PG_V) == 0 || ((origpte & PG_PS) != 0 && | KASSERT((origpte & PG_V) == 0 || ((origpte & PG_PS) != 0 && | ||||
(origpte & PG_FRAME) == (pten & PG_FRAME)), | (origpte & PG_FRAME) == (pten & PG_FRAME)), | ||||
("va %#lx changing 2M phys page pde %#lx pten %#lx", | ("va %#lx changing 2M phys page pde %#lx pten %#lx", | ||||
va, origpte, pten)); | va, origpte, pten)); | ||||
if ((pten & PG_W) != 0 && (origpte & PG_W) == 0) | if ((pten & PG_W) != 0 && (origpte & PG_W) == 0) | ||||
pmap->pm_stats.wired_count += NBPDR / PAGE_SIZE; | pmap->pm_stats.wired_count += NBPDR / PAGE_SIZE; | ||||
else if ((pten & PG_W) == 0 && (origpte & PG_W) != 0) | else if ((pten & PG_W) == 0 && (origpte & PG_W) != 0) | ||||
▲ Show 20 Lines • Show All 4,869 Lines • Show Last 20 Lines |