Changeset View
Changeset View
Standalone View
Standalone View
sys/arm/arm/pmap-v4.c
Show First 20 Lines • Show All 4,143 Lines • ▼ Show 20 Lines | pmap_remove_write(vm_page_t m) | ||||
*/ | */ | ||||
VM_OBJECT_ASSERT_WLOCKED(m->object); | VM_OBJECT_ASSERT_WLOCKED(m->object); | ||||
if (vm_page_xbusied(m) || (m->aflags & PGA_WRITEABLE) != 0) | if (vm_page_xbusied(m) || (m->aflags & PGA_WRITEABLE) != 0) | ||||
pmap_clearbit(m, PVF_WRITE); | pmap_clearbit(m, PVF_WRITE); | ||||
} | } | ||||
/* | /* | ||||
* 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) | ||||
{ | { | ||||
struct l2_bucket *l2b; | struct l2_bucket *l2b; | ||||
pt_entry_t *ptep, pte; | pt_entry_t *ptep, pte; | ||||
vm_paddr_t pa; | vm_paddr_t pa; | ||||
vm_page_t m; | vm_page_t m; | ||||
int val; | int val; | ||||
boolean_t managed; | boolean_t managed; | ||||
PMAP_LOCK(pmap); | PMAP_LOCK(pmap); | ||||
retry: | |||||
l2b = pmap_get_l2_bucket(pmap, addr); | l2b = pmap_get_l2_bucket(pmap, addr); | ||||
if (l2b == NULL) { | if (l2b == NULL) { | ||||
val = 0; | PMAP_UNLOCK(pmap); | ||||
goto out; | return (0); | ||||
} | } | ||||
ptep = &l2b->l2b_kva[l2pte_index(addr)]; | ptep = &l2b->l2b_kva[l2pte_index(addr)]; | ||||
pte = *ptep; | pte = *ptep; | ||||
if (!l2pte_valid(pte)) { | if (!l2pte_valid(pte)) { | ||||
val = 0; | PMAP_UNLOCK(pmap); | ||||
goto out; | return (0); | ||||
} | } | ||||
val = MINCORE_INCORE; | val = MINCORE_INCORE; | ||||
if (pte & L2_S_PROT_W) | if (pte & L2_S_PROT_W) | ||||
val |= MINCORE_MODIFIED | MINCORE_MODIFIED_OTHER; | val |= MINCORE_MODIFIED | MINCORE_MODIFIED_OTHER; | ||||
managed = false; | managed = false; | ||||
pa = l2pte_pa(pte); | pa = l2pte_pa(pte); | ||||
m = PHYS_TO_VM_PAGE(pa); | m = PHYS_TO_VM_PAGE(pa); | ||||
if (m != NULL && !(m->oflags & VPO_UNMANAGED)) | if (m != NULL && !(m->oflags & VPO_UNMANAGED)) | ||||
Show All 10 Lines | if (managed) { | ||||
* doubt it's worthwhile. This may falsely report | * doubt it's worthwhile. This may falsely report | ||||
* the given address as referenced. | * the given address as referenced. | ||||
*/ | */ | ||||
if ((m->md.pvh_attrs & PVF_REF) != 0) | if ((m->md.pvh_attrs & PVF_REF) != 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) && managed) { | (MINCORE_MODIFIED_OTHER | MINCORE_REFERENCED_OTHER) && managed) { | ||||
/* 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 | |||||
out: | |||||
PA_UNLOCK_COND(*locked_pa); | |||||
PMAP_UNLOCK(pmap); | PMAP_UNLOCK(pmap); | ||||
return (val); | return (val); | ||||
} | } | ||||
void | void | ||||
pmap_sync_icache(pmap_t pm, vm_offset_t va, vm_size_t sz) | pmap_sync_icache(pmap_t pm, vm_offset_t va, vm_size_t sz) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 259 Lines • Show Last 20 Lines |