[U-Boot] [PATCH v2 2/6] efi_loader: save image relocation address and size

Heinrich Schuchardt xypron.glpk at gmx.de
Tue Apr 3 20:29:31 UTC 2018


For analyzing crash output the relocation address and size are needed.
Save them in the loaded image info.

Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
v2
	GRUB does not allow the relocated address to be used as ImageBase
	in the loaded image information. So the relocation address has to
	be stored in an additional field.
---
 include/efi_api.h                 | 2 ++
 lib/efi_loader/efi_image_loader.c | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/include/efi_api.h b/include/efi_api.h
index f138fc90ec..ca8e7849ff 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -331,6 +331,8 @@ struct efi_loaded_image {
 
 	/* Below are efi loader private fields */
 #ifdef CONFIG_EFI_LOADER
+	void *reloc_base;
+	aligned_u64 reloc_size;
 	efi_status_t exit_status;
 	struct jmp_buf_data exit_jmp;
 #endif
diff --git a/lib/efi_loader/efi_image_loader.c b/lib/efi_loader/efi_image_loader.c
index cac64ba9fe..7f602bbf4c 100644
--- a/lib/efi_loader/efi_image_loader.c
+++ b/lib/efi_loader/efi_image_loader.c
@@ -221,6 +222,8 @@ void *efi_load_pe(void *efi, struct efi_loaded_image *loaded_image_info)
 	/* Populate the loaded image interface bits */
 	loaded_image_info->image_base = efi;
 	loaded_image_info->image_size = image_size;
+	loaded_image_info->reloc_base = efi_reloc;
+	loaded_image_info->reloc_size = virt_size;
 
 	return entry;
 }
-- 
2.16.3



More information about the U-Boot mailing list