Changeset View
Changeset View
Standalone View
Standalone View
sys/i386/i386/pmap.c
Show First 20 Lines • Show All 5,709 Lines • ▼ Show 20 Lines | __CONCAT(PMTYPE, change_attr)(vm_offset_t va, vm_size_t size, int mode) | ||||
if (changed) { | if (changed) { | ||||
pmap_invalidate_range_int(kernel_pmap, base, tmpva); | pmap_invalidate_range_int(kernel_pmap, base, tmpva); | ||||
pmap_invalidate_cache_range(base, tmpva); | pmap_invalidate_cache_range(base, tmpva); | ||||
} | } | ||||
return (0); | return (0); | ||||
} | } | ||||
/* | /* | ||||
* perform the pmap work for mincore | * Perform the pmap work for mincore(2). If the page is not both referenced and | ||||
* modified by this pmap, returns its physical address so that the caller can | |||||
* find other mappings. | |||||
*/ | */ | ||||
static int | static int | ||||
__CONCAT(PMTYPE, mincore)(pmap_t pmap, vm_offset_t addr, vm_paddr_t *locked_pa) | __CONCAT(PMTYPE, mincore)(pmap_t pmap, vm_offset_t addr, vm_paddr_t *pap) | ||||
{ | { | ||||
pd_entry_t pde; | pd_entry_t pde; | ||||
pt_entry_t pte; | pt_entry_t pte; | ||||
vm_paddr_t pa; | vm_paddr_t pa; | ||||
int val; | int val; | ||||
PMAP_LOCK(pmap); | PMAP_LOCK(pmap); | ||||
retry: | |||||
pde = *pmap_pde(pmap, addr); | pde = *pmap_pde(pmap, addr); | ||||
if (pde != 0) { | if (pde != 0) { | ||||
if ((pde & PG_PS) != 0) { | if ((pde & PG_PS) != 0) { | ||||
pte = pde; | pte = pde; | ||||
/* Compute the physical address of the 4KB page. */ | /* Compute the physical address of the 4KB page. */ | ||||
pa = ((pde & PG_PS_FRAME) | (addr & PDRMASK)) & | pa = ((pde & PG_PS_FRAME) | (addr & PDRMASK)) & | ||||
PG_FRAME; | PG_FRAME; | ||||
val = MINCORE_SUPER; | val = MINCORE_SUPER; | ||||
Show All 12 Lines | if ((pte & PG_V) != 0) { | ||||
if ((pte & (PG_M | PG_RW)) == (PG_M | PG_RW)) | if ((pte & (PG_M | PG_RW)) == (PG_M | PG_RW)) | ||||
val |= MINCORE_MODIFIED | MINCORE_MODIFIED_OTHER; | val |= MINCORE_MODIFIED | MINCORE_MODIFIED_OTHER; | ||||
if ((pte & PG_A) != 0) | if ((pte & PG_A) != 0) | ||||
val |= MINCORE_REFERENCED | MINCORE_REFERENCED_OTHER; | val |= MINCORE_REFERENCED | MINCORE_REFERENCED_OTHER; | ||||
} | } | ||||
if ((val & (MINCORE_MODIFIED_OTHER | MINCORE_REFERENCED_OTHER)) != | if ((val & (MINCORE_MODIFIED_OTHER | MINCORE_REFERENCED_OTHER)) != | ||||
(MINCORE_MODIFIED_OTHER | MINCORE_REFERENCED_OTHER) && | (MINCORE_MODIFIED_OTHER | MINCORE_REFERENCED_OTHER) && | ||||
(pte & (PG_MANAGED | PG_V)) == (PG_MANAGED | PG_V)) { | (pte & (PG_MANAGED | PG_V)) == (PG_MANAGED | PG_V)) { | ||||
/* Ensure that "PHYS_TO_VM_PAGE(pa)->object" doesn't change. */ | *pap = pa; | ||||
if (vm_page_pa_tryrelock(pmap, pa, locked_pa)) | } | ||||
goto retry; | |||||
} else | |||||
PA_UNLOCK_COND(*locked_pa); | |||||
PMAP_UNLOCK(pmap); | PMAP_UNLOCK(pmap); | ||||
return (val); | return (val); | ||||
} | } | ||||
static void | static void | ||||
__CONCAT(PMTYPE, activate)(struct thread *td) | __CONCAT(PMTYPE, activate)(struct thread *td) | ||||
{ | { | ||||
pmap_t pmap, oldpmap; | pmap_t pmap, oldpmap; | ||||
▲ Show 20 Lines • Show All 620 Lines • Show Last 20 Lines |