]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c
UefiCpuPkg/ExceptionLib: Update RegisterCpuInterruptHandlerWorker()
[mirror_edk2.git] / UefiCpuPkg / Library / CpuExceptionHandlerLib / PeiDxeSmmCpuException.c
index 4a3aad896d2464f833f1a8a492759e17bb501223..c7382804134ff7d5c76751616968c569b93e323c 100644 (file)
@@ -262,10 +262,11 @@ InitializeCpuExceptionHandlersWorker (
 /**\r
   Registers a function to be called from the processor interrupt handler.\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
+  @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
+  @param[in] ExceptionHandlerData  Pointer to exception handler data.\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
@@ -278,23 +279,32 @@ InitializeCpuExceptionHandlersWorker (
 EFI_STATUS\r
 RegisterCpuInterruptHandlerWorker (\r
   IN EFI_EXCEPTION_TYPE            InterruptType,\r
-  IN EFI_CPU_INTERRUPT_HANDLER     InterruptHandler\r
+  IN EFI_CPU_INTERRUPT_HANDLER     InterruptHandler,\r
+  IN EXCEPTION_HANDLER_DATA        *ExceptionHandlerData\r
   )\r
 {\r
-  if (InterruptType < 0 || InterruptType >= (EFI_EXCEPTION_TYPE)mEnabledInterruptNum ||\r
-      mReservedVectors[InterruptType].Attribute == EFI_VECTOR_HANDOFF_DO_NOT_HOOK) {\r
+  UINTN                          EnabledInterruptNum;\r
+  RESERVED_VECTORS_DATA          *ReservedVectors;\r
+  EFI_CPU_INTERRUPT_HANDLER      *ExternalInterruptHandler;\r
+\r
+  EnabledInterruptNum      = ExceptionHandlerData->IdtEntryCount;\r
+  ReservedVectors          = ExceptionHandlerData->ReservedVectors;\r
+  ExternalInterruptHandler = ExceptionHandlerData->ExternalInterruptHandler;\r
+\r
+  if (InterruptType < 0 || InterruptType >= (EFI_EXCEPTION_TYPE)EnabledInterruptNum ||\r
+      ReservedVectors[InterruptType].Attribute == EFI_VECTOR_HANDOFF_DO_NOT_HOOK) {\r
     return EFI_UNSUPPORTED;\r
   }\r
 \r
-  if (InterruptHandler == NULL && mExternalInterruptHandler[InterruptType] == NULL) {\r
+  if (InterruptHandler == NULL && ExternalInterruptHandler[InterruptType] == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  if (InterruptHandler != NULL && mExternalInterruptHandler[InterruptType] != NULL) {\r
+  if (InterruptHandler != NULL && ExternalInterruptHandler[InterruptType] != NULL) {\r
     return EFI_ALREADY_STARTED;\r
   }\r
 \r
-  mExternalInterruptHandler[InterruptType] = InterruptHandler;\r
+  ExternalInterruptHandler[InterruptType] = InterruptHandler;\r
   return EFI_SUCCESS;\r
 }\r
 \r