[PATCH 3/8] efi_loader: Return the memory map in pointer format

Simon Glass
2025-01-06T14:48:34Z

An EFI app expects pointers to be returned, cast to u64. The conversion
to use addresses missed this, so fix the call.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

lib/efi_loader/efi_memory.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index 321a8c3cf31..2e197e94edd 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -735,10 +735,11 @@ efi_status_t efi_get_memory_map(efi_uintn_t *memory_map_size,
list_for_each_entry(lmem, &efi_mem, link) {
memory_map->type = lmem->type;
memory_map->reserved = 0;
- memory_map->physical_start = lmem->base;
+ memory_map->physical_start = (u64)(ulong)map_sysmem(lmem->base,
+ lmem->num_pages * EFI_PAGE_SIZE);

/* virtual and physical are always the same */
- memory_map->virtual_start = lmem->base;
+ memory_map->virtual_start = memory_map->physical_start;
memory_map->num_pages = lmem->num_pages;
memory_map->attribute = lmem->attribute;
memory_map--;
--
2.34.1