Use CPU_STACK_ALIGNMENT to align stack allocated for used in the DXE Phase.
authormdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 9 Nov 2006 22:04:33 +0000 (22:04 +0000)
committermdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 9 Nov 2006 22:04:33 +0000 (22:04 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1924 6f19259b-4bc3-4df7-8a09-765794883524

EdkModulePkg/Core/DxeIplPeim/DxeLoad.c

index 8e1aeed..fdd6c24 100644 (file)
@@ -259,7 +259,8 @@ Returns:
   // Compute the top of the stack we were allocated. Pre-allocate a UINTN\r
   // for safety.\r
   //\r
-  TopOfStack = (VOID *)((UINTN)BaseOfStack + EFI_SIZE_TO_PAGES (STACK_SIZE) * EFI_PAGE_SIZE - sizeof (UINTN));\r
+  TopOfStack = (VOID *)((UINTN)BaseOfStack + EFI_SIZE_TO_PAGES (STACK_SIZE) * EFI_PAGE_SIZE - CPU_STACK_ALIGNMENT);\r
+  TopOfStack = ALIGN_POINTER (TopOfStack, CPU_STACK_ALIGNMENT);\r
 \r
   //\r
   // Add architecture-specifc HOBs (including the BspStore HOB)\r