public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel][PATCH v1 0/2] Update SEC_IDT_TABLE struct to reserve sufficient size in IdtTable for both IA32 and X64
@ 2022-06-27  7:42 Kuo, Ted
  2022-06-27  7:42 ` [edk2-devel][PATCH v1 1/2] UefiCpuPkg: Update SEC_IDT_TABLE struct Kuo, Ted
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Kuo, Ted @ 2022-06-27  7:42 UTC (permalink / raw)
  To: devel

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.

Ted Kuo (2):
  UefiCpuPkg: Update SEC_IDT_TABLE struct
  IntelFsp2Pkg: Update SEC_IDT_TABLE struct

 IntelFsp2Pkg/FspSecCore/SecMain.c | 19 ++++++++++---------
 IntelFsp2Pkg/FspSecCore/SecMain.h |  4 ++--
 UefiCpuPkg/SecCore/SecMain.c      |  1 +
 UefiCpuPkg/SecCore/SecMain.h      |  4 ++--
 4 files changed, 15 insertions(+), 13 deletions(-)

-- 
2.26.2.windows.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [edk2-devel][PATCH v1 1/2] UefiCpuPkg: Update SEC_IDT_TABLE struct
  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 ` Kuo, Ted
  2022-06-27  7:42 ` [edk2-devel][PATCH v1 2/2] IntelFsp2Pkg: " Kuo, Ted
       [not found] ` <16FC6A736EB591CC.466@groups.io>
  2 siblings, 0 replies; 4+ messages in thread
From: Kuo, Ted @ 2022-06-27  7:42 UTC (permalink / raw)
  To: devel
  Cc: Chasel Chiu, Nate DeSimone, Ray Ni, Ashraf Ali S, Debkumar De,
	Harry Han, Catharine West

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. dff

Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Ashraf Ali S <ashraf.ali.s@intel.com>
Cc: Debkumar De <debkumar.de@intel.com>
Cc: Harry Han <harry.han@intel.com>
Cc: Catharine West <catharine.west@intel.com>
Signed-off-by: Ted Kuo <ted.kuo@intel.com>
---
 UefiCpuPkg/SecCore/SecMain.c | 1 +
 UefiCpuPkg/SecCore/SecMain.h | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/UefiCpuPkg/SecCore/SecMain.c b/UefiCpuPkg/SecCore/SecMain.c
