]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPlatformPkg/PrePeiCore/PrePeiCore.c
EmulatorPkg: Support a second GOP window
[mirror_edk2.git] / ArmPlatformPkg / PrePeiCore / PrePeiCore.c
index 65b07b6d894112d7380b25a758335179a751d55d..ee4b281760b3c3c91c8cc612b27af788fc2033bc 100644 (file)
@@ -3,13 +3,7 @@
 *\r
 *  Copyright (c) 2011-2014, ARM Limited. All rights reserved.\r
 *\r
-*  This program and the accompanying materials\r
-*  are licensed and made available under the terms and conditions of the BSD License\r
-*  which accompanies this distribution.  The full text of the license may be found at\r
-*  http://opensource.org/licenses/bsd-license.php\r
-*\r
-*  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-*  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+*  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 *\r
 **/\r
 \r
@@ -117,22 +111,25 @@ PrePeiCoreTemporaryRamSupport (
   VOID                             *NewHeap;\r
   VOID                             *OldStack;\r
   VOID                             *NewStack;\r
+  UINTN                            HeapSize;\r
+\r
+  HeapSize = ALIGN_VALUE (CopySize / 2, CPU_STACK_ALIGNMENT);\r
 \r
   OldHeap = (VOID*)(UINTN)TemporaryMemoryBase;\r
-  NewHeap = (VOID*)((UINTN)PermanentMemoryBase + (CopySize >> 1));\r
+  NewHeap = (VOID*)((UINTN)PermanentMemoryBase + (CopySize - HeapSize));\r
 \r
-  OldStack = (VOID*)((UINTN)TemporaryMemoryBase + (CopySize >> 1));\r
+  OldStack = (VOID*)((UINTN)TemporaryMemoryBase + HeapSize);\r
   NewStack = (VOID*)(UINTN)PermanentMemoryBase;\r
 \r
   //\r
   // Migrate the temporary memory stack to permanent memory stack.\r
   //\r
-  CopyMem (NewStack, OldStack, CopySize >> 1);\r
+  CopyMem (NewStack, OldStack, CopySize - HeapSize);\r
 \r
   //\r
   // Migrate the temporary memory heap to permanent memory heap.\r
   //\r
-  CopyMem (NewHeap, OldHeap, CopySize >> 1);\r
+  CopyMem (NewHeap, OldHeap, HeapSize);\r
 \r
   SecSwitchStack ((UINTN)NewStack - (UINTN)OldStack);\r
 \r