]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkModulePkg/Core/DxeIplX64Peim/DxeLoadX64.c
Fix gcc build break for this module.
[mirror_edk2.git] / EdkModulePkg / Core / DxeIplX64Peim / DxeLoadX64.c
index 7b293ef0c2bb39cca1de152853c56d051f8f18eb..8e4f1126b69c1121822af0a14ef741003b3a69c5 100644 (file)
@@ -259,8 +259,8 @@ Returns:
   ASSERT (BaseOfStack != 0);\r
 \r
   //\r
-  // Compute the top of the stack we were allocated. Pre-allocate a 32 bytes\r
-  // for x64 calling convention.\r
+  // Compute the top of the stack we were allocated, which is used to load X64 dxe core. \r
+  // Pre-allocate a 32 bytes which confroms to x64 calling convention.\r
   //\r
   // The first four parameters to a function are passed in rcx, rdx, r8 and r9. \r
   // Any further parameters are pushed on the stack. Furthermore, space (4 * 8bytes) for the \r
@@ -269,6 +269,11 @@ Returns:
   //\r
   TopOfStack = BaseOfStack + EFI_SIZE_TO_PAGES (STACK_SIZE) * EFI_PAGE_SIZE - 32;\r
 \r
+  //\r
+  //  X64 Calling Conventions requires that the stack must be aligned to 16 bytes\r
+  //\r
+  TopOfStack = (EFI_PHYSICAL_ADDRESS) (UINTN) ALIGN_POINTER (TopOfStack, 16);\r
+\r
   //\r
   // Add architecture-specifc HOBs (including the BspStore HOB)\r
   //\r
@@ -319,8 +324,9 @@ Returns:
   ASSERT_EFI_ERROR (Status);\r
 \r
   //\r
-  // Load the GDT of Go64. Since the GDT of 32-bit Tiano locates in the BS_DATA \\r
+  // Load the GDT of Go64. Since the GDT of 32-bit Tiano locates in the BS_DATA\r
   // memory, it may be corrupted when copying FV to high-end memory \r
+  //\r
   LoadGo64Gdt();\r
 \r
   //\r
@@ -1056,4 +1062,5 @@ Returns:
   *Pe32Data = SectionData;\r
 \r
   return EFI_SUCCESS;\r
-}
\ No newline at end of file
+}\r
+\r