This driver is dispatched by Dxe core and the driver will reload itself to ACPI reserved memory\r
in the entry point. The functionality is to interpret and restore the S3 boot script\r
\r
-Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>\r
\r
This program and the accompanying materials\r
// for that parameter.\r
//\r
Status = S3BootScriptExecute ();\r
- \r
+\r
//\r
// If invalid script table or opcode in S3 boot script table.\r
//\r
ASSERT_EFI_ERROR (Status);\r
- \r
+\r
if (EFI_ERROR (Status)) {\r
CpuDeadLoop ();\r
return Status;\r
//\r
if (PeiS3ResumeState != 0) {\r
//\r
- // Need report status back to S3ResumePeim. \r
+ // Need report status back to S3ResumePeim.\r
// If boot script execution is failed, S3ResumePeim wil report the error status code.\r
//\r
PeiS3ResumeState->ReturnStatus = (UINT64)(UINTN)Status;\r
CpuDeadLoop();\r
return EFI_UNSUPPORTED;\r
}\r
- \r
+\r
//\r
// S3ResumePeim does not provide a way to jump back to itself, so resume to OS here directly\r
//\r
/**\r
This is the Event notification function to reload BootScriptExecutor image\r
to RESERVED mem and save it to LockBox.\r
- \r
+\r
@param Event Pointer to this event\r
- @param Context Event handler private data \r
+ @param Context Event handler private data\r
**/\r
VOID\r
EFIAPI\r
UINTN Pages;\r
EFI_PHYSICAL_ADDRESS FfsBuffer;\r
PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;\r
+ EFI_GCD_MEMORY_SPACE_DESCRIPTOR MemDesc;\r
\r
Status = gBS->LocateProtocol (&gEfiDxeSmmReadyToLockProtocolGuid, NULL, &Interface);\r
if (EFI_ERROR (Status)) {\r
&FfsBuffer\r
);\r
ASSERT_EFI_ERROR (Status);\r
+\r
+ //\r
+ // Make sure that the buffer can be used to store code.\r
+ //\r
+ Status = gDS->GetMemorySpaceDescriptor (FfsBuffer, &MemDesc);\r
+ if (!EFI_ERROR (Status) && (MemDesc.Attributes & EFI_MEMORY_XP) != 0) {\r
+ gDS->SetMemorySpaceAttributes (\r
+ FfsBuffer,\r
+ EFI_PAGES_TO_SIZE (Pages),\r
+ MemDesc.Attributes & (~EFI_MEMORY_XP)\r
+ );\r
+ }\r
+\r
ImageContext.ImageAddress = (PHYSICAL_ADDRESS)(UINTN)FfsBuffer;\r
//\r
// Align buffer on section boundary\r