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

Function pmap_preboot_pt2pg_setup

freebsd/arm/arm/pmap-v6.c:915–944  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

913 * even above VM_MAX_KERNEL_ADDRESS.
914 */
915static __inline vm_paddr_t
916pmap_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.

Callers 1

pmap_preboot_pt2_setupFunction · 0.85

Calls 9

kern_pt2tab_entryFunction · 0.85
pt2tab_loadFunction · 0.85
pte2_is_validFunction · 0.85
pte2_paFunction · 0.85
pmap_preboot_get_pagesFunction · 0.85
pt2tab_storeFunction · 0.85
bzeroFunction · 0.85
pt2map_pt2pgFunction · 0.85
pte2_sync_rangeFunction · 0.85

Tested by

no test coverage detected