Changeset 119
- Timestamp:
- Jul 3, 2017, 12:33:21 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/x86_64/core/hal_init.c
r116 r119 80 80 } 81 81 82 static size_t init_bootinfo_pages_nr() 83 { 84 size_t mmap_length = mb_info.mi_mmap_length; 85 uint8_t *mmap_addr = (uint8_t *)&mb_mmap; 86 paddr_t maxpa, pa; 87 size_t i; 88 89 i = 0; 90 maxpa = 0; 91 while (i < mmap_length) { 92 struct multiboot_mmap *mm; 93 94 mm = (struct multiboot_mmap *)(mmap_addr + i); 95 96 if (mm->mm_type == 1) { 97 pa = mm->mm_base_addr + mm->mm_length; 98 if (pa > maxpa) 99 maxpa = pa; 100 } 101 102 i += mm->mm_size + 4; 103 } 104 105 return (maxpa / PAGE_SIZE); 106 } 107 82 108 static size_t init_bootinfo_rsvd(boot_rsvd_t *rsvd) 83 109 { … … 94 120 mm = (struct multiboot_mmap *)(mmap_addr + i); 95 121 96 rsvd[rsvd_nr].first_page = 97 rounddown(mm->mm_base_addr, PAGE_SIZE) / PAGE_SIZE; 98 rsvd[rsvd_nr].npages = 99 roundup(mm->mm_length, PAGE_SIZE) / PAGE_SIZE; 100 rsvd_nr++; 101 102 if (rsvd_nr == CONFIG_PPM_MAX_RSVD) 103 x86_panic("too many memory holes"); 122 if (mm->mm_type != 1) { 123 rsvd[rsvd_nr].first_page = 124 rounddown(mm->mm_base_addr, PAGE_SIZE) / PAGE_SIZE; 125 rsvd[rsvd_nr].npages = 126 roundup(mm->mm_length, PAGE_SIZE) / PAGE_SIZE; 127 rsvd_nr++; 128 if (rsvd_nr == CONFIG_PPM_MAX_RSVD) 129 x86_panic("too many memory holes"); 130 } 104 131 105 132 i += mm->mm_size + 4; … … 166 193 offset = hal_gpt_bootstrap_uniformize(); 167 194 info->pages_offset = offset / PAGE_SIZE; 168 info->pages_nr = 0; /* XXX */195 info->pages_nr = init_bootinfo_pages_nr(); 169 196 170 197 info->kernel_code_start = (intptr_t)(KERNTEXTOFF - KERNBASE);
Note: See TracChangeset
for help on using the changeset viewer.