diff --git a/arch/x86/mm/page.c b/arch/x86/mm/page.c index 1e86cb53..b721ecf7 100644 --- a/arch/x86/mm/page.c +++ b/arch/x86/mm/page.c @@ -764,6 +764,11 @@ int arch_paging_init(void) if (mb_info && (mb_info->flags & MULTIBOOT_INFO_MODS)) { multiboot_module_t* mmodule = (multiboot_module_t*) mb_info->mods_addr; + npages = mb_info->mods_count * sizeof(multiboot_module_t) >> PAGE_SHIFT; + if (mb_info->mods_count * sizeof(multiboot_module_t) & (PAGE_SIZE-1)) + npages++; + map_region((size_t) (mb_info->mods_addr), (size_t) (mb_info->mods_addr), npages, MAP_KERNEL_SPACE); + for(i=0; imods_count; i++, mmodule++) { // map physical address to the same virtual address npages = (mmodule->mod_end - mmodule->mod_start) >> PAGE_SHIFT; diff --git a/mm/memory.c b/mm/memory.c index 6cad2520..2150243e 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -143,6 +143,12 @@ int mmu_init(void) atomic_int32_inc(&total_allocated_pages); atomic_int32_dec(&total_available_pages); + for(addr = mb_info->mods_addr; addr < mb_info->mods_addr + mb_info->mods_count * sizeof(multiboot_module_t); addr += PAGE_SIZE) { + page_set_mark(addr >> PAGE_SHIFT); + atomic_int32_inc(&total_allocated_pages); + atomic_int32_dec(&total_available_pages); + } + for(i=0; imods_count; i++, mmodule++) { for(addr=mmodule->mod_start; addrmod_end; addr+=PAGE_SIZE) { page_set_mark(addr >> PAGE_SHIFT);