From 75641a43941f63a2f50f5ee8915252c571d24a0a Mon Sep 17 00:00:00 2001 From: "Justin C. Miller" Date: Sat, 23 May 2020 12:37:39 -0700 Subject: [PATCH] [boot] Add explicit memory map pointer to args The bootloader was previously just passing the memory map as a module, but the memory map is important enough to want a direct pointer, instead of having to search the modules. --- src/boot/memory.cpp | 5 +++++ src/include/kernel_args.h | 3 +++ 2 files changed, 8 insertions(+) diff --git a/src/boot/memory.cpp b/src/boot/memory.cpp index aa0ac45..ddb6d20 100644 --- a/src/boot/memory.cpp +++ b/src/boot/memory.cpp @@ -231,6 +231,11 @@ build_kernel_mem_map(kernel::args::header *args, uefi::boot_services *bs) } } + // Give just the actually-set entries in the header + args->mem_map = kernel_map; + args->num_map_entries = i; + + // But pass the entire allocated area in a module as well kernel::args::module &module = args->modules[args->num_modules++]; module.location = reinterpret_cast(kernel_map); module.size = map_size; diff --git a/src/include/kernel_args.h b/src/include/kernel_args.h index c713b49..dcdedf9 100644 --- a/src/include/kernel_args.h +++ b/src/include/kernel_args.h @@ -80,6 +80,9 @@ struct header { uint32_t num_modules; module *modules; + mem_entry *mem_map; + size_t num_map_entries; + void *runtime_services; void *acpi_table; }