linux: Make sure to align kernel and modules memory map allocations to page size

This commit is contained in:
mintsuki 2021-04-29 00:45:02 +02:00
parent f2b172be71
commit 1365d9656b
1 changed files with 2 additions and 2 deletions

View File

@ -416,7 +416,7 @@ void linux_load(char *config, char *cmdline) {
print("linux: Loading kernel...\n");
for (;;) {
if (memmap_alloc_range(kernel_load_addr,
kernel->size - real_mode_code_size,
ALIGN_UP(kernel->size - real_mode_code_size, 4096),
MEMMAP_BOOTLOADER_RECLAIMABLE, true, false, false, false))
break;
@ -450,7 +450,7 @@ void linux_load(char *config, char *cmdline) {
modules_mem_base = ALIGN_DOWN(modules_mem_base, 4096);
for (;;) {
if (memmap_alloc_range(modules_mem_base, size_of_all_modules,
if (memmap_alloc_range(modules_mem_base, ALIGN_UP(size_of_all_modules, 4096),
MEMMAP_BOOTLOADER_RECLAIMABLE, true, false, false, false))
break;
modules_mem_base -= 4096;