| 2814 | } |
| 2815 | |
| 2816 | static void |
| 2817 | pmap_remove_kernel_l2(pmap_t pmap, pt_entry_t *l2, vm_offset_t va) |
| 2818 | { |
| 2819 | pt_entry_t newl2, oldl2; |
| 2820 | vm_page_t ml3; |
| 2821 | vm_paddr_t ml3pa; |
| 2822 | |
| 2823 | KASSERT(!VIRT_IN_DMAP(va), ("removing direct mapping of %#lx", va)); |
| 2824 | KASSERT(pmap == kernel_pmap, ("pmap %p is not kernel_pmap", pmap)); |
| 2825 | PMAP_LOCK_ASSERT(pmap, MA_OWNED); |
| 2826 | |
| 2827 | ml3 = pmap_remove_pt_page(pmap, va); |
| 2828 | if (ml3 == NULL) |
| 2829 | panic("pmap_remove_kernel_l2: Missing pt page"); |
| 2830 | |
| 2831 | ml3pa = VM_PAGE_TO_PHYS(ml3); |
| 2832 | newl2 = ml3pa | L2_TABLE; |
| 2833 | |
| 2834 | /* |
| 2835 | * If this page table page was unmapped by a promotion, then it |
| 2836 | * contains valid mappings. Zero it to invalidate those mappings. |
| 2837 | */ |
| 2838 | if (ml3->valid != 0) |
| 2839 | pagezero((void *)PHYS_TO_DMAP(ml3pa)); |
| 2840 | |
| 2841 | /* |
| 2842 | * Demote the mapping. The caller must have already invalidated the |
| 2843 | * mapping (i.e., the "break" in break-before-make). |
| 2844 | */ |
| 2845 | oldl2 = pmap_load_store(l2, newl2); |
| 2846 | KASSERT(oldl2 == 0, ("%s: found existing mapping at %p: %#lx", |
| 2847 | __func__, l2, oldl2)); |
| 2848 | } |
| 2849 | |
| 2850 | /* |
| 2851 | * pmap_remove_l2: Do the things to unmap a level 2 superpage. |
no test coverage detected