From f4c161ccb6f228644f4097b574604e44f89bf27f Mon Sep 17 00:00:00 2001 From: alc Date: Sat, 22 Nov 2014 17:46:30 +0000 Subject: [PATCH] By the time that vm_reserv_init() runs, vm_phys_segs[] is initialized. Use it instead of phys_avail[]. Discussed with: Svatopluk Kraus --- sys/vm/vm_reserv.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/vm/vm_reserv.c b/sys/vm/vm_reserv.c index 4d35a4f53aa9..23980e818126 100644 --- a/sys/vm/vm_reserv.c +++ b/sys/vm/vm_reserv.c @@ -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;