Fixed the pageframe allocation error introduced by
d641f5a211
This did only occur on the SCC: If someone allocated much memory and
wrote over it, it did affect the initrd...
This commit is contained in:
parent
b1bf768341
commit
0a577b9f7e
1 changed files with 11 additions and 9 deletions
20
mm/memory.c
20
mm/memory.c
|
@ -183,15 +183,6 @@ 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);
|
||||||
|
|
||||||
/*
|
|
||||||
* The init ram disk are already loaded.
|
|
||||||
* Therefore, we set these pages as used.
|
|
||||||
*/
|
|
||||||
for(addr=bootinfo->addr; addr < bootinfo->addr+bootinfo->size; addr+=PAGE_SIZE) {
|
|
||||||
page_set_mark(addr >> PAGE_SHIFT);
|
|
||||||
atomic_int32_inc(&total_allocated_pages);
|
|
||||||
atomic_int32_dec(&total_available_pages);
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
#error Currently, MetalSVM supports only the Multiboot specification or the RockCreek processor!
|
#error Currently, MetalSVM supports only the Multiboot specification or the RockCreek processor!
|
||||||
#endif
|
#endif
|
||||||
|
@ -239,6 +230,17 @@ int mmu_init(void)
|
||||||
atomic_int32_inc(&total_pages);
|
atomic_int32_inc(&total_pages);
|
||||||
atomic_int32_inc(&total_available_pages);
|
atomic_int32_inc(&total_available_pages);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The init ram disk are already loaded.
|
||||||
|
* Therefore, we set these pages as used.
|
||||||
|
*/
|
||||||
|
for(addr=bootinfo->addr; addr < bootinfo->addr+bootinfo->size; addr+=PAGE_SIZE) {
|
||||||
|
// This area is already mapped, so we need to virt_to_phys() these addresses.
|
||||||
|
page_set_mark(virt_to_phys(addr) >> PAGE_SHIFT);
|
||||||
|
atomic_int32_inc(&total_allocated_pages);
|
||||||
|
atomic_int32_dec(&total_available_pages);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Add table
Reference in a new issue