UefiCpuPkg/ExceptionLib: Update InitializeCpuExceptionHandlersWorker

Add parameter CpuExceptionData for InitializeCpuExceptionHandlersWorker().

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>
This commit is contained in:
Jeff Fan 2016-05-24 21:00:02 +08:00
parent 2c5873fede
commit ab95e54dc4
4 changed files with 24 additions and 9 deletions

View File

@ -135,6 +135,7 @@ DumpCpuContent (
Internal worker function to initialize exception handler. Internal worker function to initialize exception handler.
@param[in] VectorInfo Pointer to reserved vector list. @param[in] VectorInfo Pointer to reserved vector list.
@param[in, out] ExceptionHandlerData Pointer to exception handler data.
@retval EFI_SUCCESS CPU Exception Entries have been successfully initialized @retval EFI_SUCCESS CPU Exception Entries have been successfully initialized
with default exception handlers. with default exception handlers.
@ -144,7 +145,8 @@ DumpCpuContent (
**/ **/
EFI_STATUS EFI_STATUS
InitializeCpuExceptionHandlersWorker ( InitializeCpuExceptionHandlersWorker (
IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL,
IN OUT EXCEPTION_HANDLER_DATA *ExceptionHandlerData
); );
/** /**

View File

@ -21,6 +21,8 @@ CONST UINTN mDoFarReturnFlag = 0;
extern SPIN_LOCK mDisplayMessageSpinLock; extern SPIN_LOCK mDisplayMessageSpinLock;
extern EFI_CPU_INTERRUPT_HANDLER *mExternalInterruptHandler; extern EFI_CPU_INTERRUPT_HANDLER *mExternalInterruptHandler;
extern RESERVED_VECTORS_DATA mReservedVectorsData[CPU_EXCEPTION_NUM];
extern EFI_CPU_INTERRUPT_HANDLER mExternalInterruptHandlerTable[CPU_EXCEPTION_NUM];
EXCEPTION_HANDLER_DATA mExceptionHandlerData; EXCEPTION_HANDLER_DATA mExceptionHandlerData;
/** /**
@ -45,7 +47,10 @@ InitializeCpuExceptionHandlers (
IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL
) )
{ {
return InitializeCpuExceptionHandlersWorker (VectorInfo); mExceptionHandlerData.ReservedVectors = mReservedVectorsData;
mExceptionHandlerData.ExternalInterruptHandler = mExternalInterruptHandlerTable;
InitializeSpinLock (&mExceptionHandlerData.DisplayMessageSpinLock);
return InitializeCpuExceptionHandlersWorker (VectorInfo, &mExceptionHandlerData);
} }
/** /**

View File

@ -202,6 +202,7 @@ UpdateIdtTable (
Internal worker function to initialize exception handler. Internal worker function to initialize exception handler.
@param[in] VectorInfo Pointer to reserved vector list. @param[in] VectorInfo Pointer to reserved vector list.
@param[in, out] ExceptionHandlerData Pointer to exception handler data.
@retval EFI_SUCCESS CPU Exception Entries have been successfully initialized @retval EFI_SUCCESS CPU Exception Entries have been successfully initialized
with default exception handlers. with default exception handlers.
@ -211,7 +212,8 @@ UpdateIdtTable (
**/ **/
EFI_STATUS EFI_STATUS
InitializeCpuExceptionHandlersWorker ( InitializeCpuExceptionHandlersWorker (
IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL,
IN OUT EXCEPTION_HANDLER_DATA *ExceptionHandlerData
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -219,11 +221,12 @@ InitializeCpuExceptionHandlersWorker (
UINTN IdtEntryCount; UINTN IdtEntryCount;
EXCEPTION_HANDLER_TEMPLATE_MAP TemplateMap; EXCEPTION_HANDLER_TEMPLATE_MAP TemplateMap;
IA32_IDT_GATE_DESCRIPTOR *IdtTable; IA32_IDT_GATE_DESCRIPTOR *IdtTable;
RESERVED_VECTORS_DATA *ReservedVectors;
mReservedVectors = mReservedVectorsData; ReservedVectors = ExceptionHandlerData->ReservedVectors;
SetMem ((VOID *) mReservedVectors, sizeof (RESERVED_VECTORS_DATA) * CPU_EXCEPTION_NUM, 0xff); SetMem ((VOID *) ReservedVectors, sizeof (RESERVED_VECTORS_DATA) * CPU_EXCEPTION_NUM, 0xff);
if (VectorInfo != NULL) { if (VectorInfo != NULL) {
Status = ReadAndVerifyVectorInfo (VectorInfo, mReservedVectors, CPU_EXCEPTION_NUM); Status = ReadAndVerifyVectorInfo (VectorInfo, ReservedVectors, CPU_EXCEPTION_NUM);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }

View File

@ -17,6 +17,8 @@
CONST UINTN mDoFarReturnFlag = 1; CONST UINTN mDoFarReturnFlag = 1;
extern RESERVED_VECTORS_DATA mReservedVectorsData[CPU_EXCEPTION_NUM];
extern EFI_CPU_INTERRUPT_HANDLER mExternalInterruptHandlerTable[CPU_EXCEPTION_NUM];
EXCEPTION_HANDLER_DATA mExceptionHandlerData; EXCEPTION_HANDLER_DATA mExceptionHandlerData;
/** /**
Initializes all CPU exceptions entries and provides the default exception handlers. Initializes all CPU exceptions entries and provides the default exception handlers.
@ -40,7 +42,10 @@ InitializeCpuExceptionHandlers (
IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL
) )
{ {
return InitializeCpuExceptionHandlersWorker (VectorInfo); mExceptionHandlerData.ReservedVectors = mReservedVectorsData;
mExceptionHandlerData.ExternalInterruptHandler = mExternalInterruptHandlerTable;
InitializeSpinLock (&mExceptionHandlerData.DisplayMessageSpinLock);
return InitializeCpuExceptionHandlersWorker (VectorInfo, &mExceptionHandlerData);
} }
/** /**