]> git.proxmox.com Git - mirror_edk2.git/commitdiff
IntelFsp2Pkg: PeiService pointer not reset to 0 in SecMain
authorChasel Chiu <chasel.chiu@intel.com>
Thu, 25 Jul 2019 14:22:29 +0000 (22:22 +0800)
committerChasel Chiu <chasel.chiu@intel.com>
Fri, 26 Jul 2019 01:47:27 +0000 (09:47 +0800)
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2018

Current FSP SEC_IDT_TABLE structure is not natural aligned:
  typedef struct _SEC_IDT_TABLE {
    EFI_PEI_SERVICES  *PeiService;
    UINT64            IdtTable[];
  } SEC_IDT_TABLE;
Compiler will insert DWORD padding between 2 elements and
GetPeiServicesTablePointer() in early phase then always
returns padding data from stack, which was not reset to 0
in SecMain.

Solution is to align FSP SEC_IDT_TABLE structure to UefiCpuPkg
to have UINT64 as PeiService field and reset it to 0.

Test: Verified on internal platform and booting successfully
      with FSP API mode.

Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
IntelFsp2Pkg/FspSecCore/SecMain.c
IntelFsp2Pkg/FspSecCore/SecMain.h

index a63d1336e48e933efbd0f5ae94e35baa0afd16fd..7169afc6c7c0836164c3107fc684f9865e693696 100644 (file)
@@ -114,7 +114,7 @@ SecStartup (
   // |                   |\r
   // |                   |\r
   // |-------------------|---->  TempRamBase\r
-  IdtTableInStack.PeiService  = NULL;\r
+  IdtTableInStack.PeiService = 0;\r
   AsmReadIdtr (&IdtDescriptor);\r
   if (IdtDescriptor.Base == 0) {\r
     ExceptionHandler = FspGetExceptionHandler(mIdtEntryTemplate);\r
index 6fb16febabc6ff37e6ccf06112bb78453ca0b964..af7f3879600731ee2d8fb89a7d7d135ea59451fa 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-  Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.<BR>\r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
@@ -29,7 +29,13 @@ typedef VOID (*PEI_CORE_ENTRY) ( \
 );\r
 \r
 typedef struct _SEC_IDT_TABLE {\r
-  EFI_PEI_SERVICES  *PeiService;\r
+  //\r
+  // Reserved 8 bytes preceding IDT to store EFI_PEI_SERVICES**, since IDT base\r
+  // address should be 8-byte alignment.\r
+  // Note: For IA32, only the 4 bytes immediately preceding IDT is used to store\r
+  // EFI_PEI_SERVICES**\r
+  //\r
+  UINT64            PeiService;\r
   UINT64            IdtTable[FixedPcdGet8 (PcdFspMaxInterruptSupported)];\r
 } SEC_IDT_TABLE;\r
 \r