diff options
Diffstat (limited to 'src/kernel/pagemgr.C')
| -rw-r--r-- | src/kernel/pagemgr.C | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/src/kernel/pagemgr.C b/src/kernel/pagemgr.C index c402c51bb..3c05fc6ab 100644 --- a/src/kernel/pagemgr.C +++ b/src/kernel/pagemgr.C @@ -211,11 +211,6 @@ void PageManager::_initialize() uint64_t endBlock = ALIGN_MEGABYTE_DOWN(currentBlock) + 512*KILOBYTE; - // Populate L3 cache lines for this chunk. - KernelMisc::populate_cache_lines( - reinterpret_cast<uint64_t*>(currentBlock), - reinterpret_cast<uint64_t*>(endBlock)); - // Adjust address to compensate for reserved hole and add to // heap... @@ -246,16 +241,27 @@ void PageManager::_initialize() // Hole is in the middle... yuck. else { - uint64_t pages = - (VmmManager::FIRST_RESERVED_PAGE - currentBlock) / PAGESIZE; + uint64_t hole_end = + (VmmManager::FIRST_RESERVED_PAGE - currentBlock); + + // Populate L3 for the first part of the chunk. + KernelMisc::populate_cache_lines( + reinterpret_cast<uint64_t*>(currentBlock), + reinterpret_cast<uint64_t*>(hole_end)); - iv_heap.addMemory(currentBlock, pages); - totalPages += pages; + // Add it to the heap. + iv_heap.addMemory(currentBlock, hole_end / PAGESIZE); + totalPages += (hole_end / PAGESIZE); currentBlock = VmmManager::END_RESERVED_PAGE; } } + // Populate L3 cache lines for this chunk. + KernelMisc::populate_cache_lines( + reinterpret_cast<uint64_t*>(currentBlock), + reinterpret_cast<uint64_t*>(endBlock)); + uint64_t pages = (endBlock - currentBlock) / PAGESIZE; iv_heap.addMemory(currentBlock, pages); @@ -265,6 +271,12 @@ void PageManager::_initialize() } while (reinterpret_cast<page_t*>(currentBlock) != endAddr); + // Ensure HW page table area is erased / populated. + KernelMisc::populate_cache_lines( + reinterpret_cast<uint64_t*>(VmmManager::INITIAL_PT_OFFSET), + reinterpret_cast<uint64_t*>(VmmManager::INITIAL_PT_OFFSET + + VmmManager::PTSIZE)); + printk("%ld pages.\n", totalPages); // Reserve pages for the kernel. |

