TianoCore EDK2 master
Loading...
Searching...
No Matches
ArchExceptionHandlerTest.c File Reference

Go to the source code of this file.

Functions

VOID EFIAPI AdjustRipForFaultHandler (IN EFI_EXCEPTION_TYPE ExceptionType, IN EFI_SYSTEM_CONTEXT SystemContext)
 
VOID EFIAPI AdjustCpuContextHandler (IN EFI_EXCEPTION_TYPE ExceptionType, IN EFI_SYSTEM_CONTEXT SystemContext)
 
UNIT_TEST_STATUS CompareCpuContext (VOID)
 
VOID EFIAPI CpuStackGuardExceptionHandler (IN EFI_EXCEPTION_TYPE ExceptionType, IN EFI_SYSTEM_CONTEXT SystemContext)
 

Variables

GENERAL_REGISTER_IA32 mActualContextInHandler
 
GENERAL_REGISTER_IA32 mActualContextAfterException
 
GENERAL_REGISTER_IA32 mExpectedContextInHandler = { 1, 2, 3, 4, 5, 0 }
 
GENERAL_REGISTER_IA32 mExpectedContextAfterException = { 11, 12, 13, 14, 15, 16 }
 

Detailed Description

Unit tests of the CpuExceptionHandlerLib.

Copyright (c) 2022, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file ArchExceptionHandlerTest.c.

Function Documentation

◆ AdjustCpuContextHandler()

VOID EFIAPI AdjustCpuContextHandler ( IN EFI_EXCEPTION_TYPE  ExceptionType,
IN EFI_SYSTEM_CONTEXT  SystemContext 
)

Special handler for ConsistencyOfCpuContext test case.

Parameters
ExceptionTypeException type.
SystemContextPointer to EFI_SYSTEM_CONTEXT.

Definition at line 49 of file ArchExceptionHandlerTest.c.

◆ AdjustRipForFaultHandler()

VOID EFIAPI AdjustRipForFaultHandler ( IN EFI_EXCEPTION_TYPE  ExceptionType,
IN EFI_SYSTEM_CONTEXT  SystemContext 
)

Special handler for fault exception. Rip/Eip in SystemContext will be modified to the instruction after the exception instruction.

Parameters
ExceptionTypeException type.
SystemContextPointer to EFI_SYSTEM_CONTEXT.

Definition at line 32 of file ArchExceptionHandlerTest.c.

◆ CompareCpuContext()

UNIT_TEST_STATUS CompareCpuContext ( VOID  )

Compare cpu context in ConsistencyOfCpuContext test case. 1.Compare mActualContextInHandler with mExpectedContextInHandler. 2.Compare mActualContextAfterException with mExpectedContextAfterException.

Return values
UNIT_TEST_PASSEDThe Unit test has completed and it was successful.
UNIT_TEST_ERROR_TEST_FAILEDA test case assertion has failed.

Definition at line 94 of file ArchExceptionHandlerTest.c.

◆ CpuStackGuardExceptionHandler()

VOID EFIAPI CpuStackGuardExceptionHandler ( IN EFI_EXCEPTION_TYPE  ExceptionType,
IN EFI_SYSTEM_CONTEXT  SystemContext 
)

Special handler for CpuStackGuard test case.

Parameters
ExceptionTypeException type.
SystemContextPointer to EFI_SYSTEM_CONTEXT.

Definition at line 123 of file ArchExceptionHandlerTest.c.

Variable Documentation

◆ mActualContextAfterException

GENERAL_REGISTER_IA32 mActualContextAfterException

Definition at line 12 of file ArchExceptionHandlerTest.c.

◆ mActualContextInHandler

GENERAL_REGISTER_IA32 mActualContextInHandler

Definition at line 11 of file ArchExceptionHandlerTest.c.

◆ mExpectedContextAfterException

GENERAL_REGISTER_IA32 mExpectedContextAfterException = { 11, 12, 13, 14, 15, 16 }

Definition at line 20 of file ArchExceptionHandlerTest.c.

◆ mExpectedContextInHandler

GENERAL_REGISTER_IA32 mExpectedContextInHandler = { 1, 2, 3, 4, 5, 0 }

Definition at line 19 of file ArchExceptionHandlerTest.c.