From: "Kuo, Ted" <ted.kuo@intel.com>
To: devel@edk2.groups.io
Cc: Chasel Chiu <chasel.chiu@intel.com>,
Nate DeSimone <nathaniel.l.desimone@intel.com>,
Star Zeng <star.zeng@intel.com>,
Ashraf Ali S <ashraf.ali.s@intel.com>
Subject: [edk2-devel][PATCH v1 2/2] IntelFsp2Pkg: Update SEC_IDT_TABLE struct
Date: Mon, 27 Jun 2022 15:42:59 +0800 [thread overview]
Message-ID: <3bdef4bafc5c2436d33133e625f0d9cee357eda5.1656313431.git.ted.kuo@intel.com> (raw)
In-Reply-To: <cover.1656313431.git.ted.kuo@intel.com>
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3957
The reserved IDT table size in SecCore is too small for X64. Changed the type
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@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Ashraf Ali S <ashraf.ali.s@intel.com>
Signed-off-by: Ted Kuo <ted.kuo@intel.com>
---
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/SecMain.c
index 8effe2225c..6a23275afa 100644
--- a/IntelFsp2Pkg/FspSecCore/SecMain.c
+++ b/IntelFsp2Pkg/FspSecCore/SecMain.c
@@ -58,13 +58,13 @@ SecStartup (
IN UINT32 ApiIdx
)
{
- EFI_SEC_PEI_HAND_OFF SecCoreData;
- IA32_DESCRIPTOR IdtDescriptor;
- SEC_IDT_TABLE IdtTableInStack;
- UINT32 Index;
- FSP_GLOBAL_DATA PeiFspData;
- UINT64 ExceptionHandler;
- UINTN IdtSize;
+ EFI_SEC_PEI_HAND_OFF SecCoreData;
+ IA32_DESCRIPTOR IdtDescriptor;
+ SEC_IDT_TABLE IdtTableInStack;
+ UINT32 Index;
+ FSP_GLOBAL_DATA PeiFspData;
+ IA32_IDT_GATE_DESCRIPTOR ExceptionHandler;
+ UINTN IdtSize;
//
// Process all libraries constructor function linked to SecCore.
@@ -117,9 +117,10 @@ SecStartup (
IdtTableInStack.PeiService = 0;
AsmReadIdtr (&IdtDescriptor);
if (IdtDescriptor.Base == 0) {
- ExceptionHandler = FspGetExceptionHandler (mIdtEntryTemplate);
+ ZeroMem ((VOID *)&ExceptionHandler, sizeof (IA32_IDT_GATE_DESCRIPTOR));
+ *((UINT64 *) &ExceptionHandler) = FspGetExceptionHandler (mIdtEntryTemplate);
for (Index = 0; Index < FixedPcdGet8 (PcdFspMaxInterruptSupported); Index++) {
- CopyMem ((VOID *)&IdtTableInStack.IdtTable[Index], (VOID *)&ExceptionHandler, sizeof (UINT64));
+ CopyMem ((VOID *)&IdtTableInStack.IdtTable[Index], (VOID *)&ExceptionHandler, sizeof (IA32_IDT_GATE_DESCRIPTOR));
}
IdtSize = sizeof (IdtTableInStack.IdtTable);
diff --git a/IntelFsp2Pkg/FspSecCore/SecMain.h b/IntelFsp2Pkg/FspSecCore/SecMain.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
// EFI_PEI_SERVICES**
//
- UINT64 PeiService;
- UINT64 IdtTable[FixedPcdGet8 (PcdFspMaxInterruptSupported)];
+ UINT64 PeiService;
+ IA32_IDT_GATE_DESCRIPTOR IdtTable[FixedPcdGet8 (PcdFspMaxInterruptSupported)];
} SEC_IDT_TABLE;
/**
--
2.26.2.windows.1
next prev parent reply other threads:[~2022-06-27 7:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-27 7:42 [edk2-devel][PATCH v1 0/2] Update SEC_IDT_TABLE struct to reserve sufficient size in IdtTable for both IA32 and X64 Kuo, Ted
2022-06-27 7:42 ` [edk2-devel][PATCH v1 1/2] UefiCpuPkg: Update SEC_IDT_TABLE struct Kuo, Ted
2022-06-27 7:42 ` Kuo, Ted [this message]
[not found] ` <16FC6A736EB591CC.466@groups.io>
2022-07-11 9:11 ` Ni, Ray
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3bdef4bafc5c2436d33133e625f0d9cee357eda5.1656313431.git.ted.kuo@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox