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

Function pmap_ptelist_alloc

freebsd/i386/i386/pmap.c:922–937  ·  view source on GitHub ↗

* Abuse the pte nodes for unmapped kva to thread a kva freelist through. * Requirements: * - Must deal with pages in order to ensure that none of the PG_* bits * are ever set, PG_V in particular. * - Assumes we can write to ptes without pte_store() atomic ops, even * on PAE systems. This should be ok. * - Assumes nothing will ever test these addresses for 0 to indicate * no map

Source from the content-addressed store, hash-verified

920 * Because PG_V is never set, there can be no mappings to invalidate.
921 */
922static vm_offset_t
923pmap_ptelist_alloc(vm_offset_t *head)
924{
925 pt_entry_t *pte;
926 vm_offset_t va;
927
928 va = *head;
929 if (va == 0)
930 panic("pmap_ptelist_alloc: exhausted ptelist KVA");
931 pte = vtopte(va);
932 *head = *pte;
933 if (*head & PG_V)
934 panic("pmap_ptelist_alloc: va with PG_V set!");
935 *pte = 0;
936 return (va);
937}
938
939static void
940pmap_ptelist_free(vm_offset_t *head, vm_offset_t va)

Callers 1

get_pv_entryFunction · 0.85

Calls 2

vtopteFunction · 0.85
panicFunction · 0.50

Tested by

no test coverage detected