mirror of
https://github.com/limine-bootloader/limine
synced 2024-12-03 21:52:39 +03:00
pmm: Workaround for cases in which AllocatePages fails during initialisation
This commit is contained in:
parent
244b461700
commit
a6acfb7606
@ -356,9 +356,6 @@ void init_memmap(void) {
|
|||||||
ext_mem_alloc_type(0x100000, MEMMAP_EFI_RECLAIMABLE);
|
ext_mem_alloc_type(0x100000, MEMMAP_EFI_RECLAIMABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(untouched_memmap, memmap, memmap_entries * sizeof(struct e820_entry_t));
|
|
||||||
untouched_memmap_entries = memmap_entries;
|
|
||||||
|
|
||||||
// Now own all the usable entries
|
// Now own all the usable entries
|
||||||
for (size_t i = 0; i < memmap_entries; i++) {
|
for (size_t i = 0; i < memmap_entries; i++) {
|
||||||
if (memmap[i].type != MEMMAP_USABLE)
|
if (memmap[i].type != MEMMAP_USABLE)
|
||||||
@ -369,10 +366,15 @@ void init_memmap(void) {
|
|||||||
status = gBS->AllocatePages(AllocateAddress, EfiLoaderData,
|
status = gBS->AllocatePages(AllocateAddress, EfiLoaderData,
|
||||||
memmap[i].length / 4096, &base);
|
memmap[i].length / 4096, &base);
|
||||||
|
|
||||||
if (status)
|
if (status) {
|
||||||
panic("pmm: AllocatePages failure (%x)", status);
|
print("pmm: WARNING: AllocatePages failure (%d)\n", status);
|
||||||
|
memmap_alloc_range(memmap[i].base, memmap[i].length, MEMMAP_RESERVED, true, true, false, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memcpy(untouched_memmap, memmap, memmap_entries * sizeof(struct e820_entry_t));
|
||||||
|
untouched_memmap_entries = memmap_entries;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
fail:
|
fail:
|
||||||
panic("pmm: Failure initialising memory map");
|
panic("pmm: Failure initialising memory map");
|
||||||
|
Loading…
Reference in New Issue
Block a user