From 12605843cec3971852fdd161baad87fdc25ecd5d Mon Sep 17 00:00:00 2001 From: "Justin C. Miller" Date: Fri, 8 Jan 2021 22:40:30 -0800 Subject: [PATCH] [boot] Don't use custom UEFI memory types The UEFI spec specifically calls out memory types with the high bit set as being available for OS loaders' custom use. However, it seems many UEFI firmware implementations don't handle this well. (Virtualbox, and the firmware on my Intel NUC and Dell XPS laptop to name a few.) So sadly since we can't rely on this feature of UEFI in all cases, we can't use it at all. Instead, treat _all_ memory tagged as EfiLoaderData as possibly containing data that's been passed to the OS by the bootloader and don't free it yet. This will need to be followed up with a change that copies anything we need to save and frees this memory. See: https://github.com/kiznit/rainbow-os/blob/master/boot/machine/efi/README.md --- src/boot/memory.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/boot/memory.cpp b/src/boot/memory.cpp index e283ed9..e0732b2 100644 --- a/src/boot/memory.cpp +++ b/src/boot/memory.cpp @@ -165,6 +165,7 @@ build_kernel_mem_map(kernel::args::header *args, uefi::boot_services *bs) case uefi::memory_type::loader_data: type = mem_type::pending; + break; case uefi::memory_type::runtime_services_code: case uefi::memory_type::runtime_services_data: