mirror of
https://github.com/limine-bootloader/limine
synced 2024-12-02 21:26:59 +03:00
pmm: Protect page 0 of physical memory
This commit is contained in:
parent
8eda1e014a
commit
06315dd809
@ -216,7 +216,18 @@ void init_memmap(void) {
|
||||
panic("Memory map exhausted.");
|
||||
}
|
||||
|
||||
memmap[memmap_entries++] = e820_map[i];
|
||||
memmap[memmap_entries] = e820_map[i];
|
||||
|
||||
if (memmap[memmap_entries].base < 0x1000) {
|
||||
if (memmap[memmap_entries].base + memmap[memmap_entries].length <= 0x1000) {
|
||||
continue;
|
||||
}
|
||||
|
||||
memmap[memmap_entries].length -= 0x1000 - memmap[memmap_entries].base;
|
||||
memmap[memmap_entries].base = 0x1000;
|
||||
}
|
||||
|
||||
memmap_entries++;
|
||||
}
|
||||
|
||||
// Allocate bootloader itself
|
||||
@ -226,8 +237,6 @@ void init_memmap(void) {
|
||||
sanitise_entries(false);
|
||||
|
||||
allocations_disallowed = false;
|
||||
|
||||
print_memmap(memmap, memmap_entries);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -286,6 +295,15 @@ void init_memmap(void) {
|
||||
memmap[memmap_entries].base = entry->PhysicalStart;
|
||||
memmap[memmap_entries].length = entry->NumberOfPages * 4096;
|
||||
|
||||
if (memmap[memmap_entries].base < 0x1000) {
|
||||
if (memmap[memmap_entries].base + memmap[memmap_entries].length <= 0x1000) {
|
||||
continue;
|
||||
}
|
||||
|
||||
memmap[memmap_entries].length -= 0x1000 - memmap[memmap_entries].base;
|
||||
memmap[memmap_entries].base = 0x1000;
|
||||
}
|
||||
|
||||
memmap_entries++;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user