MCPcopy Create free account
hub / github.com/F-Stack/f-stack / pmap_copy_page

Function pmap_copy_page

freebsd/mips/mips/pmap.c:2649–2676  ·  view source on GitHub ↗

* 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. * * Use XKPHYS for 64 bit, and KSEG0 where possible for 32 bit. */

Source from the content-addressed store, hash-verified

2647 * Use XKPHYS for 64 bit, and KSEG0 where possible for 32 bit.
2648 */
2649void
2650pmap_copy_page(vm_page_t src, vm_page_t dst)
2651{
2652 vm_offset_t va_src, va_dst;
2653 vm_paddr_t phys_src = VM_PAGE_TO_PHYS(src);
2654 vm_paddr_t phys_dst = VM_PAGE_TO_PHYS(dst);
2655
2656 if (MIPS_DIRECT_MAPPABLE(phys_src) && MIPS_DIRECT_MAPPABLE(phys_dst)) {
2657 /* easy case, all can be accessed via KSEG0 */
2658 /*
2659 * Flush all caches for VA that are mapped to this page
2660 * to make sure that data in SDRAM is up to date
2661 */
2662 pmap_flush_pvcache(src);
2663 mips_dcache_wbinv_range_index(
2664 MIPS_PHYS_TO_DIRECT(phys_dst), PAGE_SIZE);
2665 va_src = MIPS_PHYS_TO_DIRECT(phys_src);
2666 va_dst = MIPS_PHYS_TO_DIRECT(phys_dst);
2667 bcopy((caddr_t)va_src, (caddr_t)va_dst, PAGE_SIZE);
2668 mips_dcache_wbinv_range(va_dst, PAGE_SIZE);
2669 } else {
2670 va_src = pmap_lmem_map2(phys_src, phys_dst);
2671 va_dst = va_src + PAGE_SIZE;
2672 bcopy((void *)va_src, (void *)va_dst, PAGE_SIZE);
2673 mips_dcache_wbinv_range(va_dst, PAGE_SIZE);
2674 pmap_lmem_unmap();
2675 }
2676}
2677
2678int unmapped_buf_allowed;
2679

Callers 3

vm_page_reclaim_runFunction · 0.50
vm_fault_cowFunction · 0.50
vm_fault_copy_entryFunction · 0.50

Calls 3

pmap_flush_pvcacheFunction · 0.85
pmap_lmem_map2Function · 0.85
pmap_lmem_unmapFunction · 0.85

Tested by

no test coverage detected