summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2011-03-07 02:23:00 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2011-03-07 02:23:00 +0000
commita1fe1d6dd87986175207c62992ef956d518b8163 (patch)
treefde4abd56235c986816740c17022dae4788af8c2
parent6377d2f12d7eeed0b9c623ed44e21bf908acad55 (diff)
downloadedk2-platforms-a1fe1d6dd87986175207c62992ef956d518b8163.tar.xz
ECP package BootScriptSaveOnS3SaveStateThunk driver needs to support framework 32bit dispatch code. It must be loaded into <4G memory.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11349 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/ScriptSave.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/ScriptSave.c b/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/ScriptSave.c
index 9a4119b318..7248e2e860 100644
--- a/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/ScriptSave.c
+++ b/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/ScriptSave.c
@@ -797,11 +797,12 @@ InitializeScriptSaveOnS3SaveState (
{
UINT8 *Buffer;
UINTN BufferSize;
- VOID *FfsBuffer;
PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
BOOT_SCRIPT_THUNK_DATA *BootScriptThunkData;
EFI_STATUS Status;
VOID *DevicePath;
+ EFI_PHYSICAL_ADDRESS MemoryAddress;
+ UINTN PageNumber;
//
// Test if the gEfiCallerIdGuid of this image is already installed. if not, the entry
@@ -839,15 +840,19 @@ InitializeScriptSaveOnS3SaveState (
if (EFI_ERROR (Status)) {
return Status;
}
- Status = gBS->AllocatePool (
- EfiACPIMemoryNVS,
- BufferSize + ImageContext.SectionAlignment,
- &FfsBuffer
- );
+
+ MemoryAddress = SIZE_4GB - 1;
+ PageNumber = EFI_SIZE_TO_PAGES (BufferSize + ImageContext.SectionAlignment);
+ Status = gBS->AllocatePages (
+ AllocateMaxAddress,
+ EfiACPIMemoryNVS,
+ PageNumber,
+ &MemoryAddress
+ );
if (EFI_ERROR (Status)) {
return EFI_OUT_OF_RESOURCES;
}
- ImageContext.ImageAddress = (PHYSICAL_ADDRESS)(UINTN)FfsBuffer;
+ ImageContext.ImageAddress = (PHYSICAL_ADDRESS)(UINTN)MemoryAddress;
//
// Align buffer on section boundry
//
@@ -858,7 +863,7 @@ InitializeScriptSaveOnS3SaveState (
//
Status = PeCoffLoaderLoadImage (&ImageContext);
if (EFI_ERROR (Status)) {
- gBS->FreePool (FfsBuffer);
+ gBS->FreePages (MemoryAddress, PageNumber);
return Status;
}
@@ -869,7 +874,7 @@ InitializeScriptSaveOnS3SaveState (
if (EFI_ERROR (Status)) {
PeCoffLoaderUnloadImage (&ImageContext);
- gBS->FreePool (FfsBuffer);
+ gBS->FreePages (MemoryAddress, PageNumber);
return Status;
}
//
@@ -878,7 +883,7 @@ InitializeScriptSaveOnS3SaveState (
InvalidateInstructionCacheRange ((VOID *)(UINTN)ImageContext.ImageAddress, (UINTN)ImageContext.ImageSize);
Status = ((EFI_IMAGE_ENTRY_POINT)(UINTN)(ImageContext.EntryPoint)) ((EFI_HANDLE)(UINTN)(ImageContext.ImageAddress), SystemTable);
if (EFI_ERROR (Status)) {
- gBS->FreePool (FfsBuffer);
+ gBS->FreePages (MemoryAddress, PageNumber);
return Status;
}
//