By the time that vm_reserv_init() runs, vm_phys_segs[] is initialized. Use

it instead of phys_avail[].

Discussed with:	Svatopluk Kraus
This commit is contained in:
alc 2014-11-22 17:46:30 +00:00
parent 459c063616
commit f4c161ccb6

View File

@ -818,15 +818,17 @@ void
vm_reserv_init(void)
{
vm_paddr_t paddr;
int i;
struct vm_phys_seg *seg;
int segind;
/*
* Initialize the reservation array. Specifically, initialize the
* "pages" field for every element that has an underlying superpage.
*/
for (i = 0; phys_avail[i + 1] != 0; i += 2) {
paddr = roundup2(phys_avail[i], VM_LEVEL_0_SIZE);
while (paddr + VM_LEVEL_0_SIZE <= phys_avail[i + 1]) {
for (segind = 0; segind < vm_phys_nsegs; segind++) {
seg = &vm_phys_segs[segind];
paddr = roundup2(seg->start, VM_LEVEL_0_SIZE);
while (paddr + VM_LEVEL_0_SIZE <= seg->end) {
vm_reserv_array[paddr >> VM_LEVEL_0_SHIFT].pages =
PHYS_TO_VM_PAGE(paddr);
paddr += VM_LEVEL_0_SIZE;