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 mActualContextInHandler
 
GENERAL_REGISTER mActualContextAfterException
 
GENERAL_REGISTER mExpectedContextInHandler = { 1, 2, 3, 4, 5, 0, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe }
 
GENERAL_REGISTER mExpectedContextAfterException = { 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e }
 

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 48 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 31 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 mActualContextAfterException.

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 109 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 154 of file ArchExceptionHandlerTest.c.

Variable Documentation

◆ mActualContextAfterException

GENERAL_REGISTER mActualContextAfterException

Definition at line 12 of file ArchExceptionHandlerTest.c.

◆ mActualContextInHandler

GENERAL_REGISTER mActualContextInHandler

Definition at line 11 of file ArchExceptionHandlerTest.c.

◆ mExpectedContextAfterException

GENERAL_REGISTER mExpectedContextAfterException = { 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e }

Definition at line 20 of file ArchExceptionHandlerTest.c.

◆ mExpectedContextInHandler

GENERAL_REGISTER mExpectedContextInHandler = { 1, 2, 3, 4, 5, 0, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe }

Definition at line 19 of file ArchExceptionHandlerTest.c.