TianoCore EDK2 master
|
#include "CpuExceptionHandlerTest.h"
Go to the source code of this file.
Variables | |
UINTN | mFaultInstructionLength = 0 |
EFI_EXCEPTION_TYPE | mExceptionType = 256 |
UINTN | mNumberOfProcessors = 1 |
UINTN | mRspAddress [2] = { 0 } |
CONST UINT32 | mErrorCodeExceptionFlag = 0x20227d00 |
Unit tests of the CpuExceptionHandlerLib.
Copyright (c) 2022, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file CpuExceptionHandlerTestCommon.c.
EFI_STATUS AddCommonTestCase | ( | IN UNIT_TEST_FRAMEWORK_HANDLE | Framework | ) |
Create CpuExceptionLibUnitTestSuite and add test case.
[in] | FrameworkHandle | Unit test framework. |
EFI_OUT_OF_RESOURCES | There are not enough resources available to initialize the unit test suite. |
Definition at line 828 of file CpuExceptionHandlerTestCommon.c.
Find not present or ReadOnly address in page table.
[out] | PFAddress | Access to the address which is not permitted will trigger PF exceptions. |
TRUE | Found not present or ReadOnly address in page table. |
FALSE | Failed to found PFAddress in page table. |
Definition at line 382 of file CpuExceptionHandlerTestCommon.c.
UINTN * GetAllCpuStackBase | ( | MP_SERVICES * | MpServices, |
UINTN | BspProcessorNum | ||
) |
Get all Cpu stack base.
[in] | MpServices | MpServices. |
[in] | BspProcessorNum | Bsp processor number. |
Definition at line 340 of file CpuExceptionHandlerTestCommon.c.
Get Bsp stack base.
[out] | StackBase | Pointer to stack base of BSP. |
Definition at line 277 of file CpuExceptionHandlerTestCommon.c.
VOID EFIAPI GetStackBasePerAp | ( | OUT VOID * | ApStackBase | ) |
Get Ap stack base procedure.
[out] | ApStackBase | Pointer to Ap stack base. |
Definition at line 321 of file CpuExceptionHandlerTestCommon.c.
VOID InitializeApIdt | ( | MP_SERVICES | MpServices, |
VOID * | BspIdtr | ||
) |
Initialize all Ap Idt.
[in] | MpServices | MpServices. |
[in] | BspIdtr | Pointer to IA32_DESCRIPTOR allocated by Bsp. |
Definition at line 199 of file CpuExceptionHandlerTestCommon.c.
Initializes CPU exceptions handlers for the sake of stack switch requirement.
This function is a wrapper of InitializeSeparateExceptionStacks. It's mainly for the sake of AP's init because of EFI_AP_PROCEDURE API requirement.
[in,out] | Buffer | The pointer to private data buffer. |
Definition at line 595 of file CpuExceptionHandlerTestCommon.c.
VOID EFIAPI InitializeIdtPerAp | ( | IN VOID * | Buffer | ) |
Initialize Ap Idt Procedure.
[in] | Buffer | Argument of the procedure. |
Definition at line 185 of file CpuExceptionHandlerTestCommon.c.
EXCEPTION_STACK_SWITCH_CONTEXT * InitializeMpExceptionStackSwitchHandlers | ( | MP_SERVICES | MpServices, |
UINTN | BspProcessorNum | ||
) |
Initializes MP exceptions handlers for the sake of stack switch requirement.
This function will allocate required resources required to setup stack switch and pass them through SwitchStackData to each logic processor.
[in,out] | MpServices | MpServices. |
[in,out] | BspProcessorNum | Bsp processor number. |
Definition at line 624 of file CpuExceptionHandlerTestCommon.c.
VOID EFIAPI INTnExceptionHandler | ( | IN EFI_EXCEPTION_TYPE | ExceptionType, |
IN EFI_SYSTEM_CONTEXT | SystemContext | ||
) |
Special handler for exception triggered by INTn instruction. This hanlder only modifies a global variable for check.
ExceptionType | Exception type. |
SystemContext | Pointer to EFI_SYSTEM_CONTEXT. |
Definition at line 36 of file CpuExceptionHandlerTestCommon.c.
VOID RestoreAllCpuRegisters | ( | MP_SERVICES * | MpServices, |
OPTIONAL CPU_REGISTER_BUFFER * | CpuOriginalRegisterBuffer, | ||
UINTN | BspProcessorNum | ||
) |
Restore cpu original registers before exit test case.
[in] | MpServices | MpServices. |
[in] | CpuOriginalRegisterBuffer | Address of CpuOriginalRegisterBuffer. |
[in] | BspProcessorNum | Bsp processor number. |
Definition at line 84 of file CpuExceptionHandlerTestCommon.c.
VOID EFIAPI RestoreRegistersPerCpu | ( | IN VOID * | Buffer | ) |
Restore cpu original registers before exit test case.
[in] | Buffer | Argument of the procedure. |
Definition at line 51 of file CpuExceptionHandlerTestCommon.c.
CPU_REGISTER_BUFFER * SaveAllCpuRegisters | ( | MP_SERVICES * | MpServices, |
OPTIONAL UINTN | BspProcessorNum | ||
) |
Store cpu registers before the test case starts.
[in] | MpServices | MpServices. |
[in] | BspProcessorNum | Bsp processor number. |
Definition at line 146 of file CpuExceptionHandlerTestCommon.c.
VOID EFIAPI SaveRegisterPerCpu | ( | IN VOID * | Buffer | ) |
Store cpu registers before the test case starts.
[in] | Buffer | Argument of the procedure. |
Definition at line 118 of file CpuExceptionHandlerTestCommon.c.
UNIT_TEST_STATUS EFIAPI TestCpuContextConsistency | ( | IN UNIT_TEST_CONTEXT | Context | ) |
Test if Cpu Context is consistent before and after exception.
[in] | Context | [Optional] An optional parameter that enables: 1) test-case reuse with varied parameters and 2) test-case re-entry for Target tests that need a reboot. This parameter is a VOID* and it is the responsibility of the test author to ensure that the contents are well understood by all test cases that may consume it. |
UNIT_TEST_PASSED | The Unit test has completed and the test case was successful. |
UNIT_TEST_ERROR_TEST_FAILED | A test case assertion has failed. |
Definition at line 536 of file CpuExceptionHandlerTestCommon.c.
UNIT_TEST_STATUS EFIAPI TestCpuStackGuardInBspAndAp | ( | IN UNIT_TEST_CONTEXT | Context | ) |
Test if stack overflow is captured by CpuStackGuard in both Bsp and AP.
[in] | Context | [Optional] An optional parameter that enables: 1) test-case reuse with varied parameters and 2) test-case re-entry for Target tests that need a reboot. This parameter is a VOID* and it is the responsibility of the test author to ensure that the contents are well understood by all test cases that may consume it. |
UNIT_TEST_PASSED | The Unit test has completed and the test case was successful. |
UNIT_TEST_ERROR_TEST_FAILED | A test case assertion has failed. |
Definition at line 728 of file CpuExceptionHandlerTestCommon.c.
UNIT_TEST_STATUS EFIAPI TestRegisterHandlerForGPAndPF | ( | IN UNIT_TEST_CONTEXT | Context | ) |
Test if exception handler can registered/unregistered for GP and PF.
[in] | Context | [Optional] An optional parameter that enables: 1) test-case reuse with varied parameters and 2) test-case re-entry for Target tests that need a reboot. This parameter is a VOID* and it is the responsibility of the test author to ensure that the contents are well understood by all test cases that may consume it. |
UNIT_TEST_PASSED | The Unit test has completed and the test case was successful. |
UNIT_TEST_ERROR_TEST_FAILED | A test case assertion has failed. |
Definition at line 471 of file CpuExceptionHandlerTestCommon.c.
UNIT_TEST_STATUS EFIAPI TestRegisterHandlerForNoErrorCodeException | ( | IN UNIT_TEST_CONTEXT | Context | ) |
Check if exception handler can registered/unregistered for no error code exception.
[in] | Context | [Optional] An optional parameter that enables: 1) test-case reuse with varied parameters and 2) test-case re-entry for Target tests that need a reboot. This parameter is a VOID* and it is the responsibility of the test author to ensure that the contents are well understood by all test cases that may consume it. |
UNIT_TEST_PASSED | The Unit test has completed and the test case was successful. |
UNIT_TEST_ERROR_TEST_FAILED | A test case assertion has failed. |
Definition at line 233 of file CpuExceptionHandlerTestCommon.c.
CONST UINT32 mErrorCodeExceptionFlag = 0x20227d00 |
Definition at line 25 of file CpuExceptionHandlerTestCommon.c.
EFI_EXCEPTION_TYPE mExceptionType = 256 |
Definition at line 15 of file CpuExceptionHandlerTestCommon.c.
UINTN mFaultInstructionLength = 0 |
Definition at line 14 of file CpuExceptionHandlerTestCommon.c.
UINTN mNumberOfProcessors = 1 |
Definition at line 16 of file CpuExceptionHandlerTestCommon.c.
UINTN mRspAddress[2] = { 0 } |
Definition at line 17 of file CpuExceptionHandlerTestCommon.c.