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

Function pmap_enter_object

freebsd/amd64/amd64/pmap.c:7204–7235  ·  view source on GitHub ↗

* Maps a sequence of resident pages belonging to the same object. * The sequence begins with the given page m_start. This page is * mapped at the given virtual address start. Each subsequent page is * mapped at a virtual address that is offset from start by the same * amount as the page is offset from m_start within the object. The * last page in the sequence is the page with the largest o

Source from the content-addressed store, hash-verified

7202 * corresponding offset from m_start are mapped.
7203 */
7204void
7205pmap_enter_object(pmap_t pmap, vm_offset_t start, vm_offset_t end,
7206 vm_page_t m_start, vm_prot_t prot)
7207{
7208 struct rwlock *lock;
7209 vm_offset_t va;
7210 vm_page_t m, mpte;
7211 vm_pindex_t diff, psize;
7212
7213 VM_OBJECT_ASSERT_LOCKED(m_start->object);
7214
7215 psize = atop(end - start);
7216 mpte = NULL;
7217 m = m_start;
7218 lock = NULL;
7219 PMAP_LOCK(pmap);
7220 while (m != NULL && (diff = m->pindex - m_start->pindex) < psize) {
7221 va = start + ptoa(diff);
7222 if ((va & PDRMASK) == 0 && va + NBPDR <= end &&
7223 m->psind == 1 && pmap_ps_enabled(pmap) &&
7224 pmap_allow_2m_x_page(pmap, (prot & VM_PROT_EXECUTE) != 0) &&
7225 pmap_enter_2mpage(pmap, va, m, prot, &lock))
7226 m = &m[NBPDR / PAGE_SIZE - 1];
7227 else
7228 mpte = pmap_enter_quick_locked(pmap, va, m, prot,
7229 mpte, &lock);
7230 m = TAILQ_NEXT(m, listq);
7231 }
7232 if (lock != NULL)
7233 rw_wunlock(lock);
7234 PMAP_UNLOCK(pmap);
7235}
7236
7237/*
7238 * this code makes some *MAJOR* assumptions:

Callers

nothing calls this directly

Calls 4

pmap_allow_2m_x_pageFunction · 0.85
pmap_ps_enabledFunction · 0.70
pmap_enter_2mpageFunction · 0.70
pmap_enter_quick_lockedFunction · 0.70

Tested by

no test coverage detected