summaryrefslogtreecommitdiffstats
path: root/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuException.c
diff options
context:
space:
mode:
Diffstat (limited to 'UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuException.c')
-rw-r--r--UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuException.c51
1 files changed, 26 insertions, 25 deletions
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuException.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuException.c
index d256643435..687fc4177f 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuException.c
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuException.c
@@ -13,11 +13,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Library/MemoryAllocationLib.h>
#include <Library/PcdLib.h>
-CONST UINTN mDoFarReturnFlag = 0;
+CONST UINTN mDoFarReturnFlag = 0;
typedef struct {
- UINT8 ExceptionStubHeader[HOOKAFTER_STUB_SIZE];
- EXCEPTION_HANDLER_DATA *ExceptionHandlerData;
+ UINT8 ExceptionStubHeader[HOOKAFTER_STUB_SIZE];
+ EXCEPTION_HANDLER_DATA *ExceptionHandlerData;
} EXCEPTION0_STUB_HEADER;
/**
@@ -34,9 +34,9 @@ GetExceptionHandlerData (
VOID
)
{
- IA32_DESCRIPTOR IdtDescriptor;
- IA32_IDT_GATE_DESCRIPTOR *IdtTable;
- EXCEPTION0_STUB_HEADER *Exception0StubHeader;
+ IA32_DESCRIPTOR IdtDescriptor;
+ IA32_IDT_GATE_DESCRIPTOR *IdtTable;
+ EXCEPTION0_STUB_HEADER *Exception0StubHeader;
AsmReadIdtr (&IdtDescriptor);
IdtTable = (IA32_IDT_GATE_DESCRIPTOR *)IdtDescriptor.Base;
@@ -56,12 +56,13 @@ GetExceptionHandlerData (
**/
VOID
SetExceptionHandlerData (
- IN EXCEPTION_HANDLER_DATA *ExceptionHandlerData
+ IN EXCEPTION_HANDLER_DATA *ExceptionHandlerData
)
{
- EXCEPTION0_STUB_HEADER *Exception0StubHeader;
- IA32_DESCRIPTOR IdtDescriptor;
- IA32_IDT_GATE_DESCRIPTOR *IdtTable;
+ EXCEPTION0_STUB_HEADER *Exception0StubHeader;
+ IA32_DESCRIPTOR IdtDescriptor;
+ IA32_IDT_GATE_DESCRIPTOR *IdtTable;
+
//
// Duplicate the exception #0 stub header in pool and cache the ExceptionHandlerData just after the stub header.
// So AP can get the ExceptionHandlerData by reading the IDT[0].
@@ -89,8 +90,8 @@ SetExceptionHandlerData (
VOID
EFIAPI
CommonExceptionHandler (
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN EFI_SYSTEM_CONTEXT SystemContext
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN EFI_SYSTEM_CONTEXT SystemContext
)
{
EXCEPTION_HANDLER_DATA *ExceptionHandlerData;
@@ -120,12 +121,12 @@ CommonExceptionHandler (
EFI_STATUS
EFIAPI
InitializeCpuExceptionHandlers (
- IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL
+ IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL
)
{
- EFI_STATUS Status;
- EXCEPTION_HANDLER_DATA *ExceptionHandlerData;
- RESERVED_VECTORS_DATA *ReservedVectors;
+ EFI_STATUS Status;
+ EXCEPTION_HANDLER_DATA *ExceptionHandlerData;
+ RESERVED_VECTORS_DATA *ReservedVectors;
ReservedVectors = AllocatePool (sizeof (RESERVED_VECTORS_DATA) * CPU_EXCEPTION_NUM);
ASSERT (ReservedVectors != NULL);
@@ -166,7 +167,7 @@ InitializeCpuExceptionHandlers (
EFI_STATUS
EFIAPI
InitializeCpuInterruptHandlers (
- IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL
+ IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL
)
{
return EFI_UNSUPPORTED;
@@ -198,8 +199,8 @@ InitializeCpuInterruptHandlers (
EFI_STATUS
EFIAPI
RegisterCpuInterruptHandler (
- IN EFI_EXCEPTION_TYPE InterruptType,
- IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
+ IN EFI_EXCEPTION_TYPE InterruptType,
+ IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
)
{
return EFI_UNSUPPORTED;
@@ -230,11 +231,11 @@ RegisterCpuInterruptHandler (
EFI_STATUS
EFIAPI
InitializeCpuExceptionHandlersEx (
- IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL,
- IN CPU_EXCEPTION_INIT_DATA *InitData OPTIONAL
+ IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL,
+ IN CPU_EXCEPTION_INIT_DATA *InitData OPTIONAL
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
//
// To avoid repeat initialization of default handlers, the caller should pass
@@ -243,7 +244,7 @@ InitializeCpuExceptionHandlersEx (
// version instead; or this method must be implemented as a simple wrapper of
// non-ex version of it, if this version has to be called.
//
- if (InitData == NULL || InitData->Ia32.InitDefaultHandlers) {
+ if ((InitData == NULL) || InitData->Ia32.InitDefaultHandlers) {
Status = InitializeCpuExceptionHandlers (VectorInfo);
} else {
Status = EFI_SUCCESS;
@@ -253,10 +254,10 @@ InitializeCpuExceptionHandlersEx (
//
// Initializing stack switch is only necessary for Stack Guard functionality.
//
- if (PcdGetBool (PcdCpuStackGuard) && InitData != NULL) {
+ if (PcdGetBool (PcdCpuStackGuard) && (InitData != NULL)) {
Status = ArchSetupExceptionStack (InitData);
}
}
- return Status;
+ return Status;
}