mirror of https://github.com/acidanthera/audk.git
EmulatorPkg/WinHost: XIP for SEC and PEI_CORE
In EmulatorPkg/Win, SEC and PEI_CORE are loaded to memory allocated through VirtualAlloc. Though the corresponding DLL files are loaded and the entry points in DLL files are executed. The loading to memory allocated through VirtualAlloc is for the case when the DLL files can not be loaded. Actually some PEIMs like PcdPeim which are loaded before "physical" RAM is discovered, they are executing in the original location (FV) like XIP module in real platform. The SEC and PEI_CORE can follow the same mechanism. So, the VirtualAlloc call is removed. This is to prepare the "reset" support to avoid additional OS memory consumption when reset happens. Signed-off-by: Ray Ni <ray.ni@intel.com> Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com> Cc: Andrew Fish <afish@apple.com
This commit is contained in:
parent
d2842bb6ec
commit
a121165e35
|
@ -718,19 +718,9 @@ SecPeCoffGetEntryPoint (
|
|||
}
|
||||
|
||||
//
|
||||
// Allocate space in NT (not emulator) memory with ReadWrite and Execute attribute.
|
||||
// Extra space is for alignment
|
||||
// XIP for SEC and PEI_CORE
|
||||
//
|
||||
ImageContext.ImageAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)VirtualAlloc (NULL, (SIZE_T)(ImageContext.ImageSize + (ImageContext.SectionAlignment * 2)), MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||
if (ImageContext.ImageAddress == 0) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
//
|
||||
// Align buffer on section boundary
|
||||
//
|
||||
ImageContext.ImageAddress += ImageContext.SectionAlignment - 1;
|
||||
ImageContext.ImageAddress &= ~((EFI_PHYSICAL_ADDRESS)ImageContext.SectionAlignment - 1);
|
||||
ImageContext.ImageAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)Pe32Data;
|
||||
|
||||
Status = PeCoffLoaderLoadImage (&ImageContext);
|
||||
if (EFI_ERROR (Status)) {
|
||||
|
|
Loading…
Reference in New Issue