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>
/**\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
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
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
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
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
- 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
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