]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiCpuPkg/ExceptionLib: Update RegisterCpuInterruptHandlerWorker()
authorJeff Fan <jeff.fan@intel.com>
Tue, 24 May 2016 13:25:17 +0000 (21:25 +0800)
committerJeff Fan <jeff.fan@intel.com>
Wed, 1 Jun 2016 07:31:48 +0000 (15:31 +0800)
Add parameter CpuExceptionData for RegisterCpuInterruptHandlerWorker().

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h
UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c
UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c
UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmException.c

index 99be61f860b4931357787dc28d2c4bbfcacfef8e..f2c44f013f5509d54d38c2cf56ea875eb39aff5e 100644 (file)
@@ -152,10 +152,11 @@ InitializeCpuExceptionHandlersWorker (
 /**\r
   Registers a function to be called from the processor interrupt handler.\r
 \r
 /**\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
 \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
@@ -168,7 +169,8 @@ InitializeCpuExceptionHandlersWorker (
 EFI_STATUS\r
 RegisterCpuInterruptHandlerWorker (\r
   IN EFI_EXCEPTION_TYPE            InterruptType,\r
 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
 /**\r
   );\r
 \r
 /**\r
index cffb13aea98423d9b080c0a8955b39fd0fc2ea06..5c4ee2a1ed558a5e7e835b672a0d32ce51f52dcd 100644 (file)
@@ -179,5 +179,5 @@ RegisterCpuInterruptHandler (
   IN EFI_CPU_INTERRUPT_HANDLER     InterruptHandler\r
   )\r
 {\r
   IN EFI_CPU_INTERRUPT_HANDLER     InterruptHandler\r
   )\r
 {\r
-  return RegisterCpuInterruptHandlerWorker (InterruptType, InterruptHandler);\r
+  return RegisterCpuInterruptHandlerWorker (InterruptType, InterruptHandler, &mExceptionHandlerData);\r
 }\r
 }\r
index 4a3aad896d2464f833f1a8a492759e17bb501223..c7382804134ff7d5c76751616968c569b93e323c 100644 (file)
@@ -262,10 +262,11 @@ InitializeCpuExceptionHandlersWorker (
 /**\r
   Registers a function to be called from the processor interrupt handler.\r
 \r
 /**\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
 \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
 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
   )\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
     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
     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
     return EFI_ALREADY_STARTED;\r
   }\r
 \r
-  mExternalInterruptHandler[InterruptType] = InterruptHandler;\r
+  ExternalInterruptHandler[InterruptType] = InterruptHandler;\r
   return EFI_SUCCESS;\r
 }\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
index b88305d73ca50cbee7851276b36e43be7ddb737b..c3af4d48db05c3ab2616bd5b477edf6f226a1e9a 100644 (file)
@@ -103,5 +103,5 @@ RegisterCpuInterruptHandler (
   IN EFI_CPU_INTERRUPT_HANDLER     InterruptHandler\r
   )\r
 {\r
   IN EFI_CPU_INTERRUPT_HANDLER     InterruptHandler\r
   )\r
 {\r
-  return RegisterCpuInterruptHandlerWorker (InterruptType, InterruptHandler);\r
+  return RegisterCpuInterruptHandlerWorker (InterruptType, InterruptHandler, &mExceptionHandlerData);\r
 }
\ No newline at end of file
 }
\ No newline at end of file