stivale: Deprecate low memory area

This commit is contained in:
mintsuki 2021-11-03 01:52:55 +01:00
parent f3aee7feb5
commit 738095c451
2 changed files with 12 additions and 4 deletions

View File

@ -302,8 +302,12 @@ void stivale_load(char *config, char *cmdline) {
if (bits == 64)
pagemap = stivale_build_pagemap(want_5lv, false, NULL, 0, false, 0, 0);
// Reserve 32K at 0x70000
memmap_alloc_range(0x70000, 0x8000, MEMMAP_USABLE, true, true, false, false);
// Reserve 32K at 0x70000 if possible
if (!memmap_alloc_range(0x70000, 0x8000, MEMMAP_USABLE, true, false, false, false)) {
if ((stivale_hdr.flags & (1 << 4)) == 0) {
panic("stivale: Could not allocate low memory area");
}
}
struct e820_entry_t *mmap_copy = ext_mem_alloc(256 * sizeof(struct e820_entry_t));

View File

@ -682,8 +682,12 @@ have_tm_tag:;
ext_mem_alloc(sizeof(struct stivale2_struct_tag_memmap) +
sizeof(struct e820_entry_t) * 256);
// Reserve 32K at 0x70000
memmap_alloc_range(0x70000, 0x8000, MEMMAP_USABLE, true, true, false, false);
// Reserve 32K at 0x70000, if possible
if (!memmap_alloc_range(0x70000, 0x8000, MEMMAP_USABLE, true, false, false, false)) {
if ((stivale2_hdr.flags & (1 << 4)) == 0) {
panic("stivale2: Could not allocate low memory area");
}
}
size_t mmap_entries;
struct e820_entry_t *mmap = get_memmap(&mmap_entries);