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 8,350 Lines • ▼ Show 20 Lines | if (len < NBPDP && base < dmaplimit) { | ||||
} | } | ||||
if (changed && invalidate) | if (changed && invalidate) | ||||
pmap_invalidate_page(kernel_pmap, va); | pmap_invalidate_page(kernel_pmap, va); | ||||
PMAP_UNLOCK(kernel_pmap); | PMAP_UNLOCK(kernel_pmap); | ||||
} | } | ||||
} | } | ||||
/* | /* | ||||
* 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. | |||||
*/ | */ | ||||
int | int | ||||
pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *locked_pa) | pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *pap) | ||||
{ | { | ||||
pd_entry_t *pdep; | pd_entry_t *pdep; | ||||
pt_entry_t pte, PG_A, PG_M, PG_RW, PG_V; | pt_entry_t pte, PG_A, PG_M, PG_RW, PG_V; | ||||
vm_paddr_t pa; | vm_paddr_t pa; | ||||
int val; | int val; | ||||
PG_A = pmap_accessed_bit(pmap); | PG_A = pmap_accessed_bit(pmap); | ||||
PG_M = pmap_modified_bit(pmap); | PG_M = pmap_modified_bit(pmap); | ||||
PG_V = pmap_valid_bit(pmap); | PG_V = pmap_valid_bit(pmap); | ||||
PG_RW = pmap_rw_bit(pmap); | PG_RW = pmap_rw_bit(pmap); | ||||
PMAP_LOCK(pmap); | PMAP_LOCK(pmap); | ||||
retry: | |||||
pdep = pmap_pde(pmap, addr); | pdep = pmap_pde(pmap, addr); | ||||
if (pdep != NULL && (*pdep & PG_V)) { | if (pdep != NULL && (*pdep & PG_V)) { | ||||
if (*pdep & PG_PS) { | if (*pdep & PG_PS) { | ||||
pte = *pdep; | pte = *pdep; | ||||
/* Compute the physical address of the 4KB page. */ | /* Compute the physical address of the 4KB page. */ | ||||
pa = ((*pdep & PG_PS_FRAME) | (addr & PDRMASK)) & | pa = ((*pdep & 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); | ||||
alc: This is redundant. | |||||
return (val); | return (val); | ||||
} | } | ||||
static uint64_t | static uint64_t | ||||
pmap_pcid_alloc(pmap_t pmap, u_int cpuid) | pmap_pcid_alloc(pmap_t pmap, u_int cpuid) | ||||
{ | { | ||||
uint32_t gen, new_gen, pcid_next; | uint32_t gen, new_gen, pcid_next; | ||||
▲ Show 20 Lines • Show All 1,955 Lines • Show Last 20 Lines |
This is redundant.