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

Function vm_page_array_alloc

freebsd/vm/vm_page.c:519–540  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

517
518#ifndef PMAP_HAS_PAGE_ARRAY
519static vm_paddr_t
520vm_page_array_alloc(vm_offset_t *vaddr, vm_paddr_t end, vm_paddr_t page_range)
521{
522 vm_paddr_t new_end;
523
524 /*
525 * Reserve an unmapped guard page to trap access to vm_page_array[-1].
526 * However, because this page is allocated from KVM, out-of-bounds
527 * accesses using the direct map will not be trapped.
528 */
529 *vaddr += PAGE_SIZE;
530
531 /*
532 * Allocate physical memory for the page structures, and map it.
533 */
534 new_end = trunc_page(end - page_range * sizeof(struct vm_page));
535 vm_page_array = (vm_page_t)pmap_map(vaddr, new_end, end,
536 VM_PROT_READ | VM_PROT_WRITE);
537 vm_page_array_size = page_range;
538
539 return (new_end);
540}
541#endif
542
543/*

Callers 1

vm_page_startupFunction · 0.85

Calls 1

pmap_mapFunction · 0.50

Tested by

no test coverage detected