From 49470c251cffe7d8783ebee1a7e961ee0d035b2e Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Wed, 15 Jun 2022 14:11:42 +0300 Subject: [PATCH] Main: src/multiboot2/info_convert.c: Improve func "KernAux_Multiboot2_Info_to_memmap" --- src/multiboot2/info_convert.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/multiboot2/info_convert.c b/src/multiboot2/info_convert.c index 80ad5da..b195494 100644 --- a/src/multiboot2/info_convert.c +++ b/src/multiboot2/info_convert.c @@ -33,6 +33,10 @@ bool KernAux_Multiboot2_Info_to_memmap( KERNAUX_MULTIBOOT2_ITAG_MEMORY_MAP ); + // FIXME: Basic memory info tag may not be provided by some boot loaders on + // EFI platforms if EFI boot services are enabled and available for the + // loaded image (EFI boot services not terminated tag exists in Multiboot2 + // information structure). if (basic_memory_info_tag_base == NULL || memory_map_tag_base == NULL) { return false; } @@ -46,7 +50,12 @@ bool KernAux_Multiboot2_Info_to_memmap( (const struct KernAux_Multiboot2_ITag_MemoryMap*) memory_map_tag_base; - (void)basic_memory_info_tag; + // FIXME: The value returned for upper memory is maximally the address of + // the first upper memory hole minus 1 megabyte. It is not guaranteed to be + // this value. + const size_t memory_size = (size_t)basic_memory_info_tag->mem_upper * 1024; + KernAux_MemMap_init(memmap, memory_size); + (void)memory_map_tag; return false;