| 7257 | } |
| 7258 | |
| 7259 | static vm_page_t |
| 7260 | pmap_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; |
no test coverage detected