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

Function nkpt_init

freebsd/amd64/amd64/pmap.c:1527–1558  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1525#define NKPDPE(ptpgs) howmany(ptpgs, NPDEPG)
1526
1527static void
1528nkpt_init(vm_paddr_t addr)
1529{
1530 int pt_pages;
1531
1532#ifdef NKPT
1533 pt_pages = NKPT;
1534#else
1535 pt_pages = howmany(addr, 1 << PDRSHIFT);
1536 pt_pages += NKPDPE(pt_pages);
1537
1538 /*
1539 * Add some slop beyond the bare minimum required for bootstrapping
1540 * the kernel.
1541 *
1542 * This is quite important when allocating KVA for kernel modules.
1543 * The modules are required to be linked in the negative 2GB of
1544 * the address space. If we run out of KVA in this region then
1545 * pmap_growkernel() will need to allocate page table pages to map
1546 * the entire 512GB of KVA space which is an unnecessary tax on
1547 * physical memory.
1548 *
1549 * Secondly, device memory mapped as part of setting up the low-
1550 * level console(s) is taken from KVA, starting at virtual_avail.
1551 * This is because cninit() is called after pmap_bootstrap() but
1552 * before vm_init() and pmap_init(). 20MB for a frame buffer is
1553 * not uncommon.
1554 */
1555 pt_pages += 32; /* 64MB additional slop. */
1556#endif
1557 nkpt = pt_pages;
1558}
1559
1560/*
1561 * Returns the proper write/execute permission for a physical page that is

Callers 1

create_pagetablesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected