mirror of
https://github.com/limine-bootloader/limine
synced 2024-11-30 04:13:13 +03:00
efi: Handle cases where untouched memmap entries are lower than current base
This commit is contained in:
parent
4859ee9790
commit
dcfef93ff6
@ -234,7 +234,25 @@ retry:
|
||||
if (untouched_memmap[j].type != MEMMAP_USABLE)
|
||||
continue;
|
||||
|
||||
if (untouched_memmap[j].base >= base && untouched_memmap[j].base < top) {
|
||||
if (top > untouched_memmap[j].base && top <= untouched_memmap[j].base + untouched_memmap[j].length) {
|
||||
if (untouched_memmap[j].base < base) {
|
||||
new_entry->NumberOfPages = (base - untouched_memmap[j].base) / 4096;
|
||||
|
||||
efi_copy_i++;
|
||||
if (efi_copy_i == EFI_COPY_MAX_ENTRIES) {
|
||||
panic(false, "efi: New memory map exhausted");
|
||||
}
|
||||
new_entry = (void *)efi_copy + efi_copy_i * efi_desc_size;
|
||||
memcpy(new_entry, orig_entry, efi_desc_size);
|
||||
|
||||
new_entry->NumberOfPages -= (base - untouched_memmap[j].base) / 4096;
|
||||
new_entry->PhysicalStart = base;
|
||||
new_entry->VirtualStart = new_entry->PhysicalStart;
|
||||
|
||||
length = new_entry->NumberOfPages * 4096;
|
||||
top = base + length;
|
||||
}
|
||||
|
||||
if (untouched_memmap[j].base > base) {
|
||||
new_entry->NumberOfPages = (untouched_memmap[j].base - base) / 4096;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user