mirror of
https://github.com/limine-bootloader/limine
synced 2025-01-21 03:52:04 +03:00
pmm: Sanitise away usable entry parts below 0x1000
This commit is contained in:
parent
7619908d1a
commit
b5eea0cc60
@ -167,12 +167,22 @@ static void sanitise_entries(struct e820_entry_t *m, size_t *_count, bool align_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove 0 length usable entries
|
// Remove 0 length usable entries and usable entries below 0x1000
|
||||||
for (size_t i = 0; i < count; i++) {
|
for (size_t i = 0; i < count; i++) {
|
||||||
if (m[i].type != MEMMAP_USABLE)
|
if (m[i].type != MEMMAP_USABLE)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (m[i].base < 0x1000) {
|
||||||
|
if (m[i].base + m[i].length <= 0x1000) {
|
||||||
|
goto del_mm1;
|
||||||
|
}
|
||||||
|
|
||||||
|
m[i].length -= 0x1000 - m[i].base;
|
||||||
|
m[i].base = 0x1000;
|
||||||
|
}
|
||||||
|
|
||||||
if (m[i].length == 0) {
|
if (m[i].length == 0) {
|
||||||
|
del_mm1:
|
||||||
// Eradicate from memmap
|
// Eradicate from memmap
|
||||||
for (size_t j = i + 1; j < count; j++) {
|
for (size_t j = i + 1; j < count; j++) {
|
||||||
m[j - 1] = m[j];
|
m[j - 1] = m[j];
|
||||||
|
Loading…
Reference in New Issue
Block a user