this fixes booting with initrd on qemu 1.0
patch submitted by Niels Ole Salscheider <niels_ole@salscheider-online.de>
This commit is contained in:
parent
4e53aa6f95
commit
bfbd560f70
2 changed files with 11 additions and 0 deletions
|
@ -764,6 +764,11 @@ int arch_paging_init(void)
|
||||||
if (mb_info && (mb_info->flags & MULTIBOOT_INFO_MODS)) {
|
if (mb_info && (mb_info->flags & MULTIBOOT_INFO_MODS)) {
|
||||||
multiboot_module_t* mmodule = (multiboot_module_t*) mb_info->mods_addr;
|
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; i<mb_info->mods_count; i++, mmodule++) {
|
for(i=0; i<mb_info->mods_count; i++, mmodule++) {
|
||||||
// map physical address to the same virtual address
|
// map physical address to the same virtual address
|
||||||
npages = (mmodule->mod_end - mmodule->mod_start) >> PAGE_SHIFT;
|
npages = (mmodule->mod_end - mmodule->mod_start) >> PAGE_SHIFT;
|
||||||
|
|
|
@ -143,6 +143,12 @@ int mmu_init(void)
|
||||||
atomic_int32_inc(&total_allocated_pages);
|
atomic_int32_inc(&total_allocated_pages);
|
||||||
atomic_int32_dec(&total_available_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; i<mb_info->mods_count; i++, mmodule++) {
|
for(i=0; i<mb_info->mods_count; i++, mmodule++) {
|
||||||
for(addr=mmodule->mod_start; addr<mmodule->mod_end; addr+=PAGE_SIZE) {
|
for(addr=mmodule->mod_start; addr<mmodule->mod_end; addr+=PAGE_SIZE) {
|
||||||
page_set_mark(addr >> PAGE_SHIFT);
|
page_set_mark(addr >> PAGE_SHIFT);
|
||||||
|
|
Loading…
Add table
Reference in a new issue