* Setup L2 page table page for given KVA. * Used in pre-bootstrap epoch. * * Note that we have allocated NKPT2PG pages for L2 page tables in advance * and used them for mapping KVA starting from KERNBASE. However, this is not * enough. Vectors and devices need L2 page tables too. Note that they are * even above VM_MAX_KERNEL_ADDRESS. */
| 913 | * even above VM_MAX_KERNEL_ADDRESS. |
| 914 | */ |
| 915 | static __inline vm_paddr_t |
| 916 | pmap_preboot_pt2pg_setup(vm_offset_t va) |
| 917 | { |
| 918 | pt2_entry_t *pte2p, pte2; |
| 919 | vm_paddr_t pt2pg_pa; |
| 920 | |
| 921 | /* Get associated entry in PT2TAB. */ |
| 922 | pte2p = kern_pt2tab_entry(va); |
| 923 | |
| 924 | /* Just return, if PT2s page exists already. */ |
| 925 | pte2 = pt2tab_load(pte2p); |
| 926 | if (pte2_is_valid(pte2)) |
| 927 | return (pte2_pa(pte2)); |
| 928 | |
| 929 | KASSERT(va >= VM_MAX_KERNEL_ADDRESS, |
| 930 | ("%s: NKPT2PG too small", __func__)); |
| 931 | |
| 932 | /* |
| 933 | * Allocate page for PT2s and insert it to PT2TAB. |
| 934 | * In other words, map it into PT2MAP space. |
| 935 | */ |
| 936 | pt2pg_pa = pmap_preboot_get_pages(1); |
| 937 | pt2tab_store(pte2p, PTE2_KPT(pt2pg_pa)); |
| 938 | |
| 939 | /* Zero all PT2s in allocated page. */ |
| 940 | bzero((void*)pt2map_pt2pg(va), PAGE_SIZE); |
| 941 | pte2_sync_range((pt2_entry_t *)pt2map_pt2pg(va), PAGE_SIZE); |
| 942 | |
| 943 | return (pt2pg_pa); |
| 944 | } |
| 945 | |
| 946 | /* |
| 947 | * Setup L2 page table for given KVA. |
no test coverage detected