19GENERAL_REGISTER mExpectedContextInHandler = { 1, 2, 3, 4, 5, 0, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe };
20GENERAL_REGISTER mExpectedContextAfterException = { 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e };
36 mExceptionType = ExceptionType;
37 SystemContext.SystemContextX64->Rip += mFaultInstructionLength;
56 mActualContextInHandler.Rdi = SystemContext.SystemContextX64->Rdi;
57 mActualContextInHandler.Rsi = SystemContext.SystemContextX64->Rsi;
58 mActualContextInHandler.Rbx = SystemContext.SystemContextX64->Rbx;
59 mActualContextInHandler.Rdx = SystemContext.SystemContextX64->Rdx;
60 mActualContextInHandler.Rcx = SystemContext.SystemContextX64->Rcx;
61 mActualContextInHandler.Rax = SystemContext.SystemContextX64->Rax;
62 mActualContextInHandler.R8 = SystemContext.SystemContextX64->R8;
63 mActualContextInHandler.R9 = SystemContext.SystemContextX64->R9;
64 mActualContextInHandler.R10 = SystemContext.SystemContextX64->R10;
65 mActualContextInHandler.R11 = SystemContext.SystemContextX64->R11;
66 mActualContextInHandler.R12 = SystemContext.SystemContextX64->R12;
67 mActualContextInHandler.R13 = SystemContext.SystemContextX64->R13;
68 mActualContextInHandler.R14 = SystemContext.SystemContextX64->R14;
69 mActualContextInHandler.R15 = SystemContext.SystemContextX64->R15;
76 SystemContext.SystemContextX64->Rdi = mExpectedContextAfterException.Rdi;
77 SystemContext.SystemContextX64->Rsi = mExpectedContextAfterException.Rsi;
78 SystemContext.SystemContextX64->Rbx = mExpectedContextAfterException.Rbx;
79 SystemContext.SystemContextX64->Rdx = mExpectedContextAfterException.Rdx;
80 SystemContext.SystemContextX64->Rcx = mExpectedContextAfterException.Rcx;
81 SystemContext.SystemContextX64->Rax = mExpectedContextAfterException.Rax;
82 SystemContext.SystemContextX64->R8 = mExpectedContextAfterException.R8;
83 SystemContext.SystemContextX64->R9 = mExpectedContextAfterException.R9;
84 SystemContext.SystemContextX64->R10 = mExpectedContextAfterException.R10;
85 SystemContext.SystemContextX64->R11 = mExpectedContextAfterException.R11;
86 SystemContext.SystemContextX64->R12 = mExpectedContextAfterException.R12;
87 SystemContext.SystemContextX64->R13 = mExpectedContextAfterException.R13;
88 SystemContext.SystemContextX64->R14 = mExpectedContextAfterException.R14;
89 SystemContext.SystemContextX64->R15 = mExpectedContextAfterException.R15;
95 if ((ExceptionType == EXCEPT_IA32_PAGE_FAULT) || (ExceptionType == EXCEPT_IA32_GP_FAULT)) {
113 UT_ASSERT_EQUAL (mActualContextInHandler.Rdi, mExpectedContextInHandler.Rdi);
114 UT_ASSERT_EQUAL (mActualContextInHandler.Rsi, mExpectedContextInHandler.Rsi);
115 UT_ASSERT_EQUAL (mActualContextInHandler.Rbx, mExpectedContextInHandler.Rbx);
116 UT_ASSERT_EQUAL (mActualContextInHandler.Rdx, mExpectedContextInHandler.Rdx);
117 UT_ASSERT_EQUAL (mActualContextInHandler.Rcx, mExpectedContextInHandler.Rcx);
118 UT_ASSERT_EQUAL (mActualContextInHandler.Rax, mExpectedContextInHandler.Rax);
119 UT_ASSERT_EQUAL (mActualContextInHandler.R8, mExpectedContextInHandler.R8);
120 UT_ASSERT_EQUAL (mActualContextInHandler.R9, mExpectedContextInHandler.R9);
121 UT_ASSERT_EQUAL (mActualContextInHandler.R10, mExpectedContextInHandler.R10);
122 UT_ASSERT_EQUAL (mActualContextInHandler.R11, mExpectedContextInHandler.R11);
123 UT_ASSERT_EQUAL (mActualContextInHandler.R12, mExpectedContextInHandler.R12);
124 UT_ASSERT_EQUAL (mActualContextInHandler.R13, mExpectedContextInHandler.R13);
125 UT_ASSERT_EQUAL (mActualContextInHandler.R14, mExpectedContextInHandler.R14);
126 UT_ASSERT_EQUAL (mActualContextInHandler.R15, mExpectedContextInHandler.R15);
128 UT_ASSERT_EQUAL (mActualContextAfterException.Rdi, mExpectedContextAfterException.Rdi);
129 UT_ASSERT_EQUAL (mActualContextAfterException.Rsi, mExpectedContextAfterException.Rsi);
130 UT_ASSERT_EQUAL (mActualContextAfterException.Rbx, mExpectedContextAfterException.Rbx);
131 UT_ASSERT_EQUAL (mActualContextAfterException.Rdx, mExpectedContextAfterException.Rdx);
132 UT_ASSERT_EQUAL (mActualContextAfterException.Rcx, mExpectedContextAfterException.Rcx);
133 UT_ASSERT_EQUAL (mActualContextAfterException.Rax, mExpectedContextAfterException.Rax);
134 UT_ASSERT_EQUAL (mActualContextAfterException.R8, mExpectedContextAfterException.R8);
135 UT_ASSERT_EQUAL (mActualContextAfterException.R9, mExpectedContextAfterException.R9);
136 UT_ASSERT_EQUAL (mActualContextAfterException.R10, mExpectedContextAfterException.R10);
137 UT_ASSERT_EQUAL (mActualContextAfterException.R11, mExpectedContextAfterException.R11);
138 UT_ASSERT_EQUAL (mActualContextAfterException.R12, mExpectedContextAfterException.R12);
139 UT_ASSERT_EQUAL (mActualContextAfterException.R13, mExpectedContextAfterException.R13);
140 UT_ASSERT_EQUAL (mActualContextAfterException.R14, mExpectedContextAfterException.R14);
141 UT_ASSERT_EQUAL (mActualContextAfterException.R15, mExpectedContextAfterException.R15);
142 return UNIT_TEST_PASSED;
162 mRspAddress[0] = (
UINTN)SystemContext.SystemContextX64->Rsp;
163 mRspAddress[1] = (
UINTN)(&LocalVariable);
VOID EFIAPI AdjustCpuContextHandler(IN EFI_EXCEPTION_TYPE ExceptionType, IN EFI_SYSTEM_CONTEXT SystemContext)
VOID EFIAPI AdjustRipForFaultHandler(IN EFI_EXCEPTION_TYPE ExceptionType, IN EFI_SYSTEM_CONTEXT SystemContext)
VOID EFIAPI CpuStackGuardExceptionHandler(IN EFI_EXCEPTION_TYPE ExceptionType, IN EFI_SYSTEM_CONTEXT SystemContext)
UNIT_TEST_STATUS CompareCpuContext(VOID)
#define UT_ASSERT_EQUAL(ValueA, ValueB)