-/** @file\r
+ /** @file\r
CPU Exception Handler Library common functions.\r
\r
Copyright (c) 2012 - 2016, Intel Corporation. All rights reserved.<BR>\r
\r
/**\r
Find and display image base address and return image base and its entry point.\r
- \r
+\r
@param CurrentEip Current instruction pointer.\r
- \r
+\r
**/\r
-VOID \r
+VOID\r
DumpModuleImageInfo (\r
IN UINTN CurrentEip\r
)\r
Prints a message to the serial port.\r
\r
@param Format Format string for the message to print.\r
- @param ... Variable argument list whose contents are accessed \r
+ @param ... Variable argument list whose contents are accessed\r
based on the format string specified by Format.\r
\r
**/\r
\r
/**\r
Find and display image base address and return image base and its entry point.\r
- \r
+\r
@param CurrentEip Current instruction pointer.\r
- \r
+\r
**/\r
-VOID \r
+VOID\r
DumpModuleImageInfo (\r
IN UINTN CurrentEip\r
);\r
\r
@param[in] VectorInfo Pointer to reserved vector list.\r
@param[in, out] ExceptionHandlerData Pointer to exception handler data.\r
- \r
- @retval EFI_SUCCESS CPU Exception Entries have been successfully initialized \r
+\r
+ @retval EFI_SUCCESS CPU Exception Entries have been successfully initialized\r
with default exception handlers.\r
@retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL.\r
@retval EFI_UNSUPPORTED This function is not supported.\r
\r
/**\r
Fix up the vector number and function address in the vector code.\r
- \r
+\r
@param[in] NewVectorAddr New vector handler address.\r
@param[in] VectorNum Index of vector.\r
@param[in] OldVectorAddr Old vector handler address.\r
\r
/**\r
Read and save reserved vector information\r
- \r
+\r
@param[in] VectorInfo Pointer to reserved vector list.\r
@param[out] ReservedVector Pointer to reserved vector data buffer.\r
@param[in] VectorCount Vector number to be updated.\r
- \r
+\r
@return EFI_SUCCESS Read and save vector info successfully.\r
@retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL.\r
\r
**/\r
VOID\r
CommonExceptionHandlerWorker (\r
- IN EFI_EXCEPTION_TYPE ExceptionType, \r
+ IN EFI_EXCEPTION_TYPE ExceptionType,\r
IN EFI_SYSTEM_CONTEXT SystemContext,\r
IN EXCEPTION_HANDLER_DATA *ExceptionHandlerData\r
);\r
# are licensed and made available under the terms and conditions of the BSD License\r
# which accompanies this distribution. The full text of the license may be found at\r
# http://opensource.org/licenses/bsd-license.php\r
-# \r
+#\r
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-# \r
+#\r
##\r
\r
[Defines]\r
PrintLib\r
SynchronizationLib\r
LocalApicLib\r
- PeCoffGetEntryPointLib \r
+ PeCoffGetEntryPointLib\r
MemoryAllocationLib\r
DebugLib\r
// are licensed and made available under the terms and conditions of the BSD License\r
// which accompanies this distribution. The full text of the license may be found at\r
// http://opensource.org/licenses/bsd-license.php\r
-// \r
+//\r
// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
//\r
VOID\r
EFIAPI\r
CommonExceptionHandler (\r
- IN EFI_EXCEPTION_TYPE ExceptionType, \r
+ IN EFI_EXCEPTION_TYPE ExceptionType,\r
IN EFI_SYSTEM_CONTEXT SystemContext\r
)\r
{\r
\r
/**\r
Initializes all CPU exceptions entries and provides the default exception handlers.\r
- \r
+\r
Caller should try to get an array of interrupt and/or exception vectors that are in use and need to\r
persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification.\r
- If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL. \r
+ If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL.\r
If VectorInfo is not NULL, the exception vectors will be initialized per vector attribute accordingly.\r
\r
@param[in] VectorInfo Pointer to reserved vector list.\r
- \r
- @retval EFI_SUCCESS CPU Exception Entries have been successfully initialized \r
+\r
+ @retval EFI_SUCCESS CPU Exception Entries have been successfully initialized\r
with default exception handlers.\r
@retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL.\r
@retval EFI_UNSUPPORTED This function is not supported.\r
\r
/**\r
Initializes all CPU interrupt/exceptions entries and provides the default interrupt/exception handlers.\r
- \r
+\r
Caller should try to get an array of interrupt and/or exception vectors that are in use and need to\r
persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification.\r
- If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL. \r
+ If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL.\r
If VectorInfo is not NULL, the exception vectors will be initialized per vector attribute accordingly.\r
\r
@param[in] VectorInfo Pointer to reserved vector list.\r
- \r
- @retval EFI_SUCCESS All CPU interrupt/exception entries have been successfully initialized \r
+\r
+ @retval EFI_SUCCESS All CPU interrupt/exception entries have been successfully initialized\r
with default interrupt/exception handlers.\r
@retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL.\r
@retval EFI_UNSUPPORTED This function is not supported.\r
ASSERT (TemplateMap.ExceptionStubHeaderSize <= HOOKAFTER_STUB_SIZE);\r
InterruptEntryCode = AllocatePool (TemplateMap.ExceptionStubHeaderSize * CPU_INTERRUPT_NUM);\r
ASSERT (InterruptEntryCode != NULL);\r
- \r
+\r
InterruptEntry = (UINTN) InterruptEntryCode;\r
for (Index = 0; Index < CPU_INTERRUPT_NUM; Index ++) {\r
CopyMem (\r
/**\r
Registers a function to be called from the processor interrupt handler.\r
\r
- This function registers and enables the handler specified by InterruptHandler for a processor \r
- interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the \r
- handler for the processor interrupt or exception type specified by InterruptType is uninstalled. \r
+ This function registers and enables the handler specified by InterruptHandler for a processor\r
+ interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the\r
+ handler for the processor interrupt or exception type specified by InterruptType is uninstalled.\r
The installed handler is called once for each processor interrupt or exception.\r
NOTE: This function should be invoked after InitializeCpuExceptionHandlers() or\r
InitializeCpuInterruptHandlers() invoked, otherwise EFI_UNSUPPORTED returned.\r
// Clear IF flag to avoid old IDT handler enable interrupt by IRET\r
//\r
Eflags.UintN = SystemContext.SystemContextIa32->Eflags;\r
- Eflags.Bits.IF = 0; \r
+ Eflags.Bits.IF = 0;\r
SystemContext.SystemContextIa32->Eflags = Eflags.UintN;\r
//\r
// Modify the EIP in stack, then old IDT handler will return to the stub code\r
#\r
# Put Vector Number on stack and restore ECX\r
#\r
- xchgl (%esp), %ecx \r
+ xchgl (%esp), %ecx\r
\r
ErrorCodeAndVectorOnStack:\r
pushl %ebp\r
# Align stack to make sure that EFI_FX_SAVE_STATE_IA32 of EFI_SYSTEM_CONTEXT_IA32\r
# is 16-byte aligned\r
#\r
- andl $0x0fffffff0, %esp \r
+ andl $0x0fffffff0, %esp\r
subl $12, %esp\r
\r
subl $8, %esp\r
pushl $0 # check EXCEPTION_HANDLER_CONTEXT.OldIdtHandler\r
pushl $0 # check EXCEPTION_HANDLER_CONTEXT.ExceptionDataFlag\r
- \r
+\r
#; UINT32 Edi, Esi, Ebp, Esp, Ebx, Edx, Ecx, Eax;\r
pushl %eax\r
pushl %ecx\r
#; UINT32 Gs, Fs, Es, Ds, Cs, Ss;\r
movl %ss, %eax\r
pushl %eax\r
- movzwl 16(%ebp), %eax \r
+ movzwl 16(%ebp), %eax\r
pushl %eax\r
movl %ds, %eax\r
pushl %eax\r
sidt (%esp)\r
movl 2(%esp), %eax\r
xchgl (%esp), %eax\r
- andl $0x0FFFF, %eax \r
+ andl $0x0FFFF, %eax\r
movl %eax, 4(%esp)\r
\r
subl $8, %esp\r
sgdt (%esp)\r
movl 2(%esp), %eax\r
xchgl (%esp), %eax\r
- andl $0x0FFFF, %eax \r
+ andl $0x0FFFF, %eax\r
movl %eax, 4(%esp)\r
\r
#; UINT32 Ldtr, Tr;\r
## insure FXSAVE/FXRSTOR is enabled in CR4...\r
## ... while we're at it, make sure DE is also enabled...\r
mov $1, %eax\r
- pushl %ebx # temporarily save value of ebx on stack \r
+ pushl %ebx # temporarily save value of ebx on stack\r
cpuid # use CPUID to determine if FXSAVE/FXRESTOR\r
# and DE are supported\r
popl %ebx # retore value of ebx that was overwritten\r
- # by CPUID \r
+ # by CPUID\r
movl %cr4, %eax\r
pushl %eax # push cr4 firstly\r
testl $BIT24, %edx # Test for FXSAVE/FXRESTOR support\r
jz L1\r
orl $BIT9, %eax # Set CR4.OSFXSR\r
-L1: \r
+L1:\r
testl $BIT2, %edx # Test for Debugging Extensions support\r
jz L2\r
orl $BIT3, %eax # Set CR4.DE\r
-L2: \r
+L2:\r
movl %eax, %cr4\r
movl %cr3, %eax\r
pushl %eax\r
#; FX_SAVE_STATE_IA32 FxSaveState;\r
subl $512, %esp\r
movl %esp, %edi\r
- testl $BIT24, %edx # Test for FXSAVE/FXRESTOR support. \r
+ testl $BIT24, %edx # Test for FXSAVE/FXRESTOR support.\r
# edx still contains result from CPUID above\r
jz L3\r
.byte 0x0f, 0x0ae, 0x07 #fxsave [edi]\r
-L3: \r
+L3:\r
\r
#; UEFI calling convention for IA32 requires that Direction flag in EFLAGs is clear\r
cld\r
#; FX_SAVE_STATE_IA32 FxSaveState;\r
movl %esp, %esi\r
movl $1, %eax\r
- cpuid # use CPUID to determine if FXSAVE/FXRESTOR \r
+ cpuid # use CPUID to determine if FXSAVE/FXRESTOR\r
# are supported\r
testl $BIT24, %edx # Test for FXSAVE/FXRESTOR support\r
jz L4\r
.byte 0x0f, 0x0ae, 0x0e # fxrstor [esi]\r
-L4: \r
+L4:\r
addl $512, %esp\r
\r
#; UINT32 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;\r
#---------------------------------------;\r
# _AsmGetTemplateAddressMap ;\r
#---------------------------------------;\r
-# \r
+#\r
# Protocol prototype\r
# AsmGetTemplateAddressMap (\r
# EXCEPTION_HANDLER_TEMPLATE_MAP *AddressMap\r
# );\r
-# \r
+#\r
# Routine Description:\r
-# \r
+#\r
# Return address map of interrupt handler template so that C code can generate\r
# interrupt table.\r
-# \r
+#\r
# Arguments:\r
-# \r
-# \r
-# Returns: \r
-# \r
+#\r
+#\r
+# Returns:\r
+#\r
# Nothing\r
#\r
-# \r
+#\r
# Input: [ebp][0] = Original ebp\r
# [ebp][4] = Return address\r
-# \r
+#\r
# Output: Nothing\r
-# \r
+#\r
# Destroys: Nothing\r
#-----------------------------------------------------------------------------;\r
#-------------------------------------------------------------------------------------\r
HookAfterStubBegin:\r
db 6ah ; push\r
VectorNum:\r
- db 0 ; 0 will be fixed \r
+ db 0 ; 0 will be fixed\r
push eax\r
mov eax, HookAfterStubHeaderEnd\r
jmp eax\r
sub esp, 8\r
push 0 ; clear EXCEPTION_HANDLER_CONTEXT.OldIdtHandler\r
push 0 ; clear EXCEPTION_HANDLER_CONTEXT.ExceptionDataFlag\r
- \r
+\r
;; UINT32 Edi, Esi, Ebp, Esp, Ebx, Edx, Ecx, Eax;\r
push eax\r
push ecx\r
\r
;; UINT32 Cr0, Cr1, Cr2, Cr3, Cr4;\r
mov eax, 1\r
- push ebx ; temporarily save value of ebx on stack \r
- cpuid ; use CPUID to determine if FXSAVE/FXRESTOR and DE \r
+ push ebx ; temporarily save value of ebx on stack\r
+ cpuid ; use CPUID to determine if FXSAVE/FXRESTOR and DE\r
; are supported\r
- pop ebx ; retore value of ebx that was overwritten by CPUID \r
+ pop ebx ; retore value of ebx that was overwritten by CPUID\r
mov eax, cr4\r
push eax ; push cr4 firstly\r
test edx, BIT24 ; Test for FXSAVE/FXRESTOR support\r
jz @F\r
or eax, BIT9 ; Set CR4.OSFXSR\r
-@@: \r
+@@:\r
test edx, BIT2 ; Test for Debugging Extensions support\r
jz @F\r
or eax, BIT3 ; Set CR4.DE\r
-@@: \r
+@@:\r
mov cr4, eax\r
mov eax, cr3\r
push eax\r
; edx still contains result from CPUID above\r
jz @F\r
db 0fh, 0aeh, 07h ;fxsave [edi]\r
-@@: \r
+@@:\r
\r
;; UEFI calling convention for IA32 requires that Direction flag in EFLAGs is clear\r
cld\r
test edx, BIT24 ; Test for FXSAVE/FXRESTOR support\r
jz @F\r
db 0fh, 0aeh, 0eh ; fxrstor [esi]\r
-@@: \r
+@@:\r
add esp, 512\r
\r
;; UINT32 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;\r
sub esp, 4\r
jmp dword ptr [esp - 12]\r
\r
-DoReturn: \r
+DoReturn:\r
cmp mDoFarReturnFlag, 0 ; Check if need to do far return instead of IRET\r
jz DoIret\r
push [esp + 8] ; save EFLAGS\r
;---------------------------------------;\r
; _AsmGetTemplateAddressMap ;\r
;----------------------------------------------------------------------------;\r
-; \r
+;\r
; Protocol prototype\r
; AsmGetTemplateAddressMap (\r
; EXCEPTION_HANDLER_TEMPLATE_MAP *AddressMap\r
; );\r
-; \r
+;\r
; Routine Description:\r
-; \r
+;\r
; Return address map of interrupt handler template so that C code can generate\r
; interrupt table.\r
-; \r
+;\r
; Arguments:\r
-; \r
-; \r
-; Returns: \r
-; \r
+;\r
+;\r
+; Returns:\r
+;\r
; Nothing\r
;\r
-; \r
+;\r
; Input: [ebp][0] = Original ebp\r
; [ebp][4] = Return address\r
-; \r
+;\r
; Output: Nothing\r
-; \r
+;\r
; Destroys: Nothing\r
;-----------------------------------------------------------------------------;\r
AsmGetTemplateAddressMap proc near public\r
mov dword ptr [ebx], AsmIdtVectorBegin\r
mov dword ptr [ebx + 4h], (AsmIdtVectorEnd - AsmIdtVectorBegin) / 32\r
mov dword ptr [ebx + 8h], HookAfterStubBegin\r
- \r
+\r
popad\r
pop ebp\r
ret\r
/**\r
Get exception handler data pointer from GUIDed HOb.\r
\r
- @return pointer to exception handler data. \r
+ @return pointer to exception handler data.\r
**/\r
EXCEPTION_HANDLER_DATA *\r
GetExceptionHandlerData (\r
VOID\r
EFIAPI\r
CommonExceptionHandler (\r
- IN EFI_EXCEPTION_TYPE ExceptionType, \r
+ IN EFI_EXCEPTION_TYPE ExceptionType,\r
IN EFI_SYSTEM_CONTEXT SystemContext\r
)\r
{\r
\r
/**\r
Initializes all CPU exceptions entries and provides the default exception handlers.\r
- \r
+\r
Caller should try to get an array of interrupt and/or exception vectors that are in use and need to\r
persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification.\r
- If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL. \r
+ If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL.\r
If VectorInfo is not NULL, the exception vectors will be initialized per vector attribute accordingly.\r
- Note: Before invoking this API, caller must allocate memory for IDT table and load \r
+ Note: Before invoking this API, caller must allocate memory for IDT table and load\r
IDTR by AsmWriteIdtr().\r
\r
@param[in] VectorInfo Pointer to reserved vector list.\r
- \r
- @retval EFI_SUCCESS CPU Exception Entries have been successfully initialized \r
+\r
+ @retval EFI_SUCCESS CPU Exception Entries have been successfully initialized\r
with default exception handlers.\r
@retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL.\r
@retval EFI_UNSUPPORTED This function is not supported.\r
\r
/**\r
Initializes all CPU interrupt/exceptions entries and provides the default interrupt/exception handlers.\r
- \r
+\r
Caller should try to get an array of interrupt and/or exception vectors that are in use and need to\r
persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification.\r
- If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL. \r
+ If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL.\r
If VectorInfo is not NULL, the exception vectors will be initialized per vector attribute accordingly.\r
\r
@param[in] VectorInfo Pointer to reserved vector list.\r
- \r
- @retval EFI_SUCCESS All CPU interrupt/exception entries have been successfully initialized \r
+\r
+ @retval EFI_SUCCESS All CPU interrupt/exception entries have been successfully initialized\r
with default interrupt/exception handlers.\r
@retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL.\r
@retval EFI_UNSUPPORTED This function is not supported.\r
/**\r
Registers a function to be called from the processor interrupt handler.\r
\r
- This function registers and enables the handler specified by InterruptHandler for a processor \r
- interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the \r
- handler for the processor interrupt or exception type specified by InterruptType is uninstalled. \r
+ This function registers and enables the handler specified by InterruptHandler for a processor\r
+ interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the\r
+ handler for the processor interrupt or exception type specified by InterruptType is uninstalled.\r
The installed handler is called once for each processor interrupt or exception.\r
NOTE: This function should be invoked after InitializeCpuExceptionHandlers() or\r
InitializeCpuInterruptHandlers() invoked, otherwise EFI_UNSUPPORTED returned.\r
# are licensed and made available under the terms and conditions of the BSD License\r
# which accompanies this distribution. The full text of the license may be found at\r
# http://opensource.org/licenses/bsd-license.php\r
-# \r
+#\r
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-# \r
+#\r
##\r
\r
[Defines]\r
// are licensed and made available under the terms and conditions of the BSD License\r
// which accompanies this distribution. The full text of the license may be found at\r
// http://opensource.org/licenses/bsd-license.php\r
-// \r
+//\r
// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
//\r
**/\r
VOID\r
CommonExceptionHandlerWorker (\r
- IN EFI_EXCEPTION_TYPE ExceptionType, \r
+ IN EFI_EXCEPTION_TYPE ExceptionType,\r
IN EFI_SYSTEM_CONTEXT SystemContext,\r
IN EXCEPTION_HANDLER_DATA *ExceptionHandlerData\r
)\r
CpuDeadLoop ();\r
break;\r
}\r
- \r
+\r
if (ExternalInterruptHandler != NULL &&\r
ExternalInterruptHandler[ExceptionType] != NULL) {\r
(ExternalInterruptHandler[ExceptionType]) (ExceptionType, SystemContext);\r
}\r
//\r
// Display ExceptionType, CPU information and Image information\r
- // \r
+ //\r
DumpImageAndCpuContent (ExceptionType, SystemContext);\r
//\r
// Release Spinlock of output message\r
\r
@param[in] VectorInfo Pointer to reserved vector list.\r
@param[in, out] ExceptionHandlerData Pointer to exception handler data.\r
- \r
- @retval EFI_SUCCESS CPU Exception Entries have been successfully initialized \r
+\r
+ @retval EFI_SUCCESS CPU Exception Entries have been successfully initialized\r
with default exception handlers.\r
@retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL.\r
@retval EFI_UNSUPPORTED This function is not supported.\r
VOID\r
EFIAPI\r
CommonExceptionHandler (\r
- IN EFI_EXCEPTION_TYPE ExceptionType, \r
+ IN EFI_EXCEPTION_TYPE ExceptionType,\r
IN EFI_SYSTEM_CONTEXT SystemContext\r
)\r
{\r
//\r
// Display ExceptionType, CPU information and Image information\r
- // \r
+ //\r
DumpImageAndCpuContent (ExceptionType, SystemContext);\r
- \r
+\r
//\r
// Enter a dead loop.\r
//\r
\r
/**\r
Initializes all CPU exceptions entries and provides the default exception handlers.\r
- \r
+\r
Caller should try to get an array of interrupt and/or exception vectors that are in use and need to\r
persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification.\r
- If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL. \r
+ If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL.\r
If VectorInfo is not NULL, the exception vectors will be initialized per vector attribute accordingly.\r
- Note: Before invoking this API, caller must allocate memory for IDT table and load \r
+ Note: Before invoking this API, caller must allocate memory for IDT table and load\r
IDTR by AsmWriteIdtr().\r
\r
@param[in] VectorInfo Pointer to reserved vector list.\r
- \r
- @retval EFI_SUCCESS CPU Exception Entries have been successfully initialized \r
+\r
+ @retval EFI_SUCCESS CPU Exception Entries have been successfully initialized\r
with default exception handlers.\r
@retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL.\r
@retval EFI_UNSUPPORTED This function is not supported.\r
IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL\r
)\r
{\r
- EFI_STATUS Status; \r
+ EFI_STATUS Status;\r
RESERVED_VECTORS_DATA ReservedVectorData[CPU_EXCEPTION_NUM];\r
IA32_DESCRIPTOR IdtDescriptor;\r
UINTN IdtEntryCount;\r
\r
/**\r
Initializes all CPU interrupt/exceptions entries and provides the default interrupt/exception handlers.\r
- \r
+\r
Caller should try to get an array of interrupt and/or exception vectors that are in use and need to\r
persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification.\r
- If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL. \r
+ If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL.\r
If VectorInfo is not NULL, the exception vectors will be initialized per vector attribute accordingly.\r
\r
@param[in] VectorInfo Pointer to reserved vector list.\r
- \r
- @retval EFI_SUCCESS All CPU interrupt/exception entries have been successfully initialized \r
+\r
+ @retval EFI_SUCCESS All CPU interrupt/exception entries have been successfully initialized\r
with default interrupt/exception handlers.\r
@retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL.\r
@retval EFI_UNSUPPORTED This function is not supported.\r
/**\r
Registers a function to be called from the processor interrupt handler.\r
\r
- This function registers and enables the handler specified by InterruptHandler for a processor \r
- interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the \r
- handler for the processor interrupt or exception type specified by InterruptType is uninstalled. \r
+ This function registers and enables the handler specified by InterruptHandler for a processor\r
+ interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the\r
+ handler for the processor interrupt or exception type specified by InterruptType is uninstalled.\r
The installed handler is called once for each processor interrupt or exception.\r
NOTE: This function should be invoked after InitializeCpuExceptionHandlers() or\r
InitializeCpuInterruptHandlers() invoked, otherwise EFI_UNSUPPORTED returned.\r
# are licensed and made available under the terms and conditions of the BSD License\r
# which accompanies this distribution. The full text of the license may be found at\r
# http://opensource.org/licenses/bsd-license.php\r
-# \r
+#\r
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-# \r
+#\r
##\r
\r
[Defines]\r
// are licensed and made available under the terms and conditions of the BSD License\r
// which accompanies this distribution. The full text of the license may be found at\r
// http://opensource.org/licenses/bsd-license.php\r
-// \r
+//\r
// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
//\r
# are licensed and made available under the terms and conditions of the BSD License\r
# which accompanies this distribution. The full text of the license may be found at\r
# http://opensource.org/licenses/bsd-license.php\r
-# \r
+#\r
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-# \r
+#\r
##\r
\r
[Defines]\r
// are licensed and made available under the terms and conditions of the BSD License\r
// which accompanies this distribution. The full text of the license may be found at\r
// http://opensource.org/licenses/bsd-license.php\r
-// \r
+//\r
// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
//\r
#include <PiSmm.h>\r
#include "CpuExceptionCommon.h"\r
\r
-CONST UINTN mDoFarReturnFlag = 1; \r
+CONST UINTN mDoFarReturnFlag = 1;\r
\r
//\r
// Spin lock for CPU information display\r
VOID\r
EFIAPI\r
CommonExceptionHandler (\r
- IN EFI_EXCEPTION_TYPE ExceptionType, \r
+ IN EFI_EXCEPTION_TYPE ExceptionType,\r
IN EFI_SYSTEM_CONTEXT SystemContext\r
)\r
{\r
\r
/**\r
Initializes all CPU exceptions entries and provides the default exception handlers.\r
- \r
+\r
Caller should try to get an array of interrupt and/or exception vectors that are in use and need to\r
persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification.\r
- If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL. \r
+ If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL.\r
If VectorInfo is not NULL, the exception vectors will be initialized per vector attribute accordingly.\r
\r
@param[in] VectorInfo Pointer to reserved vector list.\r
- \r
- @retval EFI_SUCCESS CPU Exception Entries have been successfully initialized \r
+\r
+ @retval EFI_SUCCESS CPU Exception Entries have been successfully initialized\r
with default exception handlers.\r
@retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL.\r
@retval EFI_UNSUPPORTED This function is not supported.\r
\r
/**\r
Initializes all CPU interrupt/exceptions entries and provides the default interrupt/exception handlers.\r
- \r
+\r
Caller should try to get an array of interrupt and/or exception vectors that are in use and need to\r
persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification.\r
- If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL. \r
+ If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL.\r
If VectorInfo is not NULL, the exception vectors will be initialized per vector attribute accordingly.\r
\r
@param[in] VectorInfo Pointer to reserved vector list.\r
- \r
- @retval EFI_SUCCESS All CPU interrupt/exception entries have been successfully initialized \r
+\r
+ @retval EFI_SUCCESS All CPU interrupt/exception entries have been successfully initialized\r
with default interrupt/exception handlers.\r
@retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL.\r
@retval EFI_UNSUPPORTED This function is not supported.\r
/**\r
Registers a function to be called from the processor interrupt handler.\r
\r
- This function registers and enables the handler specified by InterruptHandler for a processor \r
- interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the \r
- handler for the processor interrupt or exception type specified by InterruptType is uninstalled. \r
+ This function registers and enables the handler specified by InterruptHandler for a processor\r
+ interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the\r
+ handler for the processor interrupt or exception type specified by InterruptType is uninstalled.\r
The installed handler is called once for each processor interrupt or exception.\r
NOTE: This function should be invoked after InitializeCpuExceptionHandlers() or\r
InitializeCpuInterruptHandlers() invoked, otherwise EFI_UNSUPPORTED returned.\r
{\r
IdtEntry->Bits.OffsetLow = (UINT16)(UINTN)InterruptHandler;\r
IdtEntry->Bits.OffsetHigh = (UINT16)((UINTN)InterruptHandler >> 16);\r
- IdtEntry->Bits.OffsetUpper = (UINT32)((UINTN)InterruptHandler >> 32); \r
+ IdtEntry->Bits.OffsetUpper = (UINT32)((UINTN)InterruptHandler >> 32);\r
IdtEntry->Bits.GateType = IA32_IDT_GATE_TYPE_INTERRUPT_32;\r
}\r
\r
// Clear IF flag to avoid old IDT handler enable interrupt by IRET\r
//\r
Eflags.UintN = SystemContext.SystemContextX64->Rflags;\r
- Eflags.Bits.IF = 0; \r
+ Eflags.Bits.IF = 0;\r
SystemContext.SystemContextX64->Rflags = Eflags.UintN;\r
//\r
// Modify the EIP in stack, then old IDT handler will return to the stub code\r
SystemContext.SystemContextX64->Idtr[1],\r
SystemContext.SystemContextX64->Tr\r
);\r
- InternalPrintMessage (\r
+ InternalPrintMessage (\r
"FXSAVE_STATE - %016lx\n",\r
&SystemContext.SystemContextX64->FxSaveState\r
);\r
.text\r
\r
#ifdef __APPLE__\r
-# macros are different between GNU and Xcode as. \r
-.macro IDT_MACRO \r
+# macros are different between GNU and Xcode as.\r
+.macro IDT_MACRO\r
push $0\r
#else\r
.macro IDT_MACRO arg\r
HookAfterStubHeaderBegin:\r
.byte 0x6a # push\r
PatchVectorNum:\r
- .byte 0 # 0 will be fixed \r
+ .byte 0 # 0 will be fixed\r
.byte 0xe9 # jmp ASM_PFX(HookAfterStubHeaderEnd)\r
PatchFuncAddress:\r
.set HOOK_ADDRESS, ASM_PFX(HookAfterStubHeaderEnd) - . - 4\r
movq %cr8, %rax\r
pushq %rax\r
movq %cr4, %rax\r
- orq $0x208, %rax \r
- movq %rax, %cr4 \r
+ orq $0x208, %rax\r
+ movq %rax, %cr4\r
pushq %rax\r
- mov %cr3, %rax \r
+ mov %cr3, %rax\r
pushq %rax\r
- mov %cr2, %rax \r
+ mov %cr2, %rax\r
pushq %rax\r
xorq %rax, %rax\r
pushq %rax\r
- mov %cr0, %rax \r
+ mov %cr0, %rax\r
pushq %rax\r
\r
#; UINT64 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;\r
# Per X64 calling convention, allocate maximum parameter stack space\r
# and make sure RSP is 16-byte aligned\r
#\r
- subq $40, %rsp \r
+ subq $40, %rsp\r
call ASM_PFX(CommonExceptionHandler)\r
addq $40, %rsp\r
\r
HookAfterStubHeaderBegin:\r
db 6ah ; push\r
@VectorNum:\r
- db 0 ; 0 will be fixed \r
+ db 0 ; 0 will be fixed\r
push rax\r
mov rax, HookAfterStubHeaderEnd\r
jmp rax\r
; + RBP +\r
; +---------------------+ <-- RBP, 16-byte aligned\r
; The follow algorithm is used for the common interrupt routine.\r
-CommonInterruptEntry PROC PUBLIC \r
+CommonInterruptEntry PROC PUBLIC\r
cli\r
pop rax\r
;\r
;\r
push [rsp]\r
mov qword ptr [rsp + 8], 0\r
-@@: \r
+@@:\r
push rbp\r
mov rbp, rsp\r
push 0 ; clear EXCEPTION_HANDLER_CONTEXT.OldIdtHandler\r
jz DoIret\r
push rax\r
mov rax, rsp ; save old RSP to rax\r
- mov rsp, [rsp + 20h] \r
+ mov rsp, [rsp + 20h]\r
push [rax + 10h] ; save CS in new location\r
push [rax + 8h] ; save EIP in new location\r
push [rax + 18h] ; save EFLAGS in new location\r