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

Function pmap_copy

freebsd/arm/arm/pmap-v6.c:6037–6160  ·  view source on GitHub ↗

* Copy the range specified by src_addr/len * from the source map to the range dst_addr/len * in the destination map. * * This routine is only advisory and need not do anything. */

Source from the content-addressed store, hash-verified

6035 * This routine is only advisory and need not do anything.
6036 */
6037void
6038pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len,
6039 vm_offset_t src_addr)
6040{
6041 struct spglist free;
6042 vm_offset_t addr;
6043 vm_offset_t end_addr = src_addr + len;
6044 vm_offset_t nextva;
6045
6046 if (dst_addr != src_addr)
6047 return;
6048
6049 if (!pmap_is_current(src_pmap))
6050 return;
6051
6052 rw_wlock(&pvh_global_lock);
6053 if (dst_pmap < src_pmap) {
6054 PMAP_LOCK(dst_pmap);
6055 PMAP_LOCK(src_pmap);
6056 } else {
6057 PMAP_LOCK(src_pmap);
6058 PMAP_LOCK(dst_pmap);
6059 }
6060 sched_pin();
6061 for (addr = src_addr; addr < end_addr; addr = nextva) {
6062 pt2_entry_t *src_pte2p, *dst_pte2p;
6063 vm_page_t dst_mpt2pg, src_mpt2pg;
6064 pt1_entry_t src_pte1;
6065 u_int pte1_idx;
6066
6067 KASSERT(addr < VM_MAXUSER_ADDRESS,
6068 ("%s: invalid to pmap_copy page tables", __func__));
6069
6070 nextva = pte1_trunc(addr + PTE1_SIZE);
6071 if (nextva < addr)
6072 nextva = end_addr;
6073
6074 pte1_idx = pte1_index(addr);
6075 src_pte1 = src_pmap->pm_pt1[pte1_idx];
6076 if (pte1_is_section(src_pte1)) {
6077 if ((addr & PTE1_OFFSET) != 0 ||
6078 (addr + PTE1_SIZE) > end_addr)
6079 continue;
6080 if (dst_pmap->pm_pt1[pte1_idx] == 0 &&
6081 (!pte1_is_managed(src_pte1) ||
6082 pmap_pv_insert_pte1(dst_pmap, addr, src_pte1,
6083 PMAP_ENTER_NORECLAIM))) {
6084 dst_pmap->pm_pt1[pte1_idx] = src_pte1 &
6085 ~PTE1_W;
6086 dst_pmap->pm_stats.resident_count +=
6087 PTE1_SIZE / PAGE_SIZE;
6088 pmap_pte1_mappings++;
6089 }
6090 continue;
6091 } else if (!pte1_is_link(src_pte1))
6092 continue;
6093
6094 src_mpt2pg = PHYS_TO_VM_PAGE(pte1_link_pa(src_pte1));

Callers

nothing calls this directly

Calls 15

sched_pinFunction · 0.85
pte1_truncFunction · 0.85
pte1_indexFunction · 0.85
pte1_is_sectionFunction · 0.85
pte1_is_managedFunction · 0.85
pmap_pv_insert_pte1Function · 0.85
pte1_is_linkFunction · 0.85
PHYS_TO_VM_PAGEFunction · 0.85
pte1_link_paFunction · 0.85
pt2_wirecount_getFunction · 0.85
pt2map_entryFunction · 0.85
pte2_loadFunction · 0.85

Tested by

no test coverage detected