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