11extern CONST UINT8 m16Start;
12extern CONST UINT16 m16Size;
13extern CONST UINT16 mThunk16Attr;
14extern CONST UINT16 m16Gdt;
15extern CONST UINT16 m16GdtrBase;
16extern CONST UINT16 mTransition;
35 IN IA32_REGISTER_SET *RegisterSet,
36 IN OUT VOID *Transition
63 OUT UINT32 *RealModeBufferSize,
64 OUT UINT32 *ExtraStackSize
67 ASSERT (RealModeBufferSize !=
NULL);
68 ASSERT (ExtraStackSize !=
NULL);
70 *RealModeBufferSize = m16Size;
75 *ExtraStackSize =
sizeof (IA32_DWORD_REGS) + 8;
95 IN OUT THUNK_CONTEXT *ThunkContext
98 IA32_SEGMENT_DESCRIPTOR *RealModeGdt;
100 ASSERT (ThunkContext !=
NULL);
101 ASSERT ((
UINTN)ThunkContext->RealModeBuffer < 0x100000);
102 ASSERT (ThunkContext->RealModeBufferSize >= m16Size);
103 ASSERT ((
UINTN)ThunkContext->RealModeBuffer + m16Size <= 0x100000);
105 CopyMem (ThunkContext->RealModeBuffer, &m16Start, m16Size);
115 RealModeGdt = (IA32_SEGMENT_DESCRIPTOR *)(
116 (
UINTN)ThunkContext->RealModeBuffer + m16Gdt);
121 RealModeGdt[1].Bits.BaseLow =
122 (UINT32)(
UINTN)ThunkContext->RealModeBuffer & ~0xf;
123 RealModeGdt[1].Bits.BaseMid =
124 (UINT32)(
UINTN)ThunkContext->RealModeBuffer >> 16;
129 *(UINT32 *)((
UINTN)ThunkContext->RealModeBuffer + mTransition) +=
130 (UINT32)(
UINTN)ThunkContext->RealModeBuffer & 0xf;
135 if ((ThunkContext->ThunkAttributes & THUNK_ATTRIBUTE_BIG_REAL_MODE) == 0) {
139 RealModeGdt[1].Bits.LimitHigh = 0;
140 RealModeGdt[1].Bits.G = 0;
141 RealModeGdt[2].Bits.LimitHigh = 0;
142 RealModeGdt[2].Bits.G = 0;
148 *(VOID **)((
UINTN)ThunkContext->RealModeBuffer + m16GdtrBase) = RealModeGdt;
153 *(UINT32 *)((
UINTN)ThunkContext->RealModeBuffer + mThunk16Attr) =
154 ThunkContext->ThunkAttributes;
213 IN OUT THUNK_CONTEXT *ThunkContext
216 IA32_REGISTER_SET *UpdatedRegs;
218 ASSERT (ThunkContext !=
NULL);
219 ASSERT ((
UINTN)ThunkContext->RealModeBuffer < 0x100000);
220 ASSERT (ThunkContext->RealModeBufferSize >= m16Size);
221 ASSERT ((
UINTN)ThunkContext->RealModeBuffer + m16Size <= 0x100000);
223 ((ThunkContext->ThunkAttributes & (THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 | THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL)) != \
224 (THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 | THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL))
228 ThunkContext->RealModeState,
229 ThunkContext->RealModeBuffer
232 CopyMem (ThunkContext->RealModeState, UpdatedRegs, sizeof (*UpdatedRegs));
258 IN OUT THUNK_CONTEXT *ThunkContext
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID EFIAPI AsmGetThunk16Properties(OUT UINT32 *RealModeBufferSize, OUT UINT32 *ExtraStackSize)
VOID EFIAPI AsmPrepareThunk16(IN OUT THUNK_CONTEXT *ThunkContext)
VOID EFIAPI AsmPrepareAndThunk16(IN OUT THUNK_CONTEXT *ThunkContext)
VOID EFIAPI AsmThunk16(IN OUT THUNK_CONTEXT *ThunkContext)
IA32_REGISTER_SET *EFIAPI InternalAsmThunk16(IN IA32_REGISTER_SET *RegisterSet, IN OUT VOID *Transition)