aboutsummaryrefslogtreecommitdiff
path: root/MdePkg/Library/BaseLib/X86Thunk.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdePkg/Library/BaseLib/X86Thunk.c')
-rw-r--r--MdePkg/Library/BaseLib/X86Thunk.c70
1 files changed, 32 insertions, 38 deletions
diff --git a/MdePkg/Library/BaseLib/X86Thunk.c b/MdePkg/Library/BaseLib/X86Thunk.c
index f0f801ed126b..eec3d9418621 100644
--- a/MdePkg/Library/BaseLib/X86Thunk.c
+++ b/MdePkg/Library/BaseLib/X86Thunk.c
@@ -1,14 +1,8 @@
/** @file
Real Mode Thunk Functions for IA32 and x64.
- Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -86,7 +80,7 @@ AsmGetThunk16Properties (
Prepares all structures a code required to use AsmThunk16().
Prepares all structures and code required to use AsmThunk16().
-
+
This interface is limited to be used in either physical mode or virtual modes with paging enabled where the
virtual to physical mappings for ThunkContext.RealModeBuffer is mapped 1:1.
@@ -168,48 +162,48 @@ AsmPrepareThunk16 (
AsmPrepareThunk16() must be called with ThunkContext before this function is used.
This function must be called with interrupts disabled.
- The register state from the RealModeState field of ThunkContext is restored just prior
- to calling the 16-bit real mode entry point. This includes the EFLAGS field of RealModeState,
+ The register state from the RealModeState field of ThunkContext is restored just prior
+ to calling the 16-bit real mode entry point. This includes the EFLAGS field of RealModeState,
which is used to set the interrupt state when a 16-bit real mode entry point is called.
Control is transferred to the 16-bit real mode entry point specified by the CS and Eip fields of RealModeState.
- The stack is initialized to the SS and ESP fields of RealModeState. Any parameters passed to
- the 16-bit real mode code must be populated by the caller at SS:ESP prior to calling this function.
+ The stack is initialized to the SS and ESP fields of RealModeState. Any parameters passed to
+ the 16-bit real mode code must be populated by the caller at SS:ESP prior to calling this function.
The 16-bit real mode entry point is invoked with a 16-bit CALL FAR instruction,
- so when accessing stack contents, the 16-bit real mode code must account for the 16-bit segment
- and 16-bit offset of the return address that were pushed onto the stack. The 16-bit real mode entry
- point must exit with a RETF instruction. The register state is captured into RealModeState immediately
+ so when accessing stack contents, the 16-bit real mode code must account for the 16-bit segment
+ and 16-bit offset of the return address that were pushed onto the stack. The 16-bit real mode entry
+ point must exit with a RETF instruction. The register state is captured into RealModeState immediately
after the RETF instruction is executed.
-
- If EFLAGS specifies interrupts enabled, or any of the 16-bit real mode code enables interrupts,
- or any of the 16-bit real mode code makes a SW interrupt, then the caller is responsible for making sure
- the IDT at address 0 is initialized to handle any HW or SW interrupts that may occur while in 16-bit real mode.
-
- If EFLAGS specifies interrupts enabled, or any of the 16-bit real mode code enables interrupts,
- then the caller is responsible for making sure the 8259 PIC is in a state compatible with 16-bit real mode.
+
+ If EFLAGS specifies interrupts enabled, or any of the 16-bit real mode code enables interrupts,
+ or any of the 16-bit real mode code makes a SW interrupt, then the caller is responsible for making sure
+ the IDT at address 0 is initialized to handle any HW or SW interrupts that may occur while in 16-bit real mode.
+
+ If EFLAGS specifies interrupts enabled, or any of the 16-bit real mode code enables interrupts,
+ then the caller is responsible for making sure the 8259 PIC is in a state compatible with 16-bit real mode.
This includes the base vectors, the interrupt masks, and the edge/level trigger mode.
-
- If THUNK_ATTRIBUTE_BIG_REAL_MODE is set in the ThunkAttributes field of ThunkContext, then the user code
+
+ If THUNK_ATTRIBUTE_BIG_REAL_MODE is set in the ThunkAttributes field of ThunkContext, then the user code
is invoked in big real mode. Otherwise, the user code is invoked in 16-bit real mode with 64KB segment limits.
-
- If neither THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 nor THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL are set in
- ThunkAttributes, then it is assumed that the user code did not enable the A20 mask, and no attempt is made to
+
+ If neither THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 nor THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL are set in
+ ThunkAttributes, then it is assumed that the user code did not enable the A20 mask, and no attempt is made to
disable the A20 mask.
-
- If THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 is set and THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL is clear in
- ThunkAttributes, then attempt to use the INT 15 service to disable the A20 mask. If this INT 15 call fails,
+
+ If THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 is set and THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL is clear in
+ ThunkAttributes, then attempt to use the INT 15 service to disable the A20 mask. If this INT 15 call fails,
then attempt to disable the A20 mask by directly accessing the 8042 keyboard controller I/O ports.
-
- If THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 is clear and THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL is set in
+
+ If THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 is clear and THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL is set in
ThunkAttributes, then attempt to disable the A20 mask by directly accessing the 8042 keyboard controller I/O ports.
-
+
If ThunkContext is NULL, then ASSERT().
If AsmPrepareThunk16() was not previously called with ThunkContext, then ASSERT().
- If both THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 and THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL are set in
+ If both THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 and THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL are set in
ThunkAttributes, then ASSERT().
This interface is limited to be used in either physical mode or virtual modes with paging enabled where the
virtual to physical mappings for ThunkContext.RealModeBuffer is mapped 1:1.
-
+
@param ThunkContext A pointer to the context structure that describes the
16-bit real mode code to call.
@@ -228,7 +222,7 @@ AsmThunk16 (
ASSERT ((UINTN)ThunkContext->RealModeBuffer + m16Size <= 0x100000);
ASSERT (((ThunkContext->ThunkAttributes & (THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 | THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL)) != \
(THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 | THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL)));
-
+
UpdatedRegs = InternalAsmThunk16 (
ThunkContext->RealModeState,
ThunkContext->RealModeBuffer
@@ -250,7 +244,7 @@ AsmThunk16 (
This interface is limited to be used in either physical mode or virtual modes with paging enabled where the
virtual to physical mappings for ThunkContext.RealModeBuffer is mapped 1:1.
-
+
See AsmPrepareThunk16() and AsmThunk16() for the detailed description and ASSERT() conditions.
@param ThunkContext A pointer to the context structure that describes the