* This code makes some *MAJOR* assumptions: * 1. Current pmap & pmap exists. * 2. Not wired. * 3. Read access. * 4. No L2 page table pages. * but is *MUCH* faster than pmap_enter... */
| 4527 | * but is *MUCH* faster than pmap_enter... |
| 4528 | */ |
| 4529 | static vm_page_t |
| 4530 | pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, |
| 4531 | vm_prot_t prot, vm_page_t mpt2pg) |
| 4532 | { |
| 4533 | pt2_entry_t *pte2p, pte2; |
| 4534 | vm_paddr_t pa; |
| 4535 | struct spglist free; |
| 4536 | uint32_t l2prot; |
| 4537 | |
| 4538 | KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva || |
| 4539 | (m->oflags & VPO_UNMANAGED) != 0, |
| 4540 | ("%s: managed mapping within the clean submap", __func__)); |
| 4541 | rw_assert(&pvh_global_lock, RA_WLOCKED); |
| 4542 | PMAP_LOCK_ASSERT(pmap, MA_OWNED); |
| 4543 | |
| 4544 | /* |
| 4545 | * In the case that a L2 page table page is not |
| 4546 | * resident, we are creating it here. |
| 4547 | */ |
| 4548 | if (va < VM_MAXUSER_ADDRESS) { |
| 4549 | u_int pte1_idx; |
| 4550 | pt1_entry_t pte1, *pte1p; |
| 4551 | vm_paddr_t pt2_pa; |
| 4552 | |
| 4553 | /* |
| 4554 | * Get L1 page table things. |
| 4555 | */ |
| 4556 | pte1_idx = pte1_index(va); |
| 4557 | pte1p = pmap_pte1(pmap, va); |
| 4558 | pte1 = pte1_load(pte1p); |
| 4559 | |
| 4560 | if (mpt2pg && (mpt2pg->pindex == (pte1_idx & ~PT2PG_MASK))) { |
| 4561 | /* |
| 4562 | * Each of NPT2_IN_PG L2 page tables on the page can |
| 4563 | * come here. Make sure that associated L1 page table |
| 4564 | * link is established. |
| 4565 | * |
| 4566 | * QQQ: It comes that we don't establish all links to |
| 4567 | * L2 page tables for newly allocated L2 page |
| 4568 | * tables page. |
| 4569 | */ |
| 4570 | KASSERT(!pte1_is_section(pte1), |
| 4571 | ("%s: pte1 %#x is section", __func__, pte1)); |
| 4572 | if (!pte1_is_link(pte1)) { |
| 4573 | pt2_pa = page_pt2pa(VM_PAGE_TO_PHYS(mpt2pg), |
| 4574 | pte1_idx); |
| 4575 | pte1_store(pte1p, PTE1_LINK(pt2_pa)); |
| 4576 | } |
| 4577 | pt2_wirecount_inc(mpt2pg, pte1_idx); |
| 4578 | } else { |
| 4579 | /* |
| 4580 | * If the L2 page table page is mapped, we just |
| 4581 | * increment the hold count, and activate it. |
| 4582 | */ |
| 4583 | if (pte1_is_section(pte1)) { |
| 4584 | return (NULL); |
| 4585 | } else if (pte1_is_link(pte1)) { |
| 4586 | mpt2pg = PHYS_TO_VM_PAGE(pte1_link_pa(pte1)); |
no test coverage detected