diff options
Diffstat (limited to 'ArmPlatformPkg')
-rw-r--r-- | ArmPlatformPkg/PrePeiCore/MainMPCore.c | 4 | ||||
-rw-r--r-- | ArmPlatformPkg/PrePeiCore/MainUniCore.c | 4 | ||||
-rw-r--r-- | ArmPlatformPkg/PrePeiCore/PrePeiCore.c | 35 |
3 files changed, 29 insertions, 14 deletions
diff --git a/ArmPlatformPkg/PrePeiCore/MainMPCore.c b/ArmPlatformPkg/PrePeiCore/MainMPCore.c index 74f4b8e77a..58eeef1c3a 100644 --- a/ArmPlatformPkg/PrePeiCore/MainMPCore.c +++ b/ArmPlatformPkg/PrePeiCore/MainMPCore.c @@ -84,8 +84,8 @@ PrimaryMain ( SecCoreData.TemporaryRamSize = (UINTN)(UINTN)PcdGet32 (PcdCPUCorePrimaryStackSize);
SecCoreData.PeiTemporaryRamBase = (VOID *)((UINTN)(SecCoreData.TemporaryRamBase) + (SecCoreData.TemporaryRamSize / 2));
SecCoreData.PeiTemporaryRamSize = SecCoreData.TemporaryRamSize / 2;
- SecCoreData.StackBase = SecCoreData.TemporaryRamBase;
- SecCoreData.StackSize = SecCoreData.TemporaryRamSize - SecCoreData.PeiTemporaryRamSize;
+ SecCoreData.StackBase = (VOID *)((UINTN)(SecCoreData.TemporaryRamBase) + (SecCoreData.TemporaryRamSize/2));
+ SecCoreData.StackSize = SecCoreData.TemporaryRamSize / 2;
// Jump to PEI core entry point
(PeiCoreEntryPoint)(&SecCoreData, (VOID *)&gSecPpiTable);
diff --git a/ArmPlatformPkg/PrePeiCore/MainUniCore.c b/ArmPlatformPkg/PrePeiCore/MainUniCore.c index 7b32e40114..9f7de371f4 100644 --- a/ArmPlatformPkg/PrePeiCore/MainUniCore.c +++ b/ArmPlatformPkg/PrePeiCore/MainUniCore.c @@ -46,8 +46,8 @@ PrimaryMain ( SecCoreData.TemporaryRamSize = (UINTN)(UINTN)PcdGet32 (PcdCPUCorePrimaryStackSize);
SecCoreData.PeiTemporaryRamBase = (VOID *)((UINTN)(SecCoreData.TemporaryRamBase) + (SecCoreData.TemporaryRamSize / 2));
SecCoreData.PeiTemporaryRamSize = SecCoreData.TemporaryRamSize / 2;
- SecCoreData.StackBase = SecCoreData.TemporaryRamBase;
- SecCoreData.StackSize = SecCoreData.TemporaryRamSize - SecCoreData.PeiTemporaryRamSize;
+ SecCoreData.StackBase = (VOID *)((UINTN)(SecCoreData.TemporaryRamBase) + (SecCoreData.TemporaryRamSize/2));
+ SecCoreData.StackSize = SecCoreData.TemporaryRamSize / 2;
// jump to pei core entry point
(PeiCoreEntryPoint)(&SecCoreData, (VOID *)&gSecPpiTable);
diff --git a/ArmPlatformPkg/PrePeiCore/PrePeiCore.c b/ArmPlatformPkg/PrePeiCore/PrePeiCore.c index a61d0b8857..1927035365 100644 --- a/ArmPlatformPkg/PrePeiCore/PrePeiCore.c +++ b/ArmPlatformPkg/PrePeiCore/PrePeiCore.c @@ -24,14 +24,14 @@ #include "PrePeiCore.h"
-EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI mSecTemporaryRamSupportPpi = {SecTemporaryRamSupport};
+EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI mTemporaryRamSupportPpi = { PrePeiCoreTemporaryRamSupport };
ARM_GLOBAL_VARIABLE_PPI mGlobalVariablePpi = { PrePeiCoreGetGlobalVariableMemory };
EFI_PEI_PPI_DESCRIPTOR gCommonPpiTable[] = {
{
EFI_PEI_PPI_DESCRIPTOR_PPI,
&gEfiTemporaryRamSupportPpiGuid,
- &mSecTemporaryRamSupportPpi
+ &mTemporaryRamSupportPpi
},
{
EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
@@ -85,23 +85,38 @@ CEntryPoint ( EFI_STATUS
EFIAPI
-SecTemporaryRamSupport (
+PrePeiCoreTemporaryRamSupport (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase,
IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase,
IN UINTN CopySize
)
{
+ VOID *OldHeap;
+ VOID *NewHeap;
+ VOID *OldStack;
+ VOID *NewStack;
+
+ OldHeap = (VOID*)(UINTN)TemporaryMemoryBase;
+ NewHeap = (VOID*)((UINTN)PermanentMemoryBase + (CopySize >> 1));
+
+ OldStack = (VOID*)((UINTN)TemporaryMemoryBase + (CopySize >> 1));
+ NewStack = (VOID*)(UINTN)PermanentMemoryBase;
+
+ //
+ // Migrate the temporary memory stack to permanent memory stack.
//
- // Migrate the whole temporary memory to permenent memory.
+ CopyMem (NewStack, OldStack, CopySize >> 1);
+
+ //
+ // Migrate the temporary memory heap to permanent memory heap.
//
- CopyMem (
- (VOID*)(UINTN)PermanentMemoryBase,
- (VOID*)(UINTN)TemporaryMemoryBase,
- CopySize
- );
+ CopyMem (NewHeap, OldHeap, CopySize >> 1);
+
+ SecSwitchStack ((UINTN)NewStack - (UINTN)OldStack);
- SecSwitchStack((UINTN)(PermanentMemoryBase - TemporaryMemoryBase));
+ return EFI_SUCCESS;
+}
EFI_STATUS
PrePeiCoreGetGlobalVariableMemory (
|