]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/BaseLib/X86Thunk.c
Add checking for ThunkAttribute to avoid THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL...
[mirror_edk2.git] / MdePkg / Library / BaseLib / X86Thunk.c
index fbd198984d623cffdcf12c5cf553a4fc836ba647..6b6e9f0f1259b2199ec3a159e9fd12c5248c6a09 100644 (file)
@@ -109,6 +109,9 @@ AsmGetThunk16Properties (
   Prepares all structures a code required to use AsmThunk16().\r
 \r
   Prepares all structures and code required to use AsmThunk16().\r
+  \r
+  This interface is limited to be used in physical mode but can not be used in \r
+  virtual mode with paging.\r
 \r
   If ThunkContext is NULL, then ASSERT().\r
 \r
@@ -227,6 +230,9 @@ AsmPrepareThunk16 (
   If both THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 and THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL are set in \r
   ThunkAttributes, then ASSERT().\r
 \r
+  This interface is limited to be used in physical mode but can not be used in \r
+  virtual mode with paging.\r
+  \r
   @param  ThunkContext  A pointer to the context structure that describes the\r
                         16-bit real mode code to call.\r
 \r
@@ -243,7 +249,9 @@ AsmThunk16 (
   ASSERT ((UINTN)ThunkContext->RealModeBuffer < 0x100000);\r
   ASSERT (ThunkContext->RealModeBufferSize >= m16Size);\r
   ASSERT ((UINTN)ThunkContext->RealModeBuffer + m16Size <= 0x100000);\r
-\r
+  ASSERT (((ThunkContext->ThunkAttributes & (THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 | THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL)) != \\r
+           (THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 | THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL)));\r
+           \r
   UpdatedRegs = InternalAsmThunk16 (\r
                   ThunkContext->RealModeState,\r
                   ThunkContext->RealModeBuffer\r
@@ -263,6 +271,9 @@ AsmThunk16 (
   real mode thunk, then it is more efficient if AsmPrepareThunk16() is called\r
   once and AsmThunk16() can be called for each 16-bit real mode thunk.\r
 \r
+  This interface is limited to be used in physical mode but can not be used in \r
+  virtual mode with paging.\r
+  \r
   See AsmPrepareThunk16() and AsmThunk16() for the detailed description and ASSERT() conditions.\r
 \r
   @param  ThunkContext  A pointer to the context structure that describes the\r