paging: Some 1GiB pages adjustments
This commit is contained in:
parent
31736bea08
commit
091baf40a9
@ -460,14 +460,14 @@ pagemap_t stivale_build_pagemap(bool level5pg, bool unmap_null, struct elf_range
|
||||
if (base >= top)
|
||||
continue;
|
||||
|
||||
uint64_t aligned_base = ALIGN_DOWN(base, 0x200000);
|
||||
uint64_t aligned_top = ALIGN_UP(top, 0x200000);
|
||||
uint64_t aligned_base = ALIGN_DOWN(base, 0x40000000);
|
||||
uint64_t aligned_top = ALIGN_UP(top, 0x40000000);
|
||||
uint64_t aligned_length = aligned_top - aligned_base;
|
||||
|
||||
for (uint64_t j = 0; j < aligned_length; j += 0x200000) {
|
||||
for (uint64_t j = 0; j < aligned_length; j += 0x40000000) {
|
||||
uint64_t page = aligned_base + j;
|
||||
map_page(pagemap, page, page, 0x03, Size2MiB);
|
||||
map_page(pagemap, direct_map_offset + page, page, 0x03, Size2MiB);
|
||||
map_page(pagemap, page, page, 0x03, Size1GiB);
|
||||
map_page(pagemap, direct_map_offset + page, page, 0x03, Size1GiB);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -243,7 +243,13 @@ failed_to_load_header_section:
|
||||
panic(true, "stivale2: Requested HHDM slide alignment is not a multiple of 2MiB");
|
||||
}
|
||||
|
||||
direct_map_offset += (rand64() & ~(slt->alignment - 1)) & 0xffffffffff;
|
||||
// XXX: Assert that slt->alignment is not larger than 1GiB and ignore the value altogether.
|
||||
// This is required for 1GiB pages.
|
||||
if (((uint64_t)0x40000000 % slt->alignment) != 0) {
|
||||
panic(true, "stivale2: 1 GiB is not a multiple of HHDM slide alignment");
|
||||
}
|
||||
|
||||
direct_map_offset += (rand64() & ~((uint64_t)0x40000000 - 1)) & 0xfffffffffff;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user