From e239aed80dbfd9c8e3c20f24f78cbf0857ef546d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marvin=20Ha=CC=88user?= <8659494+mhaeuser@users.noreply.github.com> Date: Sat, 3 Jun 2023 15:53:23 +0200 Subject: [PATCH] ImageTool: Update RelocateImage internal prototype --- MdePkg/Library/BaseUefiImageLib/PeSupport.c | 8 ++++---- MdePkg/Library/BaseUefiImageLib/UefiImageFormat.h | 8 ++++---- MdePkg/Library/BaseUefiImageLib/UefiImageLib.c | 14 +++++++++----- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/MdePkg/Library/BaseUefiImageLib/PeSupport.c b/MdePkg/Library/BaseUefiImageLib/PeSupport.c index 94aba92cbf..5a18b0dc18 100644 --- a/MdePkg/Library/BaseUefiImageLib/PeSupport.c +++ b/MdePkg/Library/BaseUefiImageLib/PeSupport.c @@ -96,10 +96,10 @@ UefiImageLoaderGetRuntimeContextSizePe ( RETURN_STATUS UefiImageRelocateImagePe ( - IN OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context, - IN UINT64 BaseAddress, - OUT UEFI_IMAGE_LOADER_RUNTIME_CONTEXT *RuntimeContext OPTIONAL, - IN UINT32 RuntimeContextSize + IN OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context, + IN UINT64 BaseAddress, + OUT VOID *RuntimeContext OPTIONAL, + IN UINT32 RuntimeContextSize ) { return PeCoffRelocateImage ( diff --git a/MdePkg/Library/BaseUefiImageLib/UefiImageFormat.h b/MdePkg/Library/BaseUefiImageLib/UefiImageFormat.h index 5288d8ce56..3ade95a9ea 100644 --- a/MdePkg/Library/BaseUefiImageLib/UefiImageFormat.h +++ b/MdePkg/Library/BaseUefiImageLib/UefiImageFormat.h @@ -71,10 +71,10 @@ RETURN_STATUS typedef RETURN_STATUS (*UEFI_IMAGE_RELOCARE_IMAGE) ( - IN OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context, - IN UINT64 BaseAddress, - OUT UEFI_IMAGE_LOADER_RUNTIME_CONTEXT *RuntimeContext OPTIONAL, - IN UINT32 RuntimeContextSize + IN OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context, + IN UINT64 BaseAddress, + OUT VOID *RuntimeContext OPTIONAL, + IN UINT32 RuntimeContextSize ); typedef diff --git a/MdePkg/Library/BaseUefiImageLib/UefiImageLib.c b/MdePkg/Library/BaseUefiImageLib/UefiImageLib.c index cb66037145..c2eb99f3f0 100644 --- a/MdePkg/Library/BaseUefiImageLib/UefiImageLib.c +++ b/MdePkg/Library/BaseUefiImageLib/UefiImageLib.c @@ -285,12 +285,16 @@ UefiImageRelocateImage ( ) { RETURN_STATUS Status; + VOID *FormatContext; + UINT32 FormatContextSize; + FormatContext = RuntimeContext; + FormatContextSize = RuntimeContextSize; if (RuntimeContext != NULL) { *(UINT64 *)RuntimeContext = Context->FormatIndex; - RuntimeContext = (UEFI_IMAGE_LOADER_RUNTIME_CONTEXT *)((UINT64 *)RuntimeContext + 1); - ASSERT (RuntimeContextSize >= 8); - RuntimeContextSize -= 8; + FormatContext = (VOID *)((UINT64 *)RuntimeContext + 1); + ASSERT (FormatContextSize >= 8); + FormatContextSize -= 8; } UEFI_IMAGE_EXEC ( @@ -299,8 +303,8 @@ UefiImageRelocateImage ( RelocateImage, Context, BaseAddress, - RuntimeContext, - RuntimeContextSize + FormatContext, + FormatContextSize ); if (!RETURN_ERROR (Status)) {