mirror of https://github.com/acidanthera/audk.git
UefiCpuPkg/CpuExceptionHandlerLib: Trim white space at end of line
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com>
This commit is contained in:
parent
c54a6e6feb
commit
dd56374250
|
@ -1,4 +1,4 @@
|
|||
/** @file
|
||||
/** @file
|
||||
CPU Exception Handler Library common functions.
|
||||
|
||||
Copyright (c) 2012 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
|
@ -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
|
||||
)
|
||||
|
|
|
@ -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
|
||||
);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
//
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
#-----------------------------------------------------------------------------;
|
||||
#-------------------------------------------------------------------------------------
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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.
|
||||
//
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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.
|
||||
//
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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.
|
||||
//
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include <PiSmm.h>
|
||||
#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.
|
||||
|
|
|
@ -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
|
||||
);
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue