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

Function pmap_enter_quick_locked

freebsd/amd64/amd64/pmap.c:7259–7350  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7257}
7258
7259static vm_page_t
7260pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m,
7261 vm_prot_t prot, vm_page_t mpte, struct rwlock **lockp)
7262{
7263 pt_entry_t newpte, *pte, PG_V;
7264
7265 KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva ||
7266 (m->oflags & VPO_UNMANAGED) != 0,
7267 ("pmap_enter_quick_locked: managed mapping within the clean submap"));
7268 PG_V = pmap_valid_bit(pmap);
7269 PMAP_LOCK_ASSERT(pmap, MA_OWNED);
7270
7271 /*
7272 * In the case that a page table page is not
7273 * resident, we are creating it here.
7274 */
7275 if (va < VM_MAXUSER_ADDRESS) {
7276 vm_pindex_t ptepindex;
7277 pd_entry_t *ptepa;
7278
7279 /*
7280 * Calculate pagetable page index
7281 */
7282 ptepindex = pmap_pde_pindex(va);
7283 if (mpte && (mpte->pindex == ptepindex)) {
7284 mpte->ref_count++;
7285 } else {
7286 /*
7287 * Get the page directory entry
7288 */
7289 ptepa = pmap_pde(pmap, va);
7290
7291 /*
7292 * If the page table page is mapped, we just increment
7293 * the hold count, and activate it. Otherwise, we
7294 * attempt to allocate a page table page. If this
7295 * attempt fails, we don't retry. Instead, we give up.
7296 */
7297 if (ptepa && (*ptepa & PG_V) != 0) {
7298 if (*ptepa & PG_PS)
7299 return (NULL);
7300 mpte = PHYS_TO_VM_PAGE(*ptepa & PG_FRAME);
7301 mpte->ref_count++;
7302 } else {
7303 /*
7304 * Pass NULL instead of the PV list lock
7305 * pointer, because we don't intend to sleep.
7306 */
7307 mpte = pmap_allocpte_alloc(pmap, ptepindex,
7308 NULL, va);
7309 if (mpte == NULL)
7310 return (mpte);
7311 }
7312 }
7313 pte = (pt_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(mpte));
7314 pte = &pte[pmap_pte_index(va)];
7315 } else {
7316 mpte = NULL;

Callers 2

pmap_enter_objectFunction · 0.70
pmap_enter_quickFunction · 0.70

Calls 12

pmap_valid_bitFunction · 0.85
pmap_pde_pindexFunction · 0.85
PHYS_TO_VM_PAGEFunction · 0.85
pmap_allocpte_allocFunction · 0.85
pmap_pte_indexFunction · 0.85
vtopteFunction · 0.85
pmap_pkru_getFunction · 0.85
pmap_pdeFunction · 0.70
pmap_try_insert_pv_entryFunction · 0.70
pmap_abort_ptpFunction · 0.70
pmap_resident_count_incFunction · 0.70
pmap_cache_bitsFunction · 0.70

Tested by

no test coverage detected