FreeBSD/sys/arm64/arm64/pmap.c
/*
 * pmap_remove_l3: do the things to unmap a page in a process
 */
do the things to unmap a page in a process
do the things to unmap a page in a process
static int
pmap_remove_l3(pmap_t pmap, pt_entry_t *l3, vm_offset_t va, 
    pd_entry_t l2e, struct spglist *free, struct rwlock **lockp)
{
	pt_entry_t old_l3;
	vm_page_t m;
	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
	if (pmap_is_current(pmap) && pmap_l3_valid_cacheable(pmap_load(l3)))
		cpu_dcache_wb_range(va, L3_SIZE);
	old_l3 = pmap_load_clear(l3);
	PTE_SYNC(l3);
	pmap_invalidate_page(pmap, va);
	if (old_l3 & ATTR_SW_WIRED)
		pmap->pm_stats.wired_count -= 1;
	pmap_resident_count_dec(pmap, 1);
	if (old_l3 & ATTR_SW_MANAGED) {
		m = PHYS_TO_VM_PAGE(old_l3 & ~ATTR_MASK);
		if (pmap_page_dirty(old_l3))
			vm_page_dirty(m);
		if (old_l3 & ATTR_AF)
			vm_page_aflag_set(m, PGA_REFERENCED);
		CHANGE_PV_LIST_LOCK_TO_VM_PAGE(lockp, m);
		pmap_pvh_free(&m->md, pmap, va);
	}
	return (pmap_unuse_l3(pmap, va, l2e, free));
}
static int pmap_remove_l3 ( pmap_t pmap , pt_entry_t * l3 , vm_offset_t va , pd_entry_t l2e , struct spglist * free , struct rwlock * * lockp ) { pt_entry_t old_l3 ; vm_page_t m ; PMAP_LOCK_ASSERT ( pmap , MA_OWNED ) ; if ( pmap_is_current ( pmap ) && pmap_l3_valid_cacheable ( pmap_load ( l3 ) ) ) cpu_dcache_wb_range ( va , L3_SIZE ) ; old_l3 = pmap_load_clear ( l3 ) ; PTE_SYNC ( l3 ) ; pmap_invalidate_page ( pmap , va ) ; if ( old_l3 & ATTR_SW_WIRED ) pmap -> pm_stats . wired_count -= 1 ; pmap_resident_count_dec ( pmap , 1 ) ; if ( old_l3 & ATTR_SW_MANAGED ) { m = PHYS_TO_VM_PAGE ( old_l3 & ~ ATTR_MASK ) ; if ( pmap_page_dirty ( old_l3 ) ) vm_page_dirty ( m ) ; if ( old_l3 & ATTR_AF ) vm_page_aflag_set ( m , PGA_REFERENCED ) ; CHANGE_PV_LIST_LOCK_TO_VM_PAGE ( lockp , m ) ; pmap_pvh_free ( & m -> md , pmap , va ) ; } return ( pmap_unuse_l3 ( pmap , va , l2e , free ) ) ; }
pmap_remove_l3: do the things to unmap a page in a process
pmap_remove_l3 : do the things to unmap a page in a process