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

Function pmap_allocpte

freebsd/mips/mips/pmap.c:1229–1263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1227}
1228
1229static vm_page_t
1230pmap_allocpte(pmap_t pmap, vm_offset_t va, u_int flags)
1231{
1232 unsigned ptepindex;
1233 pd_entry_t *pde;
1234 vm_page_t m;
1235
1236 /*
1237 * Calculate pagetable page index
1238 */
1239 ptepindex = pmap_pde_pindex(va);
1240retry:
1241 /*
1242 * Get the page directory entry
1243 */
1244 pde = pmap_pde(pmap, va);
1245
1246 /*
1247 * If the page table page is mapped, we just increment the hold
1248 * count, and activate it.
1249 */
1250 if (pde != NULL && *pde != NULL) {
1251 m = PHYS_TO_VM_PAGE(MIPS_DIRECT_TO_PHYS(*pde));
1252 m->ref_count++;
1253 } else {
1254 /*
1255 * Here if the pte page isn't mapped, or if it has been
1256 * deallocated.
1257 */
1258 m = _pmap_allocpte(pmap, ptepindex, flags);
1259 if (m == NULL && (flags & PMAP_ENTER_NOSLEEP) == 0)
1260 goto retry;
1261 }
1262 return (m);
1263}
1264
1265/***************************************************
1266 * Pmap allocation/deallocation routines.

Callers 1

pmap_enterFunction · 0.70

Calls 4

pmap_pde_pindexFunction · 0.85
PHYS_TO_VM_PAGEFunction · 0.85
pmap_pdeFunction · 0.70
_pmap_allocpteFunction · 0.70

Tested by

no test coverage detected