summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Core
diff options
context:
space:
mode:
authorJeff Brasen <jbrasen@nvidia.com>2023-05-15 23:48:56 +0000
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-10-31 14:40:50 +0000
commitaa8431822b7631659586247b1e50d21126f3cfcc (patch)
tree4a0a8afbd31e0c964859dd4cabd7757a46a60042 /MdeModulePkg/Core
parenta671a14e63fdaa9490e5c61cf11346416f1d1463 (diff)
downloadedk2-aa8431822b7631659586247b1e50d21126f3cfcc.zip
edk2-aa8431822b7631659586247b1e50d21126f3cfcc.tar.gz
edk2-aa8431822b7631659586247b1e50d21126f3cfcc.tar.bz2
MdeModulePkg/DxeCore: Allow relocation of images with large address
Add PCD to control if modules with start addresses in PE/COFF > 0x100000 attempt to load at specified address. If a module has an address in this range and there is untested memory DxeCore will attempt to promote all memory to tested which bypasses any memory testing that would occur later in boot. There are several existing AARCH64 option roms that have base addresses of 0x180000000. Signed-off-by: Jeff Brasen <jbrasen@nvidia.com> Reviewed-by: Ashish Singhal <ashishsingha@nvidia.com> Message-Id: <bd36c9c24158590db2226ede05cb8c2f50c93a37.1684194452.git.jbrasen@nvidia.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Diffstat (limited to 'MdeModulePkg/Core')
-rw-r--r--MdeModulePkg/Core/Dxe/DxeMain.inf1
-rw-r--r--MdeModulePkg/Core/Dxe/Image/Image.c4
2 files changed, 4 insertions, 1 deletions
diff --git a/MdeModulePkg/Core/Dxe/DxeMain.inf b/MdeModulePkg/Core/Dxe/DxeMain.inf
index 35d5bf0..16871f2 100644
--- a/MdeModulePkg/Core/Dxe/DxeMain.inf
+++ b/MdeModulePkg/Core/Dxe/DxeMain.inf
@@ -187,6 +187,7 @@
gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPropertyMask ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdFwVolDxeMaxEncapsulationDepth ## CONSUMES
+ gEfiMdeModulePkgTokenSpaceGuid.PcdImageLargeAddressLoad ## CONSUMES
# [Hob]
# RESOURCE_DESCRIPTOR ## CONSUMES
diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c b/MdeModulePkg/Core/Dxe/Image/Image.c
index 9dbfb2a..6bc3a54 100644
--- a/MdeModulePkg/Core/Dxe/Image/Image.c
+++ b/MdeModulePkg/Core/Dxe/Image/Image.c
@@ -680,7 +680,9 @@ CoreLoadPeImage (
);
}
} else {
- if ((Image->ImageContext.ImageAddress >= 0x100000) || Image->ImageContext.RelocationsStripped) {
+ if ((PcdGetBool (PcdImageLargeAddressLoad) && ((Image->ImageContext.ImageAddress) >= 0x100000)) ||
+ Image->ImageContext.RelocationsStripped)
+ {
Status = CoreAllocatePages (
AllocateAddress,
(EFI_MEMORY_TYPE)(Image->ImageContext.ImageCodeMemoryType),