From ab95e54dc4ec949fd13e8bdda1c7423469e08c3d Mon Sep 17 00:00:00 2001 From: Jeff Fan Date: Tue, 24 May 2016 21:00:02 +0800 Subject: [PATCH] UefiCpuPkg/ExceptionLib: Update InitializeCpuExceptionHandlersWorker Add parameter CpuExceptionData for InitializeCpuExceptionHandlersWorker(). Cc: Michael Kinney Cc: Jiewen Yao Cc: Feng Tian Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan Reviewed-by: Feng Tian --- .../CpuExceptionHandlerLib/CpuExceptionCommon.h | 6 ++++-- .../Library/CpuExceptionHandlerLib/DxeException.c | 7 ++++++- .../CpuExceptionHandlerLib/PeiDxeSmmCpuException.c | 13 ++++++++----- .../Library/CpuExceptionHandlerLib/SmmException.c | 7 ++++++- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h b/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h index 0757aef7b7..812469babe 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h @@ -134,7 +134,8 @@ DumpCpuContent ( /** 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 with default exception handlers. @@ -144,7 +145,8 @@ DumpCpuContent ( **/ EFI_STATUS InitializeCpuExceptionHandlersWorker ( - IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL + IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL, + IN OUT EXCEPTION_HANDLER_DATA *ExceptionHandlerData ); /** diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c index 6d163367ab..92de04ce08 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c @@ -21,6 +21,8 @@ CONST UINTN mDoFarReturnFlag = 0; extern SPIN_LOCK mDisplayMessageSpinLock; 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; /** @@ -45,7 +47,10 @@ InitializeCpuExceptionHandlers ( IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL ) { - return InitializeCpuExceptionHandlersWorker (VectorInfo); + mExceptionHandlerData.ReservedVectors = mReservedVectorsData; + mExceptionHandlerData.ExternalInterruptHandler = mExternalInterruptHandlerTable; + InitializeSpinLock (&mExceptionHandlerData.DisplayMessageSpinLock); + return InitializeCpuExceptionHandlersWorker (VectorInfo, &mExceptionHandlerData); } /** diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c index cb180bd28c..0b12b6d84f 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c @@ -201,7 +201,8 @@ UpdateIdtTable ( /** 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 with default exception handlers. @@ -211,7 +212,8 @@ UpdateIdtTable ( **/ EFI_STATUS InitializeCpuExceptionHandlersWorker ( - IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL + IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL, + IN OUT EXCEPTION_HANDLER_DATA *ExceptionHandlerData ) { EFI_STATUS Status; @@ -219,11 +221,12 @@ InitializeCpuExceptionHandlersWorker ( UINTN IdtEntryCount; EXCEPTION_HANDLER_TEMPLATE_MAP TemplateMap; IA32_IDT_GATE_DESCRIPTOR *IdtTable; + RESERVED_VECTORS_DATA *ReservedVectors; - mReservedVectors = mReservedVectorsData; - SetMem ((VOID *) mReservedVectors, sizeof (RESERVED_VECTORS_DATA) * CPU_EXCEPTION_NUM, 0xff); + ReservedVectors = ExceptionHandlerData->ReservedVectors; + SetMem ((VOID *) ReservedVectors, sizeof (RESERVED_VECTORS_DATA) * CPU_EXCEPTION_NUM, 0xff); if (VectorInfo != NULL) { - Status = ReadAndVerifyVectorInfo (VectorInfo, mReservedVectors, CPU_EXCEPTION_NUM); + Status = ReadAndVerifyVectorInfo (VectorInfo, ReservedVectors, CPU_EXCEPTION_NUM); if (EFI_ERROR (Status)) { return EFI_INVALID_PARAMETER; } diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmException.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmException.c index 3f9d001fd5..b88305d73c 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmException.c +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmException.c @@ -17,6 +17,8 @@ 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; /** Initializes all CPU exceptions entries and provides the default exception handlers. @@ -40,7 +42,10 @@ InitializeCpuExceptionHandlers ( IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL ) { - return InitializeCpuExceptionHandlersWorker (VectorInfo); + mExceptionHandlerData.ReservedVectors = mReservedVectorsData; + mExceptionHandlerData.ExternalInterruptHandler = mExternalInterruptHandlerTable; + InitializeSpinLock (&mExceptionHandlerData.DisplayMessageSpinLock); + return InitializeCpuExceptionHandlersWorker (VectorInfo, &mExceptionHandlerData); } /** -- 2.39.2