TianoCore EDK2 master
Loading...
Searching...
No Matches
CpuExceptionHandlerTest.h
Go to the documentation of this file.
1
35#ifndef CPU_EXCEPTION_HANDLER_TEST_H_
36#define CPU_EXCEPTION_HANDLER_TEST_H_
37
38#include <Uefi.h>
39#include <Library/BaseLib.h>
41#include <Library/DebugLib.h>
42#include <Library/UnitTestLib.h>
46#include <Library/UefiLib.h>
48#include <Library/HobLib.h>
51#include <Protocol/MpService.h>
52#include <PiPei.h>
53#include <Ppi/MpServices2.h>
54
55#define UNIT_TEST_APP_NAME "Cpu Exception Handler Lib Unit Tests"
56#define UNIT_TEST_APP_VERSION "1.0"
57
58#define CPU_INTERRUPT_NUM 256
59#define SPEC_MAX_EXCEPTION_NUM 22
60#define CR4_RESERVED_BIT BIT15
61
62typedef struct {
63 IA32_DESCRIPTOR OriginalGdtr;
64 IA32_DESCRIPTOR OriginalIdtr;
65 UINT16 Tr;
67
68typedef union {
72
73typedef struct {
74 VOID *Buffer;
75 UINTN BufferSize;
76 EFI_STATUS Status;
78
79typedef struct {
80 UINT64 Rdi;
81 UINT64 Rsi;
82 UINT64 Rbx;
83 UINT64 Rdx;
84 UINT64 Rcx;
85 UINT64 Rax;
86 UINT64 R8;
87 UINT64 R9;
88 UINT64 R10;
89 UINT64 R11;
90 UINT64 R12;
91 UINT64 R13;
92 UINT64 R14;
93 UINT64 R15;
95
96typedef struct {
97 UINT32 Edi;
98 UINT32 Esi;
99 UINT32 Ebx;
100 UINT32 Edx;
101 UINT32 Ecx;
102 UINT32 Eax;
104
105extern UINTN mFaultInstructionLength;
106extern EFI_EXCEPTION_TYPE mExceptionType;
107extern UINTN mRspAddress[];
108
115VOID *
117 VOID
118 );
119
125VOID
126EFIAPI
128 IN EFI_EXCEPTION_TYPE ExceptionType
129 );
130
136VOID
137EFIAPI
139 UINTN Cr4ReservedBit
140 );
141
147VOID
148EFIAPI
150 UINTN PFAddress
151 );
152
160VOID
161EFIAPI
163 IN EFI_EXCEPTION_TYPE ExceptionType,
164 IN EFI_SYSTEM_CONTEXT SystemContext
165 );
166
180VOID
181EFIAPI
183 IN EFI_EXCEPTION_TYPE ExceptionType,
184 IN UINTN FaultParameter OPTIONAL
185 );
186
194VOID
195EFIAPI
197 IN EFI_EXCEPTION_TYPE ExceptionType,
198 IN EFI_SYSTEM_CONTEXT SystemContext
199 );
200
211 VOID
212 );
213
224 OUT MP_SERVICES *MpServices
225 );
226
238 IN UNIT_TEST_FRAMEWORK_HANDLE Framework
239 );
240
259 IN MP_SERVICES MpServices,
260 IN EFI_AP_PROCEDURE Procedure,
261 IN BOOLEAN SingleThread,
262 IN UINTN TimeoutInMicroSeconds,
263 IN VOID *ProcedureArgument
264 );
265
282 IN MP_SERVICES MpServices,
283 IN EFI_AP_PROCEDURE Procedure,
284 IN UINTN ProcessorNumber,
285 IN UINTN TimeoutInMicroSeconds,
286 IN VOID *ProcedureArgument
287 );
288
300 IN MP_SERVICES MpServices,
301 OUT UINTN *ProcessorNumber
302 );
303
318 IN MP_SERVICES MpServices,
319 OUT UINTN *NumberOfProcessors,
320 OUT UINTN *NumberOfEnabledProcessors
321 );
322
326VOID
327EFIAPI
329 VOID
330 );
331
338VOID
339EFIAPI
341 IN EFI_EXCEPTION_TYPE ExceptionType,
342 IN EFI_SYSTEM_CONTEXT SystemContext
343 );
344
345#endif
UINT64 UINTN
EFI_STATUS MpServicesUnitTestWhoAmI(IN MP_SERVICES MpServices, OUT UINTN *ProcessorNumber)
VOID EFIAPI AdjustCpuContextHandler(IN EFI_EXCEPTION_TYPE ExceptionType, IN EFI_SYSTEM_CONTEXT SystemContext)
VOID EFIAPI TriggerINTnException(IN EFI_EXCEPTION_TYPE ExceptionType)
VOID EFIAPI TriggerStackOverflow(VOID)
VOID EFIAPI AsmTestConsistencyOfCpuContext(IN EFI_EXCEPTION_TYPE ExceptionType, IN UINTN FaultParameter OPTIONAL)
EFI_STATUS MpServicesUnitTestStartupAllAPs(IN MP_SERVICES MpServices, IN EFI_AP_PROCEDURE Procedure, IN BOOLEAN SingleThread, IN UINTN TimeoutInMicroSeconds, IN VOID *ProcedureArgument)
EFI_STATUS GetMpServices(OUT MP_SERVICES *MpServices)
EFI_STATUS MpServicesUnitTestGetNumberOfProcessors(IN MP_SERVICES MpServices, OUT UINTN *NumberOfProcessors, OUT UINTN *NumberOfEnabledProcessors)
VOID EFIAPI AdjustRipForFaultHandler(IN EFI_EXCEPTION_TYPE ExceptionType, IN EFI_SYSTEM_CONTEXT SystemContext)
EFI_STATUS AddCommonTestCase(IN UNIT_TEST_FRAMEWORK_HANDLE Framework)
VOID EFIAPI CpuStackGuardExceptionHandler(IN EFI_EXCEPTION_TYPE ExceptionType, IN EFI_SYSTEM_CONTEXT SystemContext)
VOID EFIAPI TriggerPFException(UINTN PFAddress)
VOID EFIAPI TriggerGPException(UINTN Cr4ReservedBit)
UNIT_TEST_STATUS CompareCpuContext(VOID)
EFI_STATUS MpServicesUnitTestStartupThisAP(IN MP_SERVICES MpServices, IN EFI_AP_PROCEDURE Procedure, IN UINTN ProcessorNumber, IN UINTN TimeoutInMicroSeconds, IN VOID *ProcedureArgument)
VOID * InitializeBspIdt(VOID)
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
INTN EFI_EXCEPTION_TYPE
Definition: DebugSupport.h:35
VOID(EFIAPI * EFI_AP_PROCEDURE)(IN OUT VOID *Buffer)
Definition: PiMultiPhase.h:198
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
UINT32 UNIT_TEST_STATUS
Definition: UnitTestLib.h:16