]> git.proxmox.com Git - mirror_edk2.git/commitdiff
CpuException: Remove InitializeCpuInterruptHandlers
authorRay Ni <ray.ni@intel.com>
Wed, 18 May 2022 09:51:21 +0000 (17:51 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Fri, 10 Jun 2022 07:54:48 +0000 (07:54 +0000)
InitializeCpuExceptionHandlers() expects caller allocates IDT while
InitializeCpuInterruptHandlers() allocates 256 IDT entries itself.

InitializeCpuExceptionHandlers() fills max 32 IDT entries allocated
by caller. If caller allocates 10 entries, the API just fills 10 IDT
entries.

The inconsistency between the two APIs makes code hard to
unerstand and hard to share.

Because there is only one caller (CpuDxe) for
InitializeCpuInterruptHandler(), this patch updates CpuDxe driver
to allocates 256 IDT entries then call
InitializeCpuExceptionHandlers().

This is also a backward compatible change.

With this change, InitializeCpuInterruptHandlers() is removed
completely.

And InitializeCpuExceptionHandlers() fills max 32 entries for PEI
and SMM instance, max 256 entries for DXE instance.
Such behavior matches to the original one.

Signed-off-by: Ray Ni <ray.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
MdeModulePkg/Include/Library/CpuExceptionHandlerLib.h
MdeModulePkg/Library/CpuExceptionHandlerLibNull/CpuExceptionHandlerLibNull.c
UefiCpuPkg/CpuDxe/CpuDxe.c
UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c
UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuException.c
UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c
UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c
UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmException.c

index 22a4408f9f9e2fa428a39a002fc2f30280dc7723..d4649bebe1ba4a066f0774610cf206bfd0c54c49 100644 (file)
@@ -2,7 +2,7 @@
   CPU Exception library provides the default CPU interrupt/exception handler.\r
   It also provides capability to register user interrupt/exception handler.\r
 \r
-  Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2012 - 2022, Intel Corporation. All rights reserved.<BR>\r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
@@ -132,28 +132,6 @@ InitializeCpuExceptionHandlersEx (
   IN CPU_EXCEPTION_INIT_DATA  *InitData OPTIONAL\r
   );\r
 \r
-/**\r
-  Initializes all CPU interrupt/exceptions entries and provides the default interrupt/exception handlers.\r
-\r
-  Caller should try to get an array of interrupt and/or exception vectors that are in use and need to\r
-  persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification.\r
-  If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL.\r
-  If VectorInfo is not NULL, the exception vectors will be initialized per vector attribute accordingly.\r
-\r
-  @param[in]  VectorInfo    Pointer to reserved vector list.\r
-\r
-  @retval EFI_SUCCESS           All CPU interrupt/exception entries have been successfully initialized\r
-                                with default interrupt/exception handlers.\r
-  @retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL.\r
-  @retval EFI_UNSUPPORTED       This function is not supported.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-InitializeCpuInterruptHandlers (\r
-  IN EFI_VECTOR_HANDOFF_INFO  *VectorInfo OPTIONAL\r
-  );\r
-\r
 /**\r
   Registers a function to be called from the processor interrupt handler.\r
 \r
@@ -161,8 +139,8 @@ InitializeCpuInterruptHandlers (
   interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the\r
   handler for the processor interrupt or exception type specified by InterruptType is uninstalled.\r
   The installed handler is called once for each processor interrupt or exception.\r
-  NOTE: This function should be invoked after InitializeCpuExceptionHandlers() or\r
-  InitializeCpuInterruptHandlers() invoked, otherwise EFI_UNSUPPORTED returned.\r
+  NOTE: This function should be invoked after InitializeCpuExceptionHandlers() is invoked,\r
+  otherwise EFI_UNSUPPORTED returned.\r
 \r
   @param[in]  InterruptType     Defines which interrupt or exception to hook.\r
   @param[in]  InterruptHandler  A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER that is called\r
index 35ab5a8db5139eed30cb18cb9a23ac12667fed9f..54f38788fe990cd64ef91994d4031dd62c3143b8 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   CPU Exception Handler library implementition with empty functions.\r
 \r
-  Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2012 - 2022, Intel Corporation. All rights reserved.<BR>\r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
@@ -33,31 +33,6 @@ InitializeCpuExceptionHandlers (
   return EFI_SUCCESS;\r
 }\r
 \r
-/**\r
-  Initializes all CPU interrupt/exceptions entries and provides the default interrupt/exception handlers.\r
-\r
-  Caller should try to get an array of interrupt and/or exception vectors that are in use and need to\r
-  persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification.\r
-  If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL.\r
-  If VectorInfo is not NULL, the exception vectors will be initialized per vector attribute accordingly.\r
-\r
-  @param[in]  VectorInfo    Pointer to reserved vector list.\r
-\r
-  @retval EFI_SUCCESS           All CPU interrupt/exception entries have been successfully initialized\r
-                                with default interrupt/exception handlers.\r
-  @retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL.\r
-  @retval EFI_UNSUPPORTED       This function is not supported.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-InitializeCpuInterruptHandlers (\r
-  IN EFI_VECTOR_HANDOFF_INFO  *VectorInfo OPTIONAL\r
-  )\r
-{\r
-  return EFI_SUCCESS;\r
-}\r
-\r
 /**\r
   Registers a function to be called from the processor interrupt handler.\r
 \r
@@ -65,8 +40,8 @@ InitializeCpuInterruptHandlers (
   interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the\r
   handler for the processor interrupt or exception type specified by InterruptType is uninstalled.\r
   The installed handler is called once for each processor interrupt or exception.\r
-  NOTE: This function should be invoked after InitializeCpuExceptionHandlers() or\r
-  InitializeCpuInterruptHandlers() invoked, otherwise EFI_UNSUPPORTED returned.\r
+  NOTE: This function should be invoked after InitializeCpuExceptionHandlers() is invoked,\r
+  otherwise EFI_UNSUPPORTED returned.\r
 \r
   @param[in]  InterruptType     Defines which interrupt or exception to hook.\r
   @param[in]  InterruptHandler  A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER that is called\r
index 00f3cb09572cfcb2308d0fef50ab269b74fe90cb..a6a91507f6066fbce11911530b083abe9904a658 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   CPU DXE Module to produce CPU ARCH Protocol.\r
 \r
-  Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2008 - 2022, Intel Corporation. All rights reserved.<BR>\r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
@@ -10,6 +10,8 @@
 #include "CpuMp.h"\r
 #include "CpuPageTable.h"\r
 \r
+#define CPU_INTERRUPT_NUM  256\r
+\r
 //\r
 // Global Variables\r
 //\r
@@ -924,9 +926,12 @@ InitInterruptDescriptorTable (
   VOID\r
   )\r
 {\r
-  EFI_STATUS               Status;\r
-  EFI_VECTOR_HANDOFF_INFO  *VectorInfoList;\r
-  EFI_VECTOR_HANDOFF_INFO  *VectorInfo;\r
+  EFI_STATUS                Status;\r
+  EFI_VECTOR_HANDOFF_INFO   *VectorInfoList;\r
+  EFI_VECTOR_HANDOFF_INFO   *VectorInfo;\r
+  IA32_IDT_GATE_DESCRIPTOR  *IdtTable;\r
+  IA32_DESCRIPTOR           IdtDescriptor;\r
+  UINTN                     IdtEntryCount;\r
 \r
   VectorInfo = NULL;\r
   Status     = EfiGetSystemConfigurationTable (&gEfiVectorHandoffTableGuid, (VOID **)&VectorInfoList);\r
@@ -934,7 +939,25 @@ InitInterruptDescriptorTable (
     VectorInfo = VectorInfoList;\r
   }\r
 \r
-  Status = InitializeCpuInterruptHandlers (VectorInfo);\r
+  AsmReadIdtr (&IdtDescriptor);\r
+  IdtEntryCount = (IdtDescriptor.Limit + 1) / sizeof (IA32_IDT_GATE_DESCRIPTOR);\r
+  if (IdtEntryCount < CPU_INTERRUPT_NUM) {\r
+    //\r
+    // Increase Interrupt Descriptor Table and Copy the old IDT table in\r
+    //\r
+    IdtTable = AllocateZeroPool (sizeof (IA32_IDT_GATE_DESCRIPTOR) * CPU_INTERRUPT_NUM);\r
+    ASSERT (IdtTable != NULL);\r
+    CopyMem (IdtTable, (VOID *)IdtDescriptor.Base, sizeof (IA32_IDT_GATE_DESCRIPTOR) * IdtEntryCount);\r
+\r
+    //\r
+    // Load Interrupt Descriptor Table\r
+    //\r
+    IdtDescriptor.Base  = (UINTN)IdtTable;\r
+    IdtDescriptor.Limit = (UINT16)(sizeof (IA32_IDT_GATE_DESCRIPTOR) * CPU_INTERRUPT_NUM - 1);\r
+    AsmWriteIdtr (&IdtDescriptor);\r
+  }\r
+\r
+  Status = InitializeCpuExceptionHandlers (VectorInfo);\r
   ASSERT_EFI_ERROR (Status);\r
 }\r
 \r
index f139131a7c7d7b2a14503f53d16937970566b951..c7c1fe31d2e7955bfc4f709aff8fad9f44d8cf28 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   CPU exception handler library implemenation for DXE modules.\r
 \r
-  Copyright (c) 2013 - 2017, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2013 - 2022, Intel Corporation. All rights reserved.<BR>\r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
@@ -17,8 +17,8 @@ CONST UINTN  mDoFarReturnFlag = 0;
 RESERVED_VECTORS_DATA      mReservedVectorsData[CPU_INTERRUPT_NUM];\r
 EFI_CPU_INTERRUPT_HANDLER  mExternalInterruptHandlerTable[CPU_INTERRUPT_NUM];\r
 EXCEPTION_HANDLER_DATA     mExceptionHandlerData = {\r
-  0,   // To be fixed\r
-  0,   // To be fixed\r
+  CPU_INTERRUPT_NUM,\r
+  0,                     // To be fixed\r
   mReservedVectorsData,\r
   mExternalInterruptHandlerTable\r
 };\r
@@ -69,76 +69,6 @@ InitializeCpuExceptionHandlers (
   return InitializeCpuExceptionHandlersWorker (VectorInfo, &mExceptionHandlerData);\r
 }\r
 \r
-/**\r
-  Initializes all CPU interrupt/exceptions entries and provides the default interrupt/exception handlers.\r
-\r
-  Caller should try to get an array of interrupt and/or exception vectors that are in use and need to\r
-  persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification.\r
-  If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL.\r
-  If VectorInfo is not NULL, the exception vectors will be initialized per vector attribute accordingly.\r
-\r
-  @param[in]  VectorInfo    Pointer to reserved vector list.\r
-\r
-  @retval EFI_SUCCESS           All CPU interrupt/exception entries have been successfully initialized\r
-                                with default interrupt/exception handlers.\r
-  @retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL.\r
-  @retval EFI_UNSUPPORTED       This function is not supported.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-InitializeCpuInterruptHandlers (\r
-  IN EFI_VECTOR_HANDOFF_INFO  *VectorInfo OPTIONAL\r
-  )\r
-{\r
-  EFI_STATUS                      Status;\r
-  IA32_IDT_GATE_DESCRIPTOR        *IdtTable;\r
-  IA32_DESCRIPTOR                 IdtDescriptor;\r
-  UINTN                           IdtEntryCount;\r
-  EXCEPTION_HANDLER_TEMPLATE_MAP  TemplateMap;\r
-\r
-  SetMem ((VOID *)mReservedVectorsData, sizeof (RESERVED_VECTORS_DATA) * CPU_INTERRUPT_NUM, 0xff);\r
-  if (VectorInfo != NULL) {\r
-    Status = ReadAndVerifyVectorInfo (VectorInfo, mReservedVectorsData, CPU_INTERRUPT_NUM);\r
-    if (EFI_ERROR (Status)) {\r
-      return EFI_INVALID_PARAMETER;\r
-    }\r
-  }\r
-\r
-  //\r
-  // Read IDT descriptor and calculate IDT size\r
-  //\r
-  AsmReadIdtr (&IdtDescriptor);\r
-  IdtEntryCount = (IdtDescriptor.Limit + 1) / sizeof (IA32_IDT_GATE_DESCRIPTOR);\r
-  if (IdtEntryCount > CPU_INTERRUPT_NUM) {\r
-    IdtEntryCount = CPU_INTERRUPT_NUM;\r
-  }\r
-\r
-  //\r
-  // Create Interrupt Descriptor Table and Copy the old IDT table in\r
-  //\r
-  IdtTable = AllocateZeroPool (sizeof (IA32_IDT_GATE_DESCRIPTOR) * CPU_INTERRUPT_NUM);\r
-  ASSERT (IdtTable != NULL);\r
-  CopyMem (IdtTable, (VOID *)IdtDescriptor.Base, sizeof (IA32_IDT_GATE_DESCRIPTOR) * IdtEntryCount);\r
-\r
-  AsmGetTemplateAddressMap (&TemplateMap);\r
-  ASSERT (TemplateMap.ExceptionStubHeaderSize <= HOOKAFTER_STUB_SIZE);\r
-\r
-  mExceptionHandlerData.IdtEntryCount            = CPU_INTERRUPT_NUM;\r
-  InitializeSpinLock (&mExceptionHandlerData.DisplayMessageSpinLock);\r
-\r
-  UpdateIdtTable (IdtTable, &TemplateMap, &mExceptionHandlerData);\r
-\r
-  //\r
-  // Load Interrupt Descriptor Table\r
-  //\r
-  IdtDescriptor.Base  = (UINTN)IdtTable;\r
-  IdtDescriptor.Limit = (UINT16)(sizeof (IA32_IDT_GATE_DESCRIPTOR) * CPU_INTERRUPT_NUM - 1);\r
-  AsmWriteIdtr ((IA32_DESCRIPTOR *)&IdtDescriptor);\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
 /**\r
   Registers a function to be called from the processor interrupt handler.\r
 \r
@@ -146,8 +76,8 @@ InitializeCpuInterruptHandlers (
   interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the\r
   handler for the processor interrupt or exception type specified by InterruptType is uninstalled.\r
   The installed handler is called once for each processor interrupt or exception.\r
-  NOTE: This function should be invoked after InitializeCpuExceptionHandlers() or\r
-  InitializeCpuInterruptHandlers() invoked, otherwise EFI_UNSUPPORTED returned.\r
+  NOTE: This function should be invoked after InitializeCpuExceptionHandlers() is invoked,\r
+  otherwise EFI_UNSUPPORTED returned.\r
 \r
   @param[in]  InterruptType     Defines which interrupt or exception to hook.\r
   @param[in]  InterruptHandler  A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER that is called\r
index 687fc4177fe131163e0a214259c4a3ab0997ffbf..1ae611c75e69fd71202a613217922c114cd83a99 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   CPU exception handler library implementation for PEIM module.\r
 \r
-Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2016 - 2022, Intel Corporation. All rights reserved.<BR>\r
 SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
@@ -133,6 +133,7 @@ InitializeCpuExceptionHandlers (
 \r
   ExceptionHandlerData = AllocatePool (sizeof (EXCEPTION_HANDLER_DATA));\r
   ASSERT (ExceptionHandlerData != NULL);\r
+  ExceptionHandlerData->IdtEntryCount            = CPU_EXCEPTION_NUM;\r
   ExceptionHandlerData->ReservedVectors          = ReservedVectors;\r
   ExceptionHandlerData->ExternalInterruptHandler = NULL;\r
   InitializeSpinLock (&ExceptionHandlerData->DisplayMessageSpinLock);\r
@@ -148,64 +149,6 @@ InitializeCpuExceptionHandlers (
   return EFI_SUCCESS;\r
 }\r
 \r
-/**\r
-  Initializes all CPU interrupt/exceptions entries and provides the default interrupt/exception handlers.\r
-\r
-  Caller should try to get an array of interrupt and/or exception vectors that are in use and need to\r
-  persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification.\r
-  If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL.\r
-  If VectorInfo is not NULL, the exception vectors will be initialized per vector attribute accordingly.\r
-\r
-  @param[in]  VectorInfo    Pointer to reserved vector list.\r
-\r
-  @retval EFI_SUCCESS           All CPU interrupt/exception entries have been successfully initialized\r
-                                with default interrupt/exception handlers.\r
-  @retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL.\r
-  @retval EFI_UNSUPPORTED       This function is not supported.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-InitializeCpuInterruptHandlers (\r
-  IN EFI_VECTOR_HANDOFF_INFO  *VectorInfo OPTIONAL\r
-  )\r
-{\r
-  return EFI_UNSUPPORTED;\r
-}\r
-\r
-/**\r
-  Registers a function to be called from the processor interrupt handler.\r
-\r
-  This function registers and enables the handler specified by InterruptHandler for a processor\r
-  interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the\r
-  handler for the processor interrupt or exception type specified by InterruptType is uninstalled.\r
-  The installed handler is called once for each processor interrupt or exception.\r
-  NOTE: This function should be invoked after InitializeCpuExceptionHandlers() or\r
-  InitializeCpuInterruptHandlers() invoked, otherwise EFI_UNSUPPORTED returned.\r
-\r
-  @param[in]  InterruptType     Defines which interrupt or exception to hook.\r
-  @param[in]  InterruptHandler  A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER that is called\r
-                                when a processor interrupt occurs. If this parameter is NULL, then the handler\r
-                                will be uninstalled.\r
-\r
-  @retval EFI_SUCCESS           The handler for the processor interrupt was successfully installed or uninstalled.\r
-  @retval EFI_ALREADY_STARTED   InterruptHandler is not NULL, and a handler for InterruptType was\r
-                                previously installed.\r
-  @retval EFI_INVALID_PARAMETER InterruptHandler is NULL, and a handler for InterruptType was not\r
-                                previously installed.\r
-  @retval EFI_UNSUPPORTED       The interrupt specified by InterruptType is not supported,\r
-                                or this function is not supported.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-RegisterCpuInterruptHandler (\r
-  IN EFI_EXCEPTION_TYPE         InterruptType,\r
-  IN EFI_CPU_INTERRUPT_HANDLER  InterruptHandler\r
-  )\r
-{\r
-  return EFI_UNSUPPORTED;\r
-}\r
-\r
 /**\r
   Initializes all CPU exceptions entries with optional extra initializations.\r
 \r
index f47a80dcab8f8226a130446a9aa9fe7f8a3bf689..a7d0897ef1f903c85c66eae74feac0f5325e2825 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   CPU Exception Library provides PEI/DXE/SMM CPU common exception handler.\r
 \r
-Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2012 - 2022, Intel Corporation. All rights reserved.<BR>\r
 SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
@@ -261,31 +261,26 @@ InitializeCpuExceptionHandlersWorker (
   RESERVED_VECTORS_DATA           *ReservedVectors;\r
 \r
   ReservedVectors = ExceptionHandlerData->ReservedVectors;\r
-  SetMem ((VOID *)ReservedVectors, sizeof (RESERVED_VECTORS_DATA) * CPU_EXCEPTION_NUM, 0xff);\r
+  SetMem ((VOID *)ReservedVectors, sizeof (RESERVED_VECTORS_DATA) * ExceptionHandlerData->IdtEntryCount, 0xff);\r
   if (VectorInfo != NULL) {\r
-    Status = ReadAndVerifyVectorInfo (VectorInfo, ReservedVectors, CPU_EXCEPTION_NUM);\r
+    Status = ReadAndVerifyVectorInfo (VectorInfo, ReservedVectors, ExceptionHandlerData->IdtEntryCount);\r
     if (EFI_ERROR (Status)) {\r
       return EFI_INVALID_PARAMETER;\r
     }\r
   }\r
 \r
   //\r
-  // Read IDT descriptor and calculate IDT size\r
+  // Setup the exception handlers according to IDT size, but no more than\r
+  //   ExceptionHandlerData->IdtEntryCount (32 in PEI and SMM, 256 in DXE) handlers.\r
   //\r
   AsmReadIdtr (&IdtDescriptor);\r
-  IdtEntryCount = (IdtDescriptor.Limit + 1) / sizeof (IA32_IDT_GATE_DESCRIPTOR);\r
-  if (IdtEntryCount > CPU_EXCEPTION_NUM) {\r
-    //\r
-    // CPU exception library only setup CPU_EXCEPTION_NUM exception handler at most\r
-    //\r
-    IdtEntryCount = CPU_EXCEPTION_NUM;\r
-  }\r
+  IdtEntryCount                       = (IdtDescriptor.Limit + 1) / sizeof (IA32_IDT_GATE_DESCRIPTOR);\r
+  ExceptionHandlerData->IdtEntryCount = MIN (IdtEntryCount, ExceptionHandlerData->IdtEntryCount);\r
 \r
   IdtTable = (IA32_IDT_GATE_DESCRIPTOR *)IdtDescriptor.Base;\r
   AsmGetTemplateAddressMap (&TemplateMap);\r
   ASSERT (TemplateMap.ExceptionStubHeaderSize <= HOOKAFTER_STUB_SIZE);\r
 \r
-  ExceptionHandlerData->IdtEntryCount = IdtEntryCount;\r
   UpdateIdtTable (IdtTable, &TemplateMap, ExceptionHandlerData);\r
 \r
   return EFI_SUCCESS;\r
index 6e5216380da83acf8507ea6423bb105fb82a28a7..e894ead612d28a651b6df4d23a9057918c6a482f 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   CPU exception handler library implemenation for SEC/PEIM modules.\r
 \r
-Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2012 - 2022, Intel Corporation. All rights reserved.<BR>\r
 SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
@@ -166,31 +166,6 @@ InitializeCpuExceptionHandlers (
   return EFI_SUCCESS;\r
 }\r
 \r
-/**\r
-  Initializes all CPU interrupt/exceptions entries and provides the default interrupt/exception handlers.\r
-\r
-  Caller should try to get an array of interrupt and/or exception vectors that are in use and need to\r
-  persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification.\r
-  If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL.\r
-  If VectorInfo is not NULL, the exception vectors will be initialized per vector attribute accordingly.\r
-\r
-  @param[in]  VectorInfo    Pointer to reserved vector list.\r
-\r
-  @retval EFI_SUCCESS           All CPU interrupt/exception entries have been successfully initialized\r
-                                with default interrupt/exception handlers.\r
-  @retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL.\r
-  @retval EFI_UNSUPPORTED       This function is not supported.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-InitializeCpuInterruptHandlers (\r
-  IN EFI_VECTOR_HANDOFF_INFO  *VectorInfo OPTIONAL\r
-  )\r
-{\r
-  return EFI_UNSUPPORTED;\r
-}\r
-\r
 /**\r
   Registers a function to be called from the processor interrupt handler.\r
 \r
@@ -198,8 +173,8 @@ InitializeCpuInterruptHandlers (
   interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the\r
   handler for the processor interrupt or exception type specified by InterruptType is uninstalled.\r
   The installed handler is called once for each processor interrupt or exception.\r
-  NOTE: This function should be invoked after InitializeCpuExceptionHandlers() or\r
-  InitializeCpuInterruptHandlers() invoked, otherwise EFI_UNSUPPORTED returned.\r
+  NOTE: This function should be invoked after InitializeCpuExceptionHandlers() is invoked,\r
+  otherwise EFI_UNSUPPORTED returned.\r
 \r
   @param[in]  InterruptType     Defines which interrupt or exception to hook.\r
   @param[in]  InterruptHandler  A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER that is called\r
index 9f0af4120a7bf034d7a08fcabcbdd27fc69a6481..ec643556c7c720bfad351f89fd77c35e29c36a08 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   CPU exception handler library implementation for SMM modules.\r
 \r
-  Copyright (c) 2013 - 2017, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2013 - 2022, Intel Corporation. All rights reserved.<BR>\r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
@@ -14,8 +14,8 @@ CONST UINTN  mDoFarReturnFlag = 1;
 RESERVED_VECTORS_DATA      mReservedVectorsData[CPU_EXCEPTION_NUM];\r
 EFI_CPU_INTERRUPT_HANDLER  mExternalInterruptHandlerTable[CPU_EXCEPTION_NUM];\r
 EXCEPTION_HANDLER_DATA     mExceptionHandlerData = {\r
-  0,   // To be fixed\r
-  0,   // To be fixed\r
+  CPU_EXCEPTION_NUM,\r
+  0,                     // To be fixed\r
   mReservedVectorsData,\r
   mExternalInterruptHandlerTable\r
 };\r
@@ -62,31 +62,6 @@ InitializeCpuExceptionHandlers (
   return InitializeCpuExceptionHandlersWorker (VectorInfo, &mExceptionHandlerData);\r
 }\r
 \r
-/**\r
-  Initializes all CPU interrupt/exceptions entries and provides the default interrupt/exception handlers.\r
-\r
-  Caller should try to get an array of interrupt and/or exception vectors that are in use and need to\r
-  persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification.\r
-  If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL.\r
-  If VectorInfo is not NULL, the exception vectors will be initialized per vector attribute accordingly.\r
-\r
-  @param[in]  VectorInfo    Pointer to reserved vector list.\r
-\r
-  @retval EFI_SUCCESS           All CPU interrupt/exception entries have been successfully initialized\r
-                                with default interrupt/exception handlers.\r
-  @retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL.\r
-  @retval EFI_UNSUPPORTED       This function is not supported.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-InitializeCpuInterruptHandlers (\r
-  IN EFI_VECTOR_HANDOFF_INFO  *VectorInfo OPTIONAL\r
-  )\r
-{\r
-  return EFI_UNSUPPORTED;\r
-}\r
-\r
 /**\r
   Registers a function to be called from the processor interrupt handler.\r
 \r
@@ -94,8 +69,8 @@ InitializeCpuInterruptHandlers (
   interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the\r
   handler for the processor interrupt or exception type specified by InterruptType is uninstalled.\r
   The installed handler is called once for each processor interrupt or exception.\r
-  NOTE: This function should be invoked after InitializeCpuExceptionHandlers() or\r
-  InitializeCpuInterruptHandlers() invoked, otherwise EFI_UNSUPPORTED returned.\r
+  NOTE: This function should be invoked after InitializeCpuExceptionHandlers() is invoked,\r
+  otherwise EFI_UNSUPPORTED returned.\r
 \r
   @param[in]  InterruptType     Defines which interrupt or exception to hook.\r
   @param[in]  InterruptHandler  A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER that is called\r