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

Function vm_page_startup

freebsd/vm/vm_page.c:551–822  ·  view source on GitHub ↗

* vm_page_startup: * * Initializes the resident memory module. Allocates physical memory for * bootstrapping UMA and some data structures that are used to manage * physical pages. Initializes these structures, and populates the free * page queues. */

Source from the content-addressed store, hash-verified

549 * page queues.
550 */
551vm_offset_t
552vm_page_startup(vm_offset_t vaddr)
553{
554 struct vm_phys_seg *seg;
555 vm_page_t m;
556 char *list, *listend;
557 vm_paddr_t end, high_avail, low_avail, new_end, size;
558 vm_paddr_t page_range __unused;
559 vm_paddr_t last_pa, pa;
560 u_long pagecount;
561#if MINIDUMP_PAGE_TRACKING
562 u_long vm_page_dump_size;
563#endif
564 int biggestone, i, segind;
565#ifdef WITNESS
566 vm_offset_t mapped;
567 int witness_size;
568#endif
569#if defined(__i386__) && defined(VM_PHYSSEG_DENSE)
570 long ii;
571#endif
572
573 vaddr = round_page(vaddr);
574
575 vm_phys_early_startup();
576 biggestone = vm_phys_avail_largest();
577 end = phys_avail[biggestone+1];
578
579 /*
580 * Initialize the page and queue locks.
581 */
582 mtx_init(&vm_domainset_lock, "vm domainset lock", NULL, MTX_DEF);
583 for (i = 0; i < PA_LOCK_COUNT; i++)
584 mtx_init(&pa_lock[i], "vm page", NULL, MTX_DEF);
585 for (i = 0; i < vm_ndomains; i++)
586 vm_page_domain_init(i);
587
588 new_end = end;
589#ifdef WITNESS
590 witness_size = round_page(witness_startup_count());
591 new_end -= witness_size;
592 mapped = pmap_map(&vaddr, new_end, new_end + witness_size,
593 VM_PROT_READ | VM_PROT_WRITE);
594 bzero((void *)mapped, witness_size);
595 witness_startup((void *)mapped);
596#endif
597
598#if MINIDUMP_PAGE_TRACKING
599 /*
600 * Allocate a bitmap to indicate that a random physical page
601 * needs to be included in a minidump.
602 *
603 * The amd64 port needs this to indicate which direct map pages
604 * need to be dumped, via calls to dump_add_page()/dump_drop_page().
605 *
606 * However, i386 still needs this workspace internally within the
607 * minidump code. In theory, they are not needed on i386, but are
608 * included should the sf_buf code decide to use them.

Callers 1

vm_mem_initFunction · 0.85

Calls 15

vm_phys_early_startupFunction · 0.85
vm_phys_avail_largestFunction · 0.85
mtx_initFunction · 0.85
vm_page_domain_initFunction · 0.85
witness_startup_countFunction · 0.85
bzeroFunction · 0.85
witness_startupFunction · 0.85
dump_add_pageFunction · 0.85
pmap_page_array_startupFunction · 0.85
vm_page_array_allocFunction · 0.85
vm_reserv_startupFunction · 0.85
vm_phys_avail_sizeFunction · 0.85

Tested by

no test coverage detected