FreeBSD/sys/arm/arm/pmap-v6.c
/*
 *  Sets the memory attribute for the specified page.
 */
Sets the memory attribute for the specified page.
Sets the memory attribute for the specified page .
void
pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma)
{
	struct sysmaps *sysmaps;
	vm_memattr_t oma;
	vm_paddr_t pa;
	oma = m->md.pat_mode;
	m->md.pat_mode = ma;
	CTR5(KTR_PMAP, "%s: page %p - 0x%08X oma: %d, ma: %d", __func__, m,
	    VM_PAGE_TO_PHYS(m), oma, ma);
	if ((m->flags & PG_FICTITIOUS) != 0)
		return;
#if 0
	if (sf_buf_invalidate_cache(m, oma))
		return;
#endif
	if (ma != oma) {
		pa = VM_PAGE_TO_PHYS(m);
		sched_pin();
		sysmaps = &sysmaps_pcpu[PCPU_GET(cpuid)];
		mtx_lock(&sysmaps->lock);
		if (*sysmaps->CMAP2)
			panic("%s: CMAP2 busy", __func__);
		pte2_store(sysmaps->CMAP2, PTE2_KERN_NG(pa, PTE2_AP_KRW,
		    vm_memattr_to_pte2(ma)));
		dcache_wbinv_poc((vm_offset_t)sysmaps->CADDR2, pa, PAGE_SIZE);
		pte2_clear(sysmaps->CMAP2);
		tlb_flush((vm_offset_t)sysmaps->CADDR2);
		sched_unpin();
		mtx_unlock(&sysmaps->lock);
	}
}
void pmap_page_set_memattr ( vm_page_t m , vm_memattr_t ma ) { struct sysmaps * sysmaps ; vm_memattr_t oma ; vm_paddr_t pa ; oma = m -> md . pat_mode ; m -> md . pat_mode = ma ; CTR5 ( KTR_PMAP , " " , __func__ , m , VM_PAGE_TO_PHYS ( m ) , oma , ma ) ; if ( ( m -> flags & PG_FICTITIOUS ) != 0 ) return ; #if 0 if ( sf_buf_invalidate_cache ( m , oma ) ) return ; #endif if ( ma != oma ) { pa = VM_PAGE_TO_PHYS ( m ) ; sched_pin ( ) ; sysmaps = & sysmaps_pcpu [ PCPU_GET ( cpuid ) ] ; mtx_lock ( & sysmaps -> lock ) ; if ( * sysmaps -> CMAP2 ) panic ( " " , __func__ ) ; pte2_store ( sysmaps -> CMAP2 , PTE2_KERN_NG ( pa , PTE2_AP_KRW , vm_memattr_to_pte2 ( ma ) ) ) ; dcache_wbinv_poc ( ( vm_offset_t ) sysmaps -> CADDR2 , pa , PAGE_SIZE ) ; pte2_clear ( sysmaps -> CMAP2 ) ; tlb_flush ( ( vm_offset_t ) sysmaps -> CADDR2 ) ; sched_unpin ( ) ; mtx_unlock ( & sysmaps -> lock ) ; } }
Sets the memory attribute for the specified page.
Sets the memory attribute for the specified page .
/*
	 * If "m" is a normal page, flush it from the cache.
	 *
	 * First, try to find an existing mapping of the page by sf
	 * buffer. sf_buf_invalidate_cache() modifies mapping and
	 * flushes the cache.
	 */ /*
	 * If page is not mapped by sf buffer, map the page
	 * transient and do invalidation.
	 */