FreeBSD/sys/arm/arm/pmap-v6.c
/*
 *	pmap_copy_page copies the specified (machine independent)
 *	page by mapping the page into virtual memory and using
 *	bcopy to copy the page, one machine dependent page at a
 *	time.
 */
pmap_copy_page copies the specified (machine independent)
page by mapping the page into virtual memory and using
bcopy to copy the page, one machine dependent page at a
time.
pmap_copy_page copies the specified ( machine independent ) page by mapping the page into virtual memory and using bcopy to copy the page one machine dependent page at a time .
void
pmap_copy_page(vm_page_t src, vm_page_t dst)
{
	struct sysmaps *sysmaps;
	sched_pin();
	sysmaps = &sysmaps_pcpu[PCPU_GET(cpuid)];
	mtx_lock(&sysmaps->lock);
	if (pte2_load(sysmaps->CMAP1) != 0)
		panic("%s: CMAP1 busy", __func__);
	if (pte2_load(sysmaps->CMAP2) != 0)
		panic("%s: CMAP2 busy", __func__);
	pte2_store(sysmaps->CMAP1, PTE2_KERN_NG(VM_PAGE_TO_PHYS(src),
	    PTE2_AP_KR | PTE2_NM, vm_page_pte2_attr(src)));
	pte2_store(sysmaps->CMAP2, PTE2_KERN_NG(VM_PAGE_TO_PHYS(dst),
	    PTE2_AP_KRW, vm_page_pte2_attr(dst)));
	bcopy(sysmaps->CADDR1, sysmaps->CADDR2, PAGE_SIZE);
	pte2_clear(sysmaps->CMAP1);
	tlb_flush((vm_offset_t)sysmaps->CADDR1);
	pte2_clear(sysmaps->CMAP2);
	tlb_flush((vm_offset_t)sysmaps->CADDR2);
	sched_unpin();
	mtx_unlock(&sysmaps->lock);
}
void pmap_copy_page ( vm_page_t src , vm_page_t dst ) { struct sysmaps * sysmaps ; sched_pin ( ) ; sysmaps = & sysmaps_pcpu [ PCPU_GET ( cpuid ) ] ; mtx_lock ( & sysmaps -> lock ) ; if ( pte2_load ( sysmaps -> CMAP1 ) != 0 ) panic ( " " , __func__ ) ; if ( pte2_load ( sysmaps -> CMAP2 ) != 0 ) panic ( " " , __func__ ) ; pte2_store ( sysmaps -> CMAP1 , PTE2_KERN_NG ( VM_PAGE_TO_PHYS ( src ) , PTE2_AP_KR | PTE2_NM , vm_page_pte2_attr ( src ) ) ) ; pte2_store ( sysmaps -> CMAP2 , PTE2_KERN_NG ( VM_PAGE_TO_PHYS ( dst ) , PTE2_AP_KRW , vm_page_pte2_attr ( dst ) ) ) ; bcopy ( sysmaps -> CADDR1 , sysmaps -> CADDR2 , PAGE_SIZE ) ; pte2_clear ( sysmaps -> CMAP1 ) ; tlb_flush ( ( vm_offset_t ) sysmaps -> CADDR1 ) ; pte2_clear ( sysmaps -> CMAP2 ) ; tlb_flush ( ( vm_offset_t ) sysmaps -> CADDR2 ) ; sched_unpin ( ) ; mtx_unlock ( & sysmaps -> lock ) ; }
pmap_copy_page copies the specified (machine independent)
      page by mapping the page into virtual memory and using
      bcopy to copy the page, one machine dependent page at a
      time.
pmap_copy_page copies the specified ( machine independent ) page by mapping the page into virtual memory and using bcopy to copy the page one machine dependent page at a time .