setup kernelspace VMA list
This commit is contained in:
parent
3cd5a5853b
commit
79c4f2703e
1 changed files with 26 additions and 0 deletions
26
mm/memory.c
26
mm/memory.c
|
@ -273,18 +273,44 @@ int mmu_init(void)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add kernel to VMA list
|
||||||
|
vma_add((size_t) &kernel_start & PAGE_MASK,
|
||||||
|
PAGE_ALIGN((size_t) &kernel_end),
|
||||||
|
VMA_READ|VMA_WRITE|VMA_EXECUTE|VMA_CACHEABLE);
|
||||||
|
|
||||||
|
// add LAPIC tp VMA list
|
||||||
|
vma_add((size_t) &kernel_start - PAGE_SIZE,
|
||||||
|
(size_t) &kernel_start,
|
||||||
|
VMA_READ|VMA_WRITE);
|
||||||
|
|
||||||
|
#if MAX_CORES > 1
|
||||||
|
// reserve page for SMP boot code
|
||||||
|
vma_add(SMP_SETUP_ADDR & PAGE_MASK,
|
||||||
|
PAGE_ALIGN(SMP_SETUP_ADDR + PAGE_SIZE),
|
||||||
|
VMA_READ|VMA_WRITE|VMA_EXECUTE|VMA_CACHEABLE);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_MULTIBOOT
|
#ifdef CONFIG_MULTIBOOT
|
||||||
/*
|
/*
|
||||||
* Modules like the init ram disk are already loaded.
|
* Modules like the init ram disk are already loaded.
|
||||||
* Therefore, we set these pages as used.
|
* Therefore, we set these pages as used.
|
||||||
*/
|
*/
|
||||||
if (mb_info) {
|
if (mb_info) {
|
||||||
|
vma_add((size_t) mb_info & PAGE_MASK,
|
||||||
|
PAGE_ALIGN((size_t) mb_info + sizeof(multiboot_info_t)),
|
||||||
|
VMA_READ|VMA_CACHEABLE);
|
||||||
|
|
||||||
if (mb_info->flags & MULTIBOOT_INFO_MODS) {
|
if (mb_info->flags & MULTIBOOT_INFO_MODS) {
|
||||||
multiboot_module_t* mmodule = (multiboot_module_t*) ((size_t) mb_info->mods_addr);
|
multiboot_module_t* mmodule = (multiboot_module_t*) ((size_t) mb_info->mods_addr);
|
||||||
|
|
||||||
|
vma_add((size_t) mb_info->mods_addr & PAGE_MASK,
|
||||||
|
PAGE_ALIGN((size_t) mb_info->mods_addr + mb_info->mods_count*sizeof(multiboot_module_t)),
|
||||||
|
VMA_READ|VMA_CACHEABLE);
|
||||||
|
|
||||||
for(i=0; i<mb_info->mods_count; i++) {
|
for(i=0; i<mb_info->mods_count; i++) {
|
||||||
|
vma_add(PAGE_ALIGN(mmodule[i].mod_start),
|
||||||
|
PAGE_ALIGN(mmodule[i].mod_end),
|
||||||
|
VMA_READ|VMA_WRITE|VMA_CACHEABLE);
|
||||||
|
|
||||||
for(addr=mmodule[i].mod_start; addr<mmodule[i].mod_end; addr+=PAGE_SIZE) {
|
for(addr=mmodule[i].mod_start; addr<mmodule[i].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