From dd563742505cb79a76b6e7db39e1b6b13d7640e0 Mon Sep 17 00:00:00 2001 From: Jeff Fan Date: Fri, 7 Apr 2017 10:00:59 +0800 Subject: [PATCH] UefiCpuPkg/CpuExceptionHandlerLib: Trim white space at end of line Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan --- .../CpuExceptionCommon.c | 8 +-- .../CpuExceptionCommon.h | 20 ++++---- .../DxeCpuExceptionHandlerLib.inf | 6 +-- .../DxeCpuExceptionHandlerLib.uni | 2 +- .../CpuExceptionHandlerLib/DxeException.c | 26 +++++----- .../Ia32/ArchExceptionHandler.c | 2 +- .../Ia32/ExceptionHandlerAsm.S | 50 +++++++++---------- .../Ia32/ExceptionHandlerAsm.asm | 44 ++++++++-------- .../CpuExceptionHandlerLib/PeiCpuException.c | 28 +++++------ .../PeiCpuExceptionHandlerLib.inf | 4 +- .../PeiCpuExceptionHandlerLib.uni | 2 +- .../PeiDxeSmmCpuException.c | 10 ++-- .../SecPeiCpuException.c | 32 ++++++------ .../SecPeiCpuExceptionHandlerLib.inf | 4 +- .../SecPeiCpuExceptionHandlerLib.uni | 2 +- .../SmmCpuExceptionHandlerLib.inf | 4 +- .../SmmCpuExceptionHandlerLib.uni | 2 +- .../CpuExceptionHandlerLib/SmmException.c | 26 +++++----- .../X64/ArchExceptionHandler.c | 6 +-- .../X64/ExceptionHandlerAsm.S | 18 +++---- .../X64/ExceptionHandlerAsm.asm | 8 +-- 21 files changed, 152 insertions(+), 152 deletions(-) diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.c index 05372083b3..e9f679eb5d 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.c +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.c @@ -1,4 +1,4 @@ -/** @file + /** @file CPU Exception Handler Library common functions. Copyright (c) 2012 - 2016, Intel Corporation. All rights reserved.
@@ -106,11 +106,11 @@ InternalPrintMessage ( /** Find and display image base address and return image base and its entry point. - + @param CurrentEip Current instruction pointer. - + **/ -VOID +VOID DumpModuleImageInfo ( IN UINTN CurrentEip ) diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h b/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h index e66a5df864..740a58828b 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h @@ -108,7 +108,7 @@ ArchGetIdtHandler ( Prints a message to the serial port. @param Format Format string for the message to print. - @param ... Variable argument list whose contents are accessed + @param ... Variable argument list whose contents are accessed based on the format string specified by Format. **/ @@ -121,11 +121,11 @@ InternalPrintMessage ( /** Find and display image base address and return image base and its entry point. - + @param CurrentEip Current instruction pointer. - + **/ -VOID +VOID DumpModuleImageInfo ( IN UINTN CurrentEip ); @@ -147,8 +147,8 @@ DumpImageAndCpuContent ( @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. @retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL. @retval EFI_UNSUPPORTED This function is not supported. @@ -230,7 +230,7 @@ ArchRestoreExceptionContext ( /** Fix up the vector number and function address in the vector code. - + @param[in] NewVectorAddr New vector handler address. @param[in] VectorNum Index of vector. @param[in] OldVectorAddr Old vector handler address. @@ -246,11 +246,11 @@ AsmVectorNumFixup ( /** Read and save reserved vector information - + @param[in] VectorInfo Pointer to reserved vector list. @param[out] ReservedVector Pointer to reserved vector data buffer. @param[in] VectorCount Vector number to be updated. - + @return EFI_SUCCESS Read and save vector info successfully. @retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL. @@ -283,7 +283,7 @@ GetExceptionNameStr ( **/ VOID CommonExceptionHandlerWorker ( - IN EFI_EXCEPTION_TYPE ExceptionType, + IN EFI_EXCEPTION_TYPE ExceptionType, IN EFI_SYSTEM_CONTEXT SystemContext, IN EXCEPTION_HANDLER_DATA *ExceptionHandlerData ); diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf index 630b25dab7..f4a8d01c80 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf @@ -6,10 +6,10 @@ # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at # http://opensource.org/licenses/bsd-license.php -# +# # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# +# ## [Defines] @@ -58,6 +58,6 @@ PrintLib SynchronizationLib LocalApicLib - PeCoffGetEntryPointLib + PeCoffGetEntryPointLib MemoryAllocationLib DebugLib diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.uni b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.uni index d59ad7fed0..ace4b6f287 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.uni +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.uni @@ -9,7 +9,7 @@ // are licensed and made available under the terms and conditions of the BSD License // which accompanies this distribution. The full text of the license may be found at // http://opensource.org/licenses/bsd-license.php -// +// // THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, // WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. // diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c index ab13e5e870..31febec976 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c @@ -34,7 +34,7 @@ EXCEPTION_HANDLER_DATA mExceptionHandlerData; VOID EFIAPI CommonExceptionHandler ( - IN EFI_EXCEPTION_TYPE ExceptionType, + IN EFI_EXCEPTION_TYPE ExceptionType, IN EFI_SYSTEM_CONTEXT SystemContext ) { @@ -43,15 +43,15 @@ CommonExceptionHandler ( /** Initializes all CPU exceptions entries and provides the default exception handlers. - + Caller should try to get an array of interrupt and/or exception vectors that are in use and need to persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification. - If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL. + If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL. If VectorInfo is not NULL, the exception vectors will be initialized per vector attribute accordingly. @param[in] VectorInfo Pointer to reserved vector list. - - @retval EFI_SUCCESS CPU Exception Entries have been successfully initialized + + @retval EFI_SUCCESS CPU Exception Entries have been successfully initialized with default exception handlers. @retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL. @retval EFI_UNSUPPORTED This function is not supported. @@ -71,15 +71,15 @@ InitializeCpuExceptionHandlers ( /** Initializes all CPU interrupt/exceptions entries and provides the default interrupt/exception handlers. - + Caller should try to get an array of interrupt and/or exception vectors that are in use and need to persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification. - If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL. + If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL. If VectorInfo is not NULL, the exception vectors will be initialized per vector attribute accordingly. @param[in] VectorInfo Pointer to reserved vector list. - - @retval EFI_SUCCESS All CPU interrupt/exception entries have been successfully initialized + + @retval EFI_SUCCESS All CPU interrupt/exception entries have been successfully initialized with default interrupt/exception handlers. @retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL. @retval EFI_UNSUPPORTED This function is not supported. @@ -135,7 +135,7 @@ InitializeCpuInterruptHandlers ( ASSERT (TemplateMap.ExceptionStubHeaderSize <= HOOKAFTER_STUB_SIZE); InterruptEntryCode = AllocatePool (TemplateMap.ExceptionStubHeaderSize * CPU_INTERRUPT_NUM); ASSERT (InterruptEntryCode != NULL); - + InterruptEntry = (UINTN) InterruptEntryCode; for (Index = 0; Index < CPU_INTERRUPT_NUM; Index ++) { CopyMem ( @@ -168,9 +168,9 @@ InitializeCpuInterruptHandlers ( /** Registers a function to be called from the processor interrupt handler. - This function registers and enables the handler specified by InterruptHandler for a processor - interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the - handler for the processor interrupt or exception type specified by InterruptType is uninstalled. + This function registers and enables the handler specified by InterruptHandler for a processor + interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the + handler for the processor interrupt or exception type specified by InterruptType is uninstalled. The installed handler is called once for each processor interrupt or exception. NOTE: This function should be invoked after InitializeCpuExceptionHandlers() or InitializeCpuInterruptHandlers() invoked, otherwise EFI_UNSUPPORTED returned. diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ArchExceptionHandler.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ArchExceptionHandler.c index 52b0e76cd2..f2c39eb193 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ArchExceptionHandler.c +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ArchExceptionHandler.c @@ -76,7 +76,7 @@ ArchSaveExceptionContext ( // Clear IF flag to avoid old IDT handler enable interrupt by IRET // Eflags.UintN = SystemContext.SystemContextIa32->Eflags; - Eflags.Bits.IF = 0; + Eflags.Bits.IF = 0; SystemContext.SystemContextIa32->Eflags = Eflags.UintN; // // Modify the EIP in stack, then old IDT handler will return to the stub code diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ExceptionHandlerAsm.S b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ExceptionHandlerAsm.S index 3676809b4b..c134257d9d 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ExceptionHandlerAsm.S +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ExceptionHandlerAsm.S @@ -357,7 +357,7 @@ HasErrorCode: # # Put Vector Number on stack and restore ECX # - xchgl (%esp), %ecx + xchgl (%esp), %ecx ErrorCodeAndVectorOnStack: pushl %ebp @@ -384,13 +384,13 @@ ErrorCodeAndVectorOnStack: # Align stack to make sure that EFI_FX_SAVE_STATE_IA32 of EFI_SYSTEM_CONTEXT_IA32 # is 16-byte aligned # - andl $0x0fffffff0, %esp + andl $0x0fffffff0, %esp subl $12, %esp subl $8, %esp pushl $0 # check EXCEPTION_HANDLER_CONTEXT.OldIdtHandler pushl $0 # check EXCEPTION_HANDLER_CONTEXT.ExceptionDataFlag - + #; UINT32 Edi, Esi, Ebp, Esp, Ebx, Edx, Ecx, Eax; pushl %eax pushl %ecx @@ -405,7 +405,7 @@ ErrorCodeAndVectorOnStack: #; UINT32 Gs, Fs, Es, Ds, Cs, Ss; movl %ss, %eax pushl %eax - movzwl 16(%ebp), %eax + movzwl 16(%ebp), %eax pushl %eax movl %ds, %eax pushl %eax @@ -425,14 +425,14 @@ ErrorCodeAndVectorOnStack: sidt (%esp) movl 2(%esp), %eax xchgl (%esp), %eax - andl $0x0FFFF, %eax + andl $0x0FFFF, %eax movl %eax, 4(%esp) subl $8, %esp sgdt (%esp) movl 2(%esp), %eax xchgl (%esp), %eax - andl $0x0FFFF, %eax + andl $0x0FFFF, %eax movl %eax, 4(%esp) #; UINT32 Ldtr, Tr; @@ -450,21 +450,21 @@ ErrorCodeAndVectorOnStack: ## insure FXSAVE/FXRSTOR is enabled in CR4... ## ... while we're at it, make sure DE is also enabled... mov $1, %eax - pushl %ebx # temporarily save value of ebx on stack + pushl %ebx # temporarily save value of ebx on stack cpuid # use CPUID to determine if FXSAVE/FXRESTOR # and DE are supported popl %ebx # retore value of ebx that was overwritten - # by CPUID + # by CPUID movl %cr4, %eax pushl %eax # push cr4 firstly testl $BIT24, %edx # Test for FXSAVE/FXRESTOR support jz L1 orl $BIT9, %eax # Set CR4.OSFXSR -L1: +L1: testl $BIT2, %edx # Test for Debugging Extensions support jz L2 orl $BIT3, %eax # Set CR4.DE -L2: +L2: movl %eax, %cr4 movl %cr3, %eax pushl %eax @@ -492,11 +492,11 @@ L2: #; FX_SAVE_STATE_IA32 FxSaveState; subl $512, %esp movl %esp, %edi - testl $BIT24, %edx # Test for FXSAVE/FXRESTOR support. + testl $BIT24, %edx # Test for FXSAVE/FXRESTOR support. # edx still contains result from CPUID above jz L3 .byte 0x0f, 0x0ae, 0x07 #fxsave [edi] -L3: +L3: #; UEFI calling convention for IA32 requires that Direction flag in EFLAGs is clear cld @@ -523,12 +523,12 @@ L3: #; FX_SAVE_STATE_IA32 FxSaveState; movl %esp, %esi movl $1, %eax - cpuid # use CPUID to determine if FXSAVE/FXRESTOR + cpuid # use CPUID to determine if FXSAVE/FXRESTOR # are supported testl $BIT24, %edx # Test for FXSAVE/FXRESTOR support jz L4 .byte 0x0f, 0x0ae, 0x0e # fxrstor [esi] -L4: +L4: addl $512, %esp #; UINT32 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7; @@ -612,30 +612,30 @@ DoIret: #---------------------------------------; # _AsmGetTemplateAddressMap ; #---------------------------------------; -# +# # Protocol prototype # AsmGetTemplateAddressMap ( # EXCEPTION_HANDLER_TEMPLATE_MAP *AddressMap # ); -# +# # Routine Description: -# +# # Return address map of interrupt handler template so that C code can generate # interrupt table. -# +# # Arguments: -# -# -# Returns: -# +# +# +# Returns: +# # Nothing # -# +# # Input: [ebp][0] = Original ebp # [ebp][4] = Return address -# +# # Output: Nothing -# +# # Destroys: Nothing #-----------------------------------------------------------------------------; #------------------------------------------------------------------------------------- diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ExceptionHandlerAsm.asm b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ExceptionHandlerAsm.asm index 12bbec0690..126680ea47 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ExceptionHandlerAsm.asm +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ExceptionHandlerAsm.asm @@ -53,7 +53,7 @@ AsmIdtVectorEnd: HookAfterStubBegin: db 6ah ; push VectorNum: - db 0 ; 0 will be fixed + db 0 ; 0 will be fixed push eax mov eax, HookAfterStubHeaderEnd jmp eax @@ -193,7 +193,7 @@ ErrorCodeAndVectorOnStack: sub esp, 8 push 0 ; clear EXCEPTION_HANDLER_CONTEXT.OldIdtHandler push 0 ; clear EXCEPTION_HANDLER_CONTEXT.ExceptionDataFlag - + ;; UINT32 Edi, Esi, Ebp, Esp, Ebx, Edx, Ecx, Eax; push eax push ecx @@ -251,20 +251,20 @@ ErrorCodeAndVectorOnStack: ;; UINT32 Cr0, Cr1, Cr2, Cr3, Cr4; mov eax, 1 - push ebx ; temporarily save value of ebx on stack - cpuid ; use CPUID to determine if FXSAVE/FXRESTOR and DE + push ebx ; temporarily save value of ebx on stack + cpuid ; use CPUID to determine if FXSAVE/FXRESTOR and DE ; are supported - pop ebx ; retore value of ebx that was overwritten by CPUID + pop ebx ; retore value of ebx that was overwritten by CPUID mov eax, cr4 push eax ; push cr4 firstly test edx, BIT24 ; Test for FXSAVE/FXRESTOR support jz @F or eax, BIT9 ; Set CR4.OSFXSR -@@: +@@: test edx, BIT2 ; Test for Debugging Extensions support jz @F or eax, BIT3 ; Set CR4.DE -@@: +@@: mov cr4, eax mov eax, cr3 push eax @@ -296,7 +296,7 @@ ErrorCodeAndVectorOnStack: ; edx still contains result from CPUID above jz @F db 0fh, 0aeh, 07h ;fxsave [edi] -@@: +@@: ;; UEFI calling convention for IA32 requires that Direction flag in EFLAGs is clear cld @@ -329,7 +329,7 @@ ErrorCodeAndVectorOnStack: test edx, BIT24 ; Test for FXSAVE/FXRESTOR support jz @F db 0fh, 0aeh, 0eh ; fxrstor [esi] -@@: +@@: add esp, 512 ;; UINT32 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7; @@ -395,7 +395,7 @@ ErrorCode: sub esp, 4 jmp dword ptr [esp - 12] -DoReturn: +DoReturn: cmp mDoFarReturnFlag, 0 ; Check if need to do far return instead of IRET jz DoIret push [esp + 8] ; save EFLAGS @@ -414,30 +414,30 @@ CommonInterruptEntry ENDP ;---------------------------------------; ; _AsmGetTemplateAddressMap ; ;----------------------------------------------------------------------------; -; +; ; Protocol prototype ; AsmGetTemplateAddressMap ( ; EXCEPTION_HANDLER_TEMPLATE_MAP *AddressMap ; ); -; +; ; Routine Description: -; +; ; Return address map of interrupt handler template so that C code can generate ; interrupt table. -; +; ; Arguments: -; -; -; Returns: -; +; +; +; Returns: +; ; Nothing ; -; +; ; Input: [ebp][0] = Original ebp ; [ebp][4] = Return address -; +; ; Output: Nothing -; +; ; Destroys: Nothing ;-----------------------------------------------------------------------------; AsmGetTemplateAddressMap proc near public @@ -449,7 +449,7 @@ AsmGetTemplateAddressMap proc near public mov dword ptr [ebx], AsmIdtVectorBegin mov dword ptr [ebx + 4h], (AsmIdtVectorEnd - AsmIdtVectorBegin) / 32 mov dword ptr [ebx + 8h], HookAfterStubBegin - + popad pop ebp ret diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuException.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuException.c index 53fa3c611e..8d8d16ecbd 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuException.c +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuException.c @@ -25,7 +25,7 @@ EFI_GUID mCpuExceptrionHandlerLibHobGuid = CPU_EXCEPTION_HANDLER_LIB_HOB_GUID; /** Get exception handler data pointer from GUIDed HOb. - @return pointer to exception handler data. + @return pointer to exception handler data. **/ EXCEPTION_HANDLER_DATA * GetExceptionHandlerData ( @@ -55,7 +55,7 @@ GetExceptionHandlerData ( VOID EFIAPI CommonExceptionHandler ( - IN EFI_EXCEPTION_TYPE ExceptionType, + IN EFI_EXCEPTION_TYPE ExceptionType, IN EFI_SYSTEM_CONTEXT SystemContext ) { @@ -67,17 +67,17 @@ CommonExceptionHandler ( /** Initializes all CPU exceptions entries and provides the default exception handlers. - + Caller should try to get an array of interrupt and/or exception vectors that are in use and need to persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification. - If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL. + If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL. If VectorInfo is not NULL, the exception vectors will be initialized per vector attribute accordingly. - Note: Before invoking this API, caller must allocate memory for IDT table and load + Note: Before invoking this API, caller must allocate memory for IDT table and load IDTR by AsmWriteIdtr(). @param[in] VectorInfo Pointer to reserved vector list. - - @retval EFI_SUCCESS CPU Exception Entries have been successfully initialized + + @retval EFI_SUCCESS CPU Exception Entries have been successfully initialized with default exception handlers. @retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL. @retval EFI_UNSUPPORTED This function is not supported. @@ -123,15 +123,15 @@ InitializeCpuExceptionHandlers ( /** Initializes all CPU interrupt/exceptions entries and provides the default interrupt/exception handlers. - + Caller should try to get an array of interrupt and/or exception vectors that are in use and need to persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification. - If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL. + If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL. If VectorInfo is not NULL, the exception vectors will be initialized per vector attribute accordingly. @param[in] VectorInfo Pointer to reserved vector list. - - @retval EFI_SUCCESS All CPU interrupt/exception entries have been successfully initialized + + @retval EFI_SUCCESS All CPU interrupt/exception entries have been successfully initialized with default interrupt/exception handlers. @retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL. @retval EFI_UNSUPPORTED This function is not supported. @@ -149,9 +149,9 @@ InitializeCpuInterruptHandlers ( /** Registers a function to be called from the processor interrupt handler. - This function registers and enables the handler specified by InterruptHandler for a processor - interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the - handler for the processor interrupt or exception type specified by InterruptType is uninstalled. + This function registers and enables the handler specified by InterruptHandler for a processor + interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the + handler for the processor interrupt or exception type specified by InterruptType is uninstalled. The installed handler is called once for each processor interrupt or exception. NOTE: This function should be invoked after InitializeCpuExceptionHandlers() or InitializeCpuInterruptHandlers() invoked, otherwise EFI_UNSUPPORTED returned. diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf index 7c82219dfa..75443288a9 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf @@ -6,10 +6,10 @@ # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at # http://opensource.org/licenses/bsd-license.php -# +# # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# +# ## [Defines] diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.uni b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.uni index 8baf045a61..a89537f7ff 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.uni +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.uni @@ -9,7 +9,7 @@ // are licensed and made available under the terms and conditions of the BSD License // which accompanies this distribution. The full text of the license may be found at // http://opensource.org/licenses/bsd-license.php -// +// // THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, // WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. // diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c index fb679b5782..0facfde5dd 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c @@ -24,7 +24,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ VOID CommonExceptionHandlerWorker ( - IN EFI_EXCEPTION_TYPE ExceptionType, + IN EFI_EXCEPTION_TYPE ExceptionType, IN EFI_SYSTEM_CONTEXT SystemContext, IN EXCEPTION_HANDLER_DATA *ExceptionHandlerData ) @@ -87,7 +87,7 @@ CommonExceptionHandlerWorker ( CpuDeadLoop (); break; } - + if (ExternalInterruptHandler != NULL && ExternalInterruptHandler[ExceptionType] != NULL) { (ExternalInterruptHandler[ExceptionType]) (ExceptionType, SystemContext); @@ -100,7 +100,7 @@ CommonExceptionHandlerWorker ( } // // Display ExceptionType, CPU information and Image information - // + // DumpImageAndCpuContent (ExceptionType, SystemContext); // // Release Spinlock of output message @@ -192,8 +192,8 @@ UpdateIdtTable ( @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. @retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL. @retval EFI_UNSUPPORTED This function is not supported. diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c index 5d6807b367..af608bffb6 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c @@ -26,15 +26,15 @@ CONST UINTN mDoFarReturnFlag = 0; VOID EFIAPI CommonExceptionHandler ( - IN EFI_EXCEPTION_TYPE ExceptionType, + IN EFI_EXCEPTION_TYPE ExceptionType, IN EFI_SYSTEM_CONTEXT SystemContext ) { // // Display ExceptionType, CPU information and Image information - // + // DumpImageAndCpuContent (ExceptionType, SystemContext); - + // // Enter a dead loop. // @@ -43,17 +43,17 @@ CommonExceptionHandler ( /** Initializes all CPU exceptions entries and provides the default exception handlers. - + Caller should try to get an array of interrupt and/or exception vectors that are in use and need to persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification. - If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL. + If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL. If VectorInfo is not NULL, the exception vectors will be initialized per vector attribute accordingly. - Note: Before invoking this API, caller must allocate memory for IDT table and load + Note: Before invoking this API, caller must allocate memory for IDT table and load IDTR by AsmWriteIdtr(). @param[in] VectorInfo Pointer to reserved vector list. - - @retval EFI_SUCCESS CPU Exception Entries have been successfully initialized + + @retval EFI_SUCCESS CPU Exception Entries have been successfully initialized with default exception handlers. @retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL. @retval EFI_UNSUPPORTED This function is not supported. @@ -65,7 +65,7 @@ InitializeCpuExceptionHandlers ( IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL ) { - EFI_STATUS Status; + EFI_STATUS Status; RESERVED_VECTORS_DATA ReservedVectorData[CPU_EXCEPTION_NUM]; IA32_DESCRIPTOR IdtDescriptor; UINTN IdtEntryCount; @@ -122,15 +122,15 @@ InitializeCpuExceptionHandlers ( /** Initializes all CPU interrupt/exceptions entries and provides the default interrupt/exception handlers. - + Caller should try to get an array of interrupt and/or exception vectors that are in use and need to persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification. - If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL. + If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL. If VectorInfo is not NULL, the exception vectors will be initialized per vector attribute accordingly. @param[in] VectorInfo Pointer to reserved vector list. - - @retval EFI_SUCCESS All CPU interrupt/exception entries have been successfully initialized + + @retval EFI_SUCCESS All CPU interrupt/exception entries have been successfully initialized with default interrupt/exception handlers. @retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL. @retval EFI_UNSUPPORTED This function is not supported. @@ -148,9 +148,9 @@ InitializeCpuInterruptHandlers ( /** Registers a function to be called from the processor interrupt handler. - This function registers and enables the handler specified by InterruptHandler for a processor - interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the - handler for the processor interrupt or exception type specified by InterruptType is uninstalled. + This function registers and enables the handler specified by InterruptHandler for a processor + interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the + handler for the processor interrupt or exception type specified by InterruptType is uninstalled. The installed handler is called once for each processor interrupt or exception. NOTE: This function should be invoked after InitializeCpuExceptionHandlers() or InitializeCpuInterruptHandlers() invoked, otherwise EFI_UNSUPPORTED returned. diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf index fba60a769f..d70a99c100 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf @@ -6,10 +6,10 @@ # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at # http://opensource.org/licenses/bsd-license.php -# +# # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# +# ## [Defines] diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.uni b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.uni index b808c812f2..de8b846a67 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.uni +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.uni @@ -9,7 +9,7 @@ // are licensed and made available under the terms and conditions of the BSD License // which accompanies this distribution. The full text of the license may be found at // http://opensource.org/licenses/bsd-license.php -// +// // THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, // WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. // diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf index c23c6181b9..634ffcb21d 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf @@ -6,10 +6,10 @@ # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at # http://opensource.org/licenses/bsd-license.php -# +# # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# +# ## [Defines] diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.uni b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.uni index a835101a2d..3dfa69547b 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.uni +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.uni @@ -9,7 +9,7 @@ // are licensed and made available under the terms and conditions of the BSD License // which accompanies this distribution. The full text of the license may be found at // http://opensource.org/licenses/bsd-license.php -// +// // THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, // WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. // diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmException.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmException.c index 5a3d416025..7414d3f773 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmException.c +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmException.c @@ -15,7 +15,7 @@ #include #include "CpuExceptionCommon.h" -CONST UINTN mDoFarReturnFlag = 1; +CONST UINTN mDoFarReturnFlag = 1; // // Spin lock for CPU information display @@ -34,7 +34,7 @@ EXCEPTION_HANDLER_DATA mExceptionHandlerData; VOID EFIAPI CommonExceptionHandler ( - IN EFI_EXCEPTION_TYPE ExceptionType, + IN EFI_EXCEPTION_TYPE ExceptionType, IN EFI_SYSTEM_CONTEXT SystemContext ) { @@ -43,15 +43,15 @@ CommonExceptionHandler ( /** Initializes all CPU exceptions entries and provides the default exception handlers. - + Caller should try to get an array of interrupt and/or exception vectors that are in use and need to persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification. - If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL. + If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL. If VectorInfo is not NULL, the exception vectors will be initialized per vector attribute accordingly. @param[in] VectorInfo Pointer to reserved vector list. - - @retval EFI_SUCCESS CPU Exception Entries have been successfully initialized + + @retval EFI_SUCCESS CPU Exception Entries have been successfully initialized with default exception handlers. @retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL. @retval EFI_UNSUPPORTED This function is not supported. @@ -71,15 +71,15 @@ InitializeCpuExceptionHandlers ( /** Initializes all CPU interrupt/exceptions entries and provides the default interrupt/exception handlers. - + Caller should try to get an array of interrupt and/or exception vectors that are in use and need to persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification. - If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL. + If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL. If VectorInfo is not NULL, the exception vectors will be initialized per vector attribute accordingly. @param[in] VectorInfo Pointer to reserved vector list. - - @retval EFI_SUCCESS All CPU interrupt/exception entries have been successfully initialized + + @retval EFI_SUCCESS All CPU interrupt/exception entries have been successfully initialized with default interrupt/exception handlers. @retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL. @retval EFI_UNSUPPORTED This function is not supported. @@ -97,9 +97,9 @@ InitializeCpuInterruptHandlers ( /** Registers a function to be called from the processor interrupt handler. - This function registers and enables the handler specified by InterruptHandler for a processor - interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the - handler for the processor interrupt or exception type specified by InterruptType is uninstalled. + This function registers and enables the handler specified by InterruptHandler for a processor + interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the + handler for the processor interrupt or exception type specified by InterruptType is uninstalled. The installed handler is called once for each processor interrupt or exception. NOTE: This function should be invoked after InitializeCpuExceptionHandlers() or InitializeCpuInterruptHandlers() invoked, otherwise EFI_UNSUPPORTED returned. diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchExceptionHandler.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchExceptionHandler.c index c0d19b9fc5..65f0cff680 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchExceptionHandler.c +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchExceptionHandler.c @@ -29,7 +29,7 @@ ArchUpdateIdtEntry ( { IdtEntry->Bits.OffsetLow = (UINT16)(UINTN)InterruptHandler; IdtEntry->Bits.OffsetHigh = (UINT16)((UINTN)InterruptHandler >> 16); - IdtEntry->Bits.OffsetUpper = (UINT32)((UINTN)InterruptHandler >> 32); + IdtEntry->Bits.OffsetUpper = (UINT32)((UINTN)InterruptHandler >> 32); IdtEntry->Bits.GateType = IA32_IDT_GATE_TYPE_INTERRUPT_32; } @@ -79,7 +79,7 @@ ArchSaveExceptionContext ( // Clear IF flag to avoid old IDT handler enable interrupt by IRET // Eflags.UintN = SystemContext.SystemContextX64->Rflags; - Eflags.Bits.IF = 0; + Eflags.Bits.IF = 0; SystemContext.SystemContextX64->Rflags = Eflags.UintN; // // Modify the EIP in stack, then old IDT handler will return to the stub code @@ -236,7 +236,7 @@ DumpCpuContext ( SystemContext.SystemContextX64->Idtr[1], SystemContext.SystemContextX64->Tr ); - InternalPrintMessage ( + InternalPrintMessage ( "FXSAVE_STATE - %016lx\n", &SystemContext.SystemContextX64->FxSaveState ); diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.S b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.S index 975adaa103..edd363cdaa 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.S +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.S @@ -29,8 +29,8 @@ ASM_GLOBAL ASM_PFX(CommonExceptionHandler) .text #ifdef __APPLE__ -# macros are different between GNU and Xcode as. -.macro IDT_MACRO +# macros are different between GNU and Xcode as. +.macro IDT_MACRO push $0 #else .macro IDT_MACRO arg @@ -78,7 +78,7 @@ AsmIdtVectorEnd: HookAfterStubHeaderBegin: .byte 0x6a # push PatchVectorNum: - .byte 0 # 0 will be fixed + .byte 0 # 0 will be fixed .byte 0xe9 # jmp ASM_PFX(HookAfterStubHeaderEnd) PatchFuncAddress: .set HOOK_ADDRESS, ASM_PFX(HookAfterStubHeaderEnd) - . - 4 @@ -234,16 +234,16 @@ CommonInterruptEntry_al_0000: movq %cr8, %rax pushq %rax movq %cr4, %rax - orq $0x208, %rax - movq %rax, %cr4 + orq $0x208, %rax + movq %rax, %cr4 pushq %rax - mov %cr3, %rax + mov %cr3, %rax pushq %rax - mov %cr2, %rax + mov %cr2, %rax pushq %rax xorq %rax, %rax pushq %rax - mov %cr0, %rax + mov %cr0, %rax pushq %rax #; UINT64 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7; @@ -278,7 +278,7 @@ CommonInterruptEntry_al_0000: # Per X64 calling convention, allocate maximum parameter stack space # and make sure RSP is 16-byte aligned # - subq $40, %rsp + subq $40, %rsp call ASM_PFX(CommonExceptionHandler) addq $40, %rsp diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.asm b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.asm index cd21ec4c90..726c64a140 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.asm +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.asm @@ -47,7 +47,7 @@ AsmIdtVectorEnd: HookAfterStubHeaderBegin: db 6ah ; push @VectorNum: - db 0 ; 0 will be fixed + db 0 ; 0 will be fixed push rax mov rax, HookAfterStubHeaderEnd jmp rax @@ -89,7 +89,7 @@ HookAfterStubHeaderEnd: ; + RBP + ; +---------------------+ <-- RBP, 16-byte aligned ; The follow algorithm is used for the common interrupt routine. -CommonInterruptEntry PROC PUBLIC +CommonInterruptEntry PROC PUBLIC cli pop rax ; @@ -111,7 +111,7 @@ NoErrorCode: ; push [rsp] mov qword ptr [rsp + 8], 0 -@@: +@@: push rbp mov rbp, rsp push 0 ; clear EXCEPTION_HANDLER_CONTEXT.OldIdtHandler @@ -351,7 +351,7 @@ DoReturn: jz DoIret push rax mov rax, rsp ; save old RSP to rax - mov rsp, [rsp + 20h] + mov rsp, [rsp + 20h] push [rax + 10h] ; save CS in new location push [rax + 8h] ; save EIP in new location push [rax + 18h] ; save EFLAGS in new location -- 2.39.2