vm: sparse: ensure that vm_pages for the reserved bsp region are created
This commit is contained in:
20
vm/sparse.c
20
vm/sparse.c
@@ -23,6 +23,7 @@
|
||||
overhead, and the flat memory model may be a better choice.
|
||||
*/
|
||||
#include <mango/arg.h>
|
||||
#include <mango/bsp.h>
|
||||
#include <mango/machine/cpu.h>
|
||||
#include <mango/memblock.h>
|
||||
#include <mango/panic.h>
|
||||
@@ -281,6 +282,25 @@ void vm_sparse_init(void)
|
||||
}
|
||||
}
|
||||
|
||||
struct boot_module bsp;
|
||||
bsp_get_location(&bsp);
|
||||
if (bsp.mod_base & VM_PAGE_MASK) {
|
||||
bsp.mod_base &= ~VM_PAGE_MASK;
|
||||
}
|
||||
|
||||
if (bsp.mod_size & VM_PAGE_MASK) {
|
||||
bsp.mod_size &= ~VM_PAGE_MASK;
|
||||
bsp.mod_size += VM_PAGE_SIZE;
|
||||
}
|
||||
|
||||
/* make sure the vm_pages for the bsp image exist, so that they can be
|
||||
* mapped in later */
|
||||
for (phys_addr_t i = bsp.mod_base; i < bsp.mod_base + bsp.mod_size;
|
||||
i += VM_PAGE_SIZE) {
|
||||
struct vm_page *pg = get_or_create_page(i);
|
||||
pg->p_flags = VM_PAGE_RESERVED;
|
||||
}
|
||||
|
||||
for_each_reserved_mem_range(&it, 0x0, pmem_end)
|
||||
{
|
||||
if (it.it_base & VM_PAGE_MASK) {
|
||||
|
||||
Reference in New Issue
Block a user