From 7f08cc7c225fedc5acc6962852cafef902bbcdcd Mon Sep 17 00:00:00 2001 From: Mike Beaton Date: Mon, 30 Oct 2023 09:30:52 +0000 Subject: [PATCH] OcBootManagementLib: Add missing explicit initialisation of mImageLoaderCaps in OcImageLoaderLoad (#496) Fix mentioned in changelog incorporates this and the previous commit --- Changelog.md | 1 + Library/OcBootManagementLib/ImageLoader.c | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/Changelog.md b/Changelog.md index c09574c7d40..abf32a20cf8 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,6 +4,7 @@ OpenCore Changelog - Updated builtin firmware versions for SMBIOS and the rest - Fixed hang while generating boot entries on some systems - Added `efidebug.tool` support for 32-bit on 32-bit using GDB or LLDB +- Fixed potential incorrect values in kernel image capabilities calculation #### v0.9.5 - Fixed GUID formatting for legacy NVRAM saving diff --git a/Library/OcBootManagementLib/ImageLoader.c b/Library/OcBootManagementLib/ImageLoader.c index c6448b5759e..3e108a9f0f2 100644 --- a/Library/OcBootManagementLib/ImageLoader.c +++ b/Library/OcBootManagementLib/ImageLoader.c @@ -270,6 +270,17 @@ OcImageLoaderLoad ( OC_LOADED_IMAGE_PROTOCOL *OcLoadedImage; EFI_LOADED_IMAGE_PROTOCOL *LoadedImage; + // + // For OcImageLoaderLoad always assume target default. + // + #ifdef MDE_CPU_IA32 + mImageLoaderCaps = OC_KERN_CAPABILITY_K32_U32 | OC_KERN_CAPABILITY_K32_U64; + #else + mImageLoaderCaps = OC_KERN_CAPABILITY_K64_U64; + #endif + + mImageLoaderCapsHandle = NULL; + ASSERT (SourceBuffer != NULL); // @@ -411,6 +422,8 @@ OcImageLoaderLoad ( return Status; } + mImageLoaderCapsHandle = *ImageHandle; + DEBUG ((DEBUG_VERBOSE, "OCB: Loaded image at %p\n", *ImageHandle)); return EFI_SUCCESS;