From 520a1e60de4341f55c59cf4680d6d0242a7f929f Mon Sep 17 00:00:00 2001 From: Chasel Chiu Date: Thu, 25 Jul 2019 22:22:29 +0800 Subject: IntelFsp2Pkg: PeiService pointer not reset to 0 in SecMain 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 Cc: Star Zeng Signed-off-by: Chasel Chiu Reviewed-by: Nate DeSimone Reviewed-by: Star Zeng --- IntelFsp2Pkg/FspSecCore/SecMain.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'IntelFsp2Pkg/FspSecCore/SecMain.h') diff --git a/IntelFsp2Pkg/FspSecCore/SecMain.h b/IntelFsp2Pkg/FspSecCore/SecMain.h index 6fb16febab..af7f387960 100644 --- a/IntelFsp2Pkg/FspSecCore/SecMain.h +++ b/IntelFsp2Pkg/FspSecCore/SecMain.h @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -29,7 +29,13 @@ typedef VOID (*PEI_CORE_ENTRY) ( \ ); typedef struct _SEC_IDT_TABLE { - EFI_PEI_SERVICES *PeiService; + // + // Reserved 8 bytes preceding IDT to store EFI_PEI_SERVICES**, since IDT base + // address should be 8-byte alignment. + // Note: For IA32, only the 4 bytes immediately preceding IDT is used to store + // EFI_PEI_SERVICES** + // + UINT64 PeiService; UINT64 IdtTable[FixedPcdGet8 (PcdFspMaxInterruptSupported)]; } SEC_IDT_TABLE; -- cgit v1.2.3