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

Function pmap_allocpte2

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

Source from the content-addressed store, hash-verified

2520}
2521
2522static vm_page_t
2523pmap_allocpte2(pmap_t pmap, vm_offset_t va, u_int flags)
2524{
2525 u_int pte1_idx;
2526 pt1_entry_t *pte1p, pte1;
2527 vm_page_t m;
2528
2529 pte1_idx = pte1_index(va);
2530retry:
2531 pte1p = pmap->pm_pt1 + pte1_idx;
2532 pte1 = pte1_load(pte1p);
2533
2534 /*
2535 * This supports switching from a 1MB page to a
2536 * normal 4K page.
2537 */
2538 if (pte1_is_section(pte1)) {
2539 (void)pmap_demote_pte1(pmap, pte1p, va);
2540 /*
2541 * Reload pte1 after demotion.
2542 *
2543 * Note: Demotion can even fail as either PT2 is not find for
2544 * the virtual address or PT2PG can not be allocated.
2545 */
2546 pte1 = pte1_load(pte1p);
2547 }
2548
2549 /*
2550 * If the L2 page table page is mapped, we just increment the
2551 * hold count, and activate it.
2552 */
2553 if (pte1_is_link(pte1)) {
2554 m = PHYS_TO_VM_PAGE(pte1_link_pa(pte1));
2555 pt2_wirecount_inc(m, pte1_idx);
2556 } else {
2557 /*
2558 * Here if the PT2 isn't mapped, or if it has
2559 * been deallocated.
2560 */
2561 m = _pmap_allocpte2(pmap, va, flags);
2562 if (m == NULL && (flags & PMAP_ENTER_NOSLEEP) == 0)
2563 goto retry;
2564 }
2565
2566 return (m);
2567}
2568
2569/*
2570 * Schedule the specified unused L2 page table page to be freed. Specifically,

Callers 2

pmap_enterFunction · 0.85
pmap_copyFunction · 0.85

Calls 9

pte1_indexFunction · 0.85
pte1_loadFunction · 0.85
pte1_is_sectionFunction · 0.85
pmap_demote_pte1Function · 0.85
pte1_is_linkFunction · 0.85
PHYS_TO_VM_PAGEFunction · 0.85
pte1_link_paFunction · 0.85
pt2_wirecount_incFunction · 0.85
_pmap_allocpte2Function · 0.85

Tested by

no test coverage detected