[PATCH v1 2/2] IntelFsp2Pkg: Update SEC_IDT_TABLE struct


Kuo, Ted
 

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3957
The reserved IDT table size in SecCore is too small for X64. Changed the ty=
pe
of IdtTable in SEC_IDT_TABLE from UINT64 to IA32_IDT_GATE_DESCRIPTOR to have
sufficient size reserved in IdtTable for X64.

Cc: Chasel Chiu <chasel.chiu@...>
Cc: Nate DeSimone <nathaniel.l.desimone@...>
Cc: Star Zeng <star.zeng@...>
Cc: Ashraf Ali S <ashraf.ali.s@...>
Signed-off-by: Ted Kuo <ted.kuo@...>
---
IntelFsp2Pkg/FspSecCore/SecMain.c | 19 ++++++++++---------
IntelFsp2Pkg/FspSecCore/SecMain.h | 4 ++--
2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/IntelFsp2Pkg/FspSecCore/SecMain.c b/IntelFsp2Pkg/FspSecCore/Se=
cMain.c
index 8effe2225c..6a23275afa 100644
--- a/IntelFsp2Pkg/FspSecCore/SecMain.c
+++ b/IntelFsp2Pkg/FspSecCore/SecMain.c
@@ -58,13 +58,13 @@ SecStartup (
IN UINT32 ApiIdx=0D
)=0D
{=0D
- EFI_SEC_PEI_HAND_OFF SecCoreData;=0D
- IA32_DESCRIPTOR IdtDescriptor;=0D
- SEC_IDT_TABLE IdtTableInStack;=0D
- UINT32 Index;=0D
- FSP_GLOBAL_DATA PeiFspData;=0D
- UINT64 ExceptionHandler;=0D
- UINTN IdtSize;=0D
+ EFI_SEC_PEI_HAND_OFF SecCoreData;=0D
+ IA32_DESCRIPTOR IdtDescriptor;=0D
+ SEC_IDT_TABLE IdtTableInStack;=0D
+ UINT32 Index;=0D
+ FSP_GLOBAL_DATA PeiFspData;=0D
+ IA32_IDT_GATE_DESCRIPTOR ExceptionHandler;=0D
+ UINTN IdtSize;=0D
=0D
//=0D
// Process all libraries constructor function linked to SecCore.=0D
@@ -117,9 +117,10 @@ SecStartup (
IdtTableInStack.PeiService =3D 0;=0D
AsmReadIdtr (&IdtDescriptor);=0D
if (IdtDescriptor.Base =3D=3D 0) {=0D
- ExceptionHandler =3D FspGetExceptionHandler (mIdtEntryTemplate);=0D
+ ZeroMem ((VOID *)&ExceptionHandler, sizeof (IA32_IDT_GATE_DESCRIPTOR))=
;=0D
+ *((UINT64 *) &ExceptionHandler) =3D FspGetExceptionHandler (mIdtEntryT=
emplate);=0D
for (Index =3D 0; Index < FixedPcdGet8 (PcdFspMaxInterruptSupported); =
Index++) {=0D
- CopyMem ((VOID *)&IdtTableInStack.IdtTable[Index], (VOID *)&Exceptio=
nHandler, sizeof (UINT64));=0D
+ CopyMem ((VOID *)&IdtTableInStack.IdtTable[Index], (VOID *)&Exceptio=
nHandler, sizeof (IA32_IDT_GATE_DESCRIPTOR));=0D
}=0D
=0D
IdtSize =3D sizeof (IdtTableInStack.IdtTable);=0D
diff --git a/IntelFsp2Pkg/FspSecCore/SecMain.h b/IntelFsp2Pkg/FspSecCore/Se=
cMain.h
index 7c2642ad48..1fe7c15aeb 100644
--- a/IntelFsp2Pkg/FspSecCore/SecMain.h
+++ b/IntelFsp2Pkg/FspSecCore/SecMain.h
@@ -38,8 +38,8 @@ typedef struct _SEC_IDT_TABLE {
// Note: For IA32, only the 4 bytes immediately preceding IDT is used to=
store=0D
// EFI_PEI_SERVICES**=0D
//=0D
- UINT64 PeiService;=0D
- UINT64 IdtTable[FixedPcdGet8 (PcdFspMaxInterruptSupported)];=0D
+ UINT64 PeiService;=0D
+ IA32_IDT_GATE_DESCRIPTOR IdtTable[FixedPcdGet8 (PcdFspMaxInterruptSuppo=
rted)];=0D
} SEC_IDT_TABLE;=0D
=0D
/**=0D
--=20
2.26.2.windows.1