index a7526be9dd..d7140c2db3 100644
--- a/UefiCpuPkg/SecCore/SecMain.c
+++ b/UefiCpuPkg/SecCore/SecMain.c
@@ -202,6 +202,7 @@ SecStartup (
 
   IdtTableInStack.PeiService = 0;
   for (Index = 0; Index < SEC_IDT_ENTRY_COUNT; Index++) {
+    ZeroMem ((VOID *)&IdtTableInStack.IdtTable[Index], sizeof (IA32_IDT_GATE_DESCRIPTOR));
     CopyMem ((VOID *)&IdtTableInStack.IdtTable[Index], (VOID *)&mIdtEntryTemplate, sizeof (UINT64));
   }
 
diff --git a/UefiCpuPkg/SecCore/SecMain.h b/UefiCpuPkg/SecCore/SecMain.h
index 189fcf9326..1be57c2248 100644
--- a/UefiCpuPkg/SecCore/SecMain.h
+++ b/UefiCpuPkg/SecCore/SecMain.h
@@ -43,8 +43,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[SEC_IDT_ENTRY_COUNT];
+  UINT64                    PeiService;
+  IA32_IDT_GATE_DESCRIPTOR  IdtTable[SEC_IDT_ENTRY_COUNT];
 } SEC_IDT_TABLE;
 
 /**
-- 
2.26.2.windows.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [edk2-devel][PATCH v1 2/2] IntelFsp2Pkg: Update SEC_IDT_TABLE struct
  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
       [not found] ` <16FC6A736EB591CC.466@groups.io>
  2 siblings, 0 replies; 4+ messages in thread
From: Kuo, Ted @ 2022-06-27  7:42 UTC (permalink / raw)
  To: devel; +Cc: Chasel Chiu, Nate DeSimone, Star Zeng, Ashraf Ali S

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [edk2-devel][PATCH v1 1/2] UefiCpuPkg: Update SEC_IDT_TABLE struct
       [not found] ` <16FC6A736EB591CC.466@groups.io>
@ 2022-07-11  9:11   ` Ni, Ray
  0 siblings, 0 replies; 4+ messages in thread
From: Ni, Ray @ 2022-07-11  9:11 UTC (permalink / raw)
  To: devel@edk2.groups.io, Kuo, Ted
  Cc: Chiu, Chasel, Desimone, Nathaniel L, S, Ashraf Ali, De, Debkumar,
	Han, Harry, West, Catharine

Reviewed-by: Ray Ni <ray.ni@intel.com>

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kuo, Ted
> Sent: Monday, June 27, 2022 3:43 PM
> To: devel@edk2.groups.io
> Cc: Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Ni, Ray
> <ray.ni@intel.com>; S, Ashraf Ali <ashraf.ali.s@intel.com>; De, Debkumar <debkumar.de@intel.com>; Han, Harry
> <harry.han@intel.com>; West, Catharine <catharine.west@intel.com>
> Subject: [edk2-devel][PATCH v1 1/2] UefiCpuPkg: Update SEC_IDT_TABLE struct
> 
> 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. dff
> 
> Cc: Chasel Chiu <chasel.chiu@intel.com>
> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Ashraf Ali S <ashraf.ali.s@intel.com>
> Cc: Debkumar De <debkumar.de@intel.com>
> Cc: Harry Han <harry.han@intel.com>
> Cc: Catharine West <catharine.west@intel.com>
> Signed-off-by: Ted Kuo <ted.kuo@intel.com>
> ---
>  UefiCpuPkg/SecCore/SecMain.c | 1 +
>  UefiCpuPkg/SecCore/SecMain.h | 4 ++--
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/UefiCpuPkg/SecCore/SecMain.c b/UefiCpuPkg/SecCore/SecMain.c
> index a7526be9dd..d7140c2db3 100644
> --- a/UefiCpuPkg/SecCore/SecMain.c
> +++ b/UefiCpuPkg/SecCore/SecMain.c
> @@ -202,6 +202,7 @@ SecStartup (
> 
> 
>    IdtTableInStack.PeiService = 0;
> 
>    for (Index = 0; Index < SEC_IDT_ENTRY_COUNT; Index++) {
> 
> +    ZeroMem ((VOID *)&IdtTableInStack.IdtTable[Index], sizeof (IA32_IDT_GATE_DESCRIPTOR));
> 
>      CopyMem ((VOID *)&IdtTableInStack.IdtTable[Index], (VOID *)&mIdtEntryTemplate, sizeof (UINT64));
> 
>    }
> 
> 
> 
> diff --git a/UefiCpuPkg/SecCore/SecMain.h b/UefiCpuPkg/SecCore/SecMain.h
> index 189fcf9326..1be57c2248 100644
> --- a/UefiCpuPkg/SecCore/SecMain.h
> +++ b/UefiCpuPkg/SecCore/SecMain.h
> @@ -43,8 +43,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[SEC_IDT_ENTRY_COUNT];
> 
> +  UINT64                    PeiService;
> 
> +  IA32_IDT_GATE_DESCRIPTOR  IdtTable[SEC_IDT_ENTRY_COUNT];
> 
>  } SEC_IDT_TABLE;
> 
> 
> 
>  /**
> 
> --
> 2.26.2.windows.1
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#90785): https://edk2.groups.io/g/devel/message/90785
> Mute This Topic: https://groups.io/mt/92015981/1862468
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [ted.kuo@intel.com]
> -=-=-=-=-=-=
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-07-11  9:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [edk2-devel][PATCH v1 2/2] IntelFsp2Pkg: " Kuo, Ted
     [not found] ` <16FC6A736EB591CC.466@groups.io>
2022-07-11  9:11   ` [edk2-devel][PATCH v1 1/2] UefiCpuPkg: " Ni, Ray

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox