]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/BaseLib/BaseLibInternals.h
MdePkg/Library/BaseLib: Enable VS2017/ARM64 builds
[mirror_edk2.git] / MdePkg / Library / BaseLib / BaseLibInternals.h
index 19ed01beda74e15081368f4903012cf97d44fb30..9dca97a0dcc9dc4bf7bdc8c0b75eb222c4a16c11 100644 (file)
@@ -1,11 +1,11 @@
 /** @file\r
   Declaration of internal functions in BaseLib.\r
 \r
-  Copyright (c) 2006 - 2008, Intel Corporation<BR>\r
-  All rights reserved. This program and the accompanying materials\r
+  Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
+  This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
-  http://opensource.org/licenses/bsd-license.php\r
+  http://opensource.org/licenses/bsd-license.php.\r
 \r
   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
@@ -46,7 +46,7 @@ InternalMathLShiftU64 (
   );\r
 \r
 /**\r
-  Shifts a 64-bit integer right between 0 and 63 bits. This high bits\r
+  Shifts a 64-bit integer right between 0 and 63 bits. The high bits\r
   are filled with zeros. The shifted value is returned.\r
 \r
   This function shifts the 64-bit value Operand to the right by Count bits. The\r
@@ -90,7 +90,7 @@ InternalMathARShiftU64 (
   the low bits with the high bits that were rotated.\r
 \r
   This function rotates the 64-bit value Operand to the left by Count bits. The\r
-  low Count bits are fill with the high Count bits of Operand. The rotated\r
+  low Count bits are filled with the high Count bits of Operand. The rotated\r
   value is returned.\r
 \r
   @param  Operand The 64-bit operand to rotate left.\r
@@ -111,7 +111,7 @@ InternalMathLRotU64 (
   the high bits with the high low bits that were rotated.\r
 \r
   This function rotates the 64-bit value Operand to the right by Count bits.\r
-  The high Count bits are fill with the low Count bits of Operand. The rotated\r
+  The high Count bits are filled with the low Count bits of Operand. The rotated\r
   value is returned.\r
 \r
   @param  Operand The 64-bit operand to rotate right.\r
@@ -146,10 +146,10 @@ InternalMathSwapBytes64 (
   );\r
 \r
 /**\r
-  Multiples a 64-bit unsigned integer by a 32-bit unsigned integer\r
+  Multiplies a 64-bit unsigned integer by a 32-bit unsigned integer\r
   and generates a 64-bit unsigned result.\r
 \r
-  This function multiples the 64-bit unsigned value Multiplicand by the 32-bit\r
+  This function multiplies the 64-bit unsigned value Multiplicand by the 32-bit\r
   unsigned value Multiplier and generates a 64-bit unsigned result. This 64-\r
   bit unsigned result is returned.\r
 \r
@@ -167,7 +167,7 @@ InternalMathMultU64x32 (
   );\r
 \r
 /**\r
-  Multiples a 64-bit unsigned integer by a 64-bit unsigned integer\r
+  Multiplies a 64-bit unsigned integer by a 64-bit unsigned integer\r
   and generates a 64-bit unsigned result.\r
 \r
   This function multiples the 64-bit unsigned value Multiplicand by the 64-bit\r
@@ -339,34 +339,6 @@ InternalSwitchStack (
   );\r
 \r
 \r
-/**\r
-  Worker function that locates the Node in the List.\r
-\r
-  By searching the List, finds the location of the Node in List. At the same time,\r
-  verifies the validity of this list.\r
-\r
-  If List is NULL, then ASSERT().\r
-  If List->ForwardLink is NULL, then ASSERT().\r
-  If List->backLink is NULL, then ASSERT().\r
-  If Node is NULL, then ASSERT();\r
-  If PcdMaximumLinkedListLenth is not zero, and prior to insertion the number\r
-  of nodes in ListHead, including the ListHead node, is greater than or\r
-  equal to PcdMaximumLinkedListLength, then ASSERT().\r
-\r
-  @param  List  A pointer to a node in a linked list.\r
-  @param  Node  A pointer to one nod.\r
-\r
-  @retval TRUE   Node is in List\r
-  @retval FALSE  Node isn't in List, or List is invalid\r
-\r
-**/\r
-BOOLEAN\r
-EFIAPI\r
-IsNodeInList (\r
-  IN      CONST LIST_ENTRY      *List,\r
-  IN      CONST LIST_ENTRY      *Node\r
-  );\r
-\r
 /**\r
   Worker function that returns a bit field from Operand.\r
 \r
@@ -477,6 +449,170 @@ InternalLongJump (
   );\r
 \r
 \r
+/**\r
+  Check if a Unicode character is a decimal character.\r
+\r
+  This internal function checks if a Unicode character is a\r
+  decimal character. The valid decimal character is from\r
+  L'0' to L'9'.\r
+\r
+  @param  Char  The character to check against.\r
+\r
+  @retval TRUE  If the Char is a decmial character.\r
+  @retval FALSE If the Char is not a decmial character.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+InternalIsDecimalDigitCharacter (\r
+  IN      CHAR16                    Char\r
+  );\r
+\r
+\r
+/**\r
+  Convert a Unicode character to upper case only if\r
+  it maps to a valid small-case ASCII character.\r
+\r
+  This internal function only deal with Unicode character\r
+  which maps to a valid small-case ASCII character, i.e.\r
+  L'a' to L'z'. For other Unicode character, the input character\r
+  is returned directly.\r
+\r
+  @param  Char  The character to convert.\r
+\r
+  @retval LowerCharacter   If the Char is with range L'a' to L'z'.\r
+  @retval Unchanged        Otherwise.\r
+\r
+**/\r
+CHAR16\r
+EFIAPI\r
+InternalCharToUpper (\r
+  IN      CHAR16                    Char\r
+  );\r
+\r
+\r
+/**\r
+  Convert a Unicode character to numerical value.\r
+\r
+  This internal function only deal with Unicode character\r
+  which maps to a valid hexadecimal ASII character, i.e.\r
+  L'0' to L'9', L'a' to L'f' or L'A' to L'F'. For other\r
+  Unicode character, the value returned does not make sense.\r
+\r
+  @param  Char  The character to convert.\r
+\r
+  @return The numerical value converted.\r
+\r
+**/\r
+UINTN\r
+EFIAPI\r
+InternalHexCharToUintn (\r
+  IN      CHAR16                    Char\r
+  );\r
+\r
+\r
+/**\r
+  Check if a Unicode character is a hexadecimal character.\r
+\r
+  This internal function checks if a Unicode character is a\r
+  decimal character.  The valid hexadecimal character is\r
+  L'0' to L'9', L'a' to L'f', or L'A' to L'F'.\r
+\r
+\r
+  @param  Char  The character to check against.\r
+\r
+  @retval TRUE  If the Char is a hexadecmial character.\r
+  @retval FALSE If the Char is not a hexadecmial character.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+InternalIsHexaDecimalDigitCharacter (\r
+  IN      CHAR16                    Char\r
+  );\r
+\r
+\r
+/**\r
+  Check if a ASCII character is a decimal character.\r
+\r
+  This internal function checks if a Unicode character is a\r
+  decimal character. The valid decimal character is from\r
+  '0' to '9'.\r
+\r
+  @param  Char  The character to check against.\r
+\r
+  @retval TRUE  If the Char is a decmial character.\r
+  @retval FALSE If the Char is not a decmial character.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+InternalAsciiIsDecimalDigitCharacter (\r
+  IN      CHAR8                     Char\r
+  );\r
+\r
+\r
+/**\r
+  Converts a lowercase Ascii character to upper one.\r
+\r
+  If Chr is lowercase Ascii character, then converts it to upper one.\r
+\r
+  If Value >= 0xA0, then ASSERT().\r
+  If (Value & 0x0F) >= 0x0A, then ASSERT().\r
+\r
+  @param  Chr   one Ascii character\r
+\r
+  @return The uppercase value of Ascii character\r
+\r
+**/\r
+CHAR8\r
+EFIAPI\r
+InternalBaseLibAsciiToUpper (\r
+  IN      CHAR8                     Chr\r
+  );\r
+\r
+\r
+/**\r
+  Check if a ASCII character is a hexadecimal character.\r
+\r
+  This internal function checks if a ASCII character is a\r
+  decimal character.  The valid hexadecimal character is\r
+  L'0' to L'9', L'a' to L'f', or L'A' to L'F'.\r
+\r
+\r
+  @param  Char  The character to check against.\r
+\r
+  @retval TRUE  If the Char is a hexadecmial character.\r
+  @retval FALSE If the Char is not a hexadecmial character.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+InternalAsciiIsHexaDecimalDigitCharacter (\r
+  IN      CHAR8                    Char\r
+  );\r
+\r
+\r
+/**\r
+  Convert a ASCII character to numerical value.\r
+\r
+  This internal function only deal with Unicode character\r
+  which maps to a valid hexadecimal ASII character, i.e.\r
+  '0' to '9', 'a' to 'f' or 'A' to 'F'. For other\r
+  ASCII character, the value returned does not make sense.\r
+\r
+  @param  Char  The character to convert.\r
+\r
+  @return The numerical value converted.\r
+\r
+**/\r
+UINTN\r
+EFIAPI\r
+InternalAsciiHexCharToUintn (\r
+  IN      CHAR8                    Char\r
+  );\r
+\r
+\r
 //\r
 // Ia32 and x64 specific functions\r
 //\r
@@ -488,7 +624,7 @@ InternalLongJump (
   Reads and returns the current GDTR descriptor and returns it in Gdtr. This\r
   function is only available on IA-32 and x64.\r
 \r
-  @param  Gdtr  Pointer to a GDTR descriptor.\r
+  @param  Gdtr  The pointer to a GDTR descriptor.\r
 \r
 **/\r
 VOID\r
@@ -503,7 +639,7 @@ InternalX86ReadGdtr (
   Writes and the current GDTR descriptor specified by Gdtr. This function is\r
   only available on IA-32 and x64.\r
 \r
-  @param  Gdtr  Pointer to a GDTR descriptor.\r
+  @param  Gdtr  The pointer to a GDTR descriptor.\r
 \r
 **/\r
 VOID\r
@@ -518,7 +654,7 @@ InternalX86WriteGdtr (
   Reads and returns the current IDTR descriptor and returns it in Idtr. This\r
   function is only available on IA-32 and x64.\r
 \r
-  @param  Idtr  Pointer to a IDTR descriptor.\r
+  @param  Idtr  The pointer to an IDTR descriptor.\r
 \r
 **/\r
 VOID\r
@@ -533,7 +669,7 @@ InternalX86ReadIdtr (
   Writes the current IDTR descriptor and returns it in Idtr. This function is\r
   only available on IA-32 and x64.\r
 \r
-  @param  Idtr  Pointer to a IDTR descriptor.\r
+  @param  Idtr  The pointer to an IDTR descriptor.\r
 \r
 **/\r
 VOID\r
@@ -549,7 +685,7 @@ InternalX86WriteIdtr (
   Buffer. Buffer must be aligned on a 16-byte boundary. This function is only\r
   available on IA-32 and x64.\r
 \r
-  @param  Buffer  Pointer to a buffer to save the floating point/SSE/SSE2 context.\r
+  @param  Buffer  The pointer to a buffer to save the floating point/SSE/SSE2 context.\r
 \r
 **/\r
 VOID\r
@@ -565,7 +701,7 @@ InternalX86FxSave (
   by Buffer. Buffer must be aligned on a 16-byte boundary. This function is\r
   only available on IA-32 and x64.\r
 \r
-  @param  Buffer  Pointer to a buffer to save the floating point/SSE/SSE2 context.\r
+  @param  Buffer  The pointer to a buffer to save the floating point/SSE/SSE2 context.\r
 \r
 **/\r
 VOID\r
@@ -728,6 +864,52 @@ InternalX86DisablePaging64 (
   IN      UINT32                    NewStack\r
   );\r
 \r
+/**\r
+  Generates a 16-bit random number through RDRAND instruction.\r
+\r
+  @param[out]  Rand     Buffer pointer to store the random result.\r
+\r
+  @retval TRUE          RDRAND call was successful.\r
+  @retval FALSE         Failed attempts to call RDRAND.\r
+\r
+ **/\r
+BOOLEAN\r
+EFIAPI\r
+InternalX86RdRand16 (\r
+  OUT     UINT16                    *Rand\r
+  );\r
+\r
+/**\r
+  Generates a 32-bit random number through RDRAND instruction.\r
+\r
+  @param[out]  Rand     Buffer pointer to store the random result.\r
+\r
+  @retval TRUE          RDRAND call was successful.\r
+  @retval FALSE         Failed attempts to call RDRAND.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+InternalX86RdRand32 (\r
+  OUT     UINT32                    *Rand\r
+  );\r
+\r
+/**\r
+  Generates a 64-bit random number through RDRAND instruction.\r
+\r
+\r
+  @param[out]  Rand     Buffer pointer to store the random result.\r
+\r
+  @retval TRUE          RDRAND call was successful.\r
+  @retval FALSE         Failed attempts to call RDRAND.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+InternalX86RdRand64  (\r
+  OUT     UINT64                    *Rand\r
+  );\r
+\r
 \r
 #elif defined (MDE_CPU_IPF)\r
 //\r
@@ -735,20 +917,11 @@ InternalX86DisablePaging64 (
 // IPF specific functions\r
 //\r
 \r
-//\r
-// Structure definition for look up table.\r
-//\r
-typedef struct {\r
-  UINT64 Index;\r
-  UINT64 (*Function) (VOID);\r
-} REGISTER_ENTRY;\r
-\r
-\r
 /**\r
   Reads control register DCR.\r
 \r
   This is a worker function for AsmReadControlRegister()\r
-  when its parameter Index is IPF_CONTROL_REGISTER_DCR\r
+  when its parameter Index is IPF_CONTROL_REGISTER_DCR.\r
 \r
   @return The 64-bit control register DCR.\r
 \r
@@ -764,7 +937,7 @@ AsmReadControlRegisterDcr (
   Reads control register ITM.\r
 \r
   This is a worker function for AsmReadControlRegister()\r
-  when its parameter Index is IPF_CONTROL_REGISTER_ITM\r
+  when its parameter Index is IPF_CONTROL_REGISTER_ITM.\r
 \r
   @return The 64-bit control register ITM.\r
 \r
@@ -780,7 +953,7 @@ AsmReadControlRegisterItm (
   Reads control register IVA.\r
 \r
   This is a worker function for AsmReadControlRegister()\r
-  when its parameter Index is IPF_CONTROL_REGISTER_IVA\r
+  when its parameter Index is IPF_CONTROL_REGISTER_IVA.\r
 \r
   @return The 64-bit control register IVA.\r
 \r
@@ -796,7 +969,7 @@ AsmReadControlRegisterIva (
   Reads control register PTA.\r
 \r
   This is a worker function for AsmReadControlRegister()\r
-  when its parameter Index is IPF_CONTROL_REGISTER_PTA\r
+  when its parameter Index is IPF_CONTROL_REGISTER_PTA.\r
 \r
   @return The 64-bit control register PTA.\r
 \r
@@ -812,7 +985,7 @@ AsmReadControlRegisterPta (
   Reads control register IPSR.\r
 \r
   This is a worker function for AsmReadControlRegister()\r
-  when its parameter Index is IPF_CONTROL_REGISTER_IPSR\r
+  when its parameter Index is IPF_CONTROL_REGISTER_IPSR.\r
 \r
   @return The 64-bit control register IPSR.\r
 \r
@@ -828,7 +1001,7 @@ AsmReadControlRegisterIpsr (
   Reads control register ISR.\r
 \r
   This is a worker function for AsmReadControlRegister()\r
-  when its parameter Index is IPF_CONTROL_REGISTER_ISR\r
+  when its parameter Index is IPF_CONTROL_REGISTER_ISR.\r
 \r
   @return The 64-bit control register ISR.\r
 \r
@@ -844,7 +1017,7 @@ AsmReadControlRegisterIsr (
   Reads control register IIP.\r
 \r
   This is a worker function for AsmReadControlRegister()\r
-  when its parameter Index is IPF_CONTROL_REGISTER_IIP\r
+  when its parameter Index is IPF_CONTROL_REGISTER_IIP.\r
 \r
   @return The 64-bit control register IIP.\r
 \r
@@ -860,7 +1033,7 @@ AsmReadControlRegisterIip (
   Reads control register IFA.\r
 \r
   This is a worker function for AsmReadControlRegister()\r
-  when its parameter Index is IPF_CONTROL_REGISTER_IFA\r
+  when its parameter Index is IPF_CONTROL_REGISTER_IFA.\r
 \r
   @return The 64-bit control register IFA.\r
 \r
@@ -876,7 +1049,7 @@ AsmReadControlRegisterIfa (
   Reads control register ITIR.\r
 \r
   This is a worker function for AsmReadControlRegister()\r
-  when its parameter Index is IPF_CONTROL_REGISTER_ITIR\r
+  when its parameter Index is IPF_CONTROL_REGISTER_ITIR.\r
 \r
   @return The 64-bit control register ITIR.\r
 \r
@@ -892,7 +1065,7 @@ AsmReadControlRegisterItir (
   Reads control register IIPA.\r
 \r
   This is a worker function for AsmReadControlRegister()\r
-  when its parameter Index is IPF_CONTROL_REGISTER_IIPA\r
+  when its parameter Index is IPF_CONTROL_REGISTER_IIPA.\r
 \r
   @return The 64-bit control register IIPA.\r
 \r
@@ -908,7 +1081,7 @@ AsmReadControlRegisterIipa (
   Reads control register IFS.\r
 \r
   This is a worker function for AsmReadControlRegister()\r
-  when its parameter Index is IPF_CONTROL_REGISTER_IFS\r
+  when its parameter Index is IPF_CONTROL_REGISTER_IFS.\r
 \r
   @return The 64-bit control register IFS.\r
 \r
@@ -924,7 +1097,7 @@ AsmReadControlRegisterIfs (
   Reads control register IIM.\r
 \r
   This is a worker function for AsmReadControlRegister()\r
-  when its parameter Index is IPF_CONTROL_REGISTER_IIM\r
+  when its parameter Index is IPF_CONTROL_REGISTER_IIM.\r
 \r
   @return The 64-bit control register IIM.\r
 \r
@@ -940,7 +1113,7 @@ AsmReadControlRegisterIim (
   Reads control register IHA.\r
 \r
   This is a worker function for AsmReadControlRegister()\r
-  when its parameter Index is IPF_CONTROL_REGISTER_IHA\r
+  when its parameter Index is IPF_CONTROL_REGISTER_IHA.\r
 \r
   @return The 64-bit control register IHA.\r
 \r
@@ -956,7 +1129,7 @@ AsmReadControlRegisterIha (
   Reads control register LID.\r
 \r
   This is a worker function for AsmReadControlRegister()\r
-  when its parameter Index is IPF_CONTROL_REGISTER_LID\r
+  when its parameter Index is IPF_CONTROL_REGISTER_LID.\r
 \r
   @return The 64-bit control register LID.\r
 \r
@@ -972,7 +1145,7 @@ AsmReadControlRegisterLid (
   Reads control register IVR.\r
 \r
   This is a worker function for AsmReadControlRegister()\r
-  when its parameter Index is IPF_CONTROL_REGISTER_IVR\r
+  when its parameter Index is IPF_CONTROL_REGISTER_IVR.\r
 \r
   @return The 64-bit control register IVR.\r
 \r
@@ -988,7 +1161,7 @@ AsmReadControlRegisterIvr (
   Reads control register TPR.\r
 \r
   This is a worker function for AsmReadControlRegister()\r
-  when its parameter Index is IPF_CONTROL_REGISTER_TPR\r
+  when its parameter Index is IPF_CONTROL_REGISTER_TPR.\r
 \r
   @return The 64-bit control register TPR.\r
 \r
@@ -1004,7 +1177,7 @@ AsmReadControlRegisterTpr (
   Reads control register EOI.\r
 \r
   This is a worker function for AsmReadControlRegister()\r
-  when its parameter Index is IPF_CONTROL_REGISTER_EOI\r
+  when its parameter Index is IPF_CONTROL_REGISTER_EOI.\r
 \r
   @return The 64-bit control register EOI.\r
 \r
@@ -1020,7 +1193,7 @@ AsmReadControlRegisterEoi (
   Reads control register IRR0.\r
 \r
   This is a worker function for AsmReadControlRegister()\r
-  when its parameter Index is IPF_CONTROL_REGISTER_IRR0\r
+  when its parameter Index is IPF_CONTROL_REGISTER_IRR0.\r
 \r
   @return The 64-bit control register IRR0.\r
 \r
@@ -1036,7 +1209,7 @@ AsmReadControlRegisterIrr0 (
   Reads control register IRR1.\r
 \r
   This is a worker function for AsmReadControlRegister()\r
-  when its parameter Index is IPF_CONTROL_REGISTER_IRR1\r
+  when its parameter Index is IPF_CONTROL_REGISTER_IRR1.\r
 \r
   @return The 64-bit control register IRR1.\r
 \r
@@ -1052,7 +1225,7 @@ AsmReadControlRegisterIrr1 (
   Reads control register IRR2.\r
 \r
   This is a worker function for AsmReadControlRegister()\r
-  when its parameter Index is IPF_CONTROL_REGISTER_IRR2\r
+  when its parameter Index is IPF_CONTROL_REGISTER_IRR2.\r
 \r
   @return The 64-bit control register IRR2.\r
 \r
@@ -1068,7 +1241,7 @@ AsmReadControlRegisterIrr2 (
   Reads control register IRR3.\r
 \r
   This is a worker function for AsmReadControlRegister()\r
-  when its parameter Index is IPF_CONTROL_REGISTER_IRR3\r
+  when its parameter Index is IPF_CONTROL_REGISTER_IRR3.\r
 \r
   @return The 64-bit control register IRR3.\r
 \r
@@ -1084,7 +1257,7 @@ AsmReadControlRegisterIrr3 (
   Reads control register ITV.\r
 \r
   This is a worker function for AsmReadControlRegister()\r
-  when its parameter Index is IPF_CONTROL_REGISTER_ITV\r
+  when its parameter Index is IPF_CONTROL_REGISTER_ITV.\r
 \r
   @return The 64-bit control register ITV.\r
 \r
@@ -1100,7 +1273,7 @@ AsmReadControlRegisterItv (
   Reads control register PMV.\r
 \r
   This is a worker function for AsmReadControlRegister()\r
-  when its parameter Index is IPF_CONTROL_REGISTER_PMV\r
+  when its parameter Index is IPF_CONTROL_REGISTER_PMV.\r
 \r
   @return The 64-bit control register PMV.\r
 \r
@@ -1116,7 +1289,7 @@ AsmReadControlRegisterPmv (
   Reads control register CMCV.\r
 \r
   This is a worker function for AsmReadControlRegister()\r
-  when its parameter Index is IPF_CONTROL_REGISTER_CMCV\r
+  when its parameter Index is IPF_CONTROL_REGISTER_CMCV.\r
 \r
   @return The 64-bit control register CMCV.\r
 \r
@@ -1132,7 +1305,7 @@ AsmReadControlRegisterCmcv (
   Reads control register LRR0.\r
 \r
   This is a worker function for AsmReadControlRegister()\r
-  when its parameter Index is IPF_CONTROL_REGISTER_LRR0\r
+  when its parameter Index is IPF_CONTROL_REGISTER_LRR0.\r
 \r
   @return The 64-bit control register LRR0.\r
 \r
@@ -1148,7 +1321,7 @@ AsmReadControlRegisterLrr0 (
   Reads control register LRR1.\r
 \r
   This is a worker function for AsmReadControlRegister()\r
-  when its parameter Index is IPF_CONTROL_REGISTER_LRR1\r
+  when its parameter Index is IPF_CONTROL_REGISTER_LRR1.\r
 \r
   @return The 64-bit control register LRR1.\r
 \r
@@ -1164,7 +1337,7 @@ AsmReadControlRegisterLrr1 (
   Reads application register K0.\r
 \r
   This is a worker function for AsmReadApplicationRegister()\r
-  when its parameter Index is IPF_APPLICATION_REGISTER_K0\r
+  when its parameter Index is IPF_APPLICATION_REGISTER_K0.\r
 \r
   @return The 64-bit application register K0.\r
 \r
@@ -1181,7 +1354,7 @@ AsmReadApplicationRegisterK0 (
   Reads application register K1.\r
 \r
   This is a worker function for AsmReadApplicationRegister()\r
-  when its parameter Index is IPF_APPLICATION_REGISTER_K1\r
+  when its parameter Index is IPF_APPLICATION_REGISTER_K1.\r
 \r
   @return The 64-bit application register K1.\r
 \r
@@ -1197,7 +1370,7 @@ AsmReadApplicationRegisterK1 (
   Reads application register K2.\r
 \r
   This is a worker function for AsmReadApplicationRegister()\r
-  when its parameter Index is IPF_APPLICATION_REGISTER_K2\r
+  when its parameter Index is IPF_APPLICATION_REGISTER_K2.\r
 \r
   @return The 64-bit application register K2.\r
 \r
@@ -1213,7 +1386,7 @@ AsmReadApplicationRegisterK2 (
   Reads application register K3.\r
 \r
   This is a worker function for AsmReadApplicationRegister()\r
-  when its parameter Index is IPF_APPLICATION_REGISTER_K3\r
+  when its parameter Index is IPF_APPLICATION_REGISTER_K3.\r
 \r
   @return The 64-bit application register K3.\r
 \r
@@ -1229,7 +1402,7 @@ AsmReadApplicationRegisterK3 (
   Reads application register K4.\r
 \r
   This is a worker function for AsmReadApplicationRegister()\r
-  when its parameter Index is IPF_APPLICATION_REGISTER_K4\r
+  when its parameter Index is IPF_APPLICATION_REGISTER_K4.\r
 \r
   @return The 64-bit application register K4.\r
 \r
@@ -1245,7 +1418,7 @@ AsmReadApplicationRegisterK4 (
   Reads application register K5.\r
 \r
   This is a worker function for AsmReadApplicationRegister()\r
-  when its parameter Index is IPF_APPLICATION_REGISTER_K5\r
+  when its parameter Index is IPF_APPLICATION_REGISTER_K5.\r
 \r
   @return The 64-bit application register K5.\r
 \r
@@ -1261,7 +1434,7 @@ AsmReadApplicationRegisterK5 (
   Reads application register K6.\r
 \r
   This is a worker function for AsmReadApplicationRegister()\r
-  when its parameter Index is IPF_APPLICATION_REGISTER_K6\r
+  when its parameter Index is IPF_APPLICATION_REGISTER_K6.\r
 \r
   @return The 64-bit application register K6.\r
 \r
@@ -1277,7 +1450,7 @@ AsmReadApplicationRegisterK6 (
   Reads application register K7.\r
 \r
   This is a worker function for AsmReadApplicationRegister()\r
-  when its parameter Index is IPF_APPLICATION_REGISTER_K7\r
+  when its parameter Index is IPF_APPLICATION_REGISTER_K7.\r
 \r
   @return The 64-bit application register K7.\r
 \r
@@ -1293,7 +1466,7 @@ AsmReadApplicationRegisterK7 (
   Reads application register RSC.\r
 \r
   This is a worker function for AsmReadApplicationRegister()\r
-  when its parameter Index is IPF_APPLICATION_REGISTER_RSC\r
+  when its parameter Index is IPF_APPLICATION_REGISTER_RSC.\r
 \r
   @return The 64-bit application register RSC.\r
 \r
@@ -1309,7 +1482,7 @@ AsmReadApplicationRegisterRsc (
   Reads application register BSP.\r
 \r
   This is a worker function for AsmReadApplicationRegister()\r
-  when its parameter Index is IPF_APPLICATION_REGISTER_BSP\r
+  when its parameter Index is IPF_APPLICATION_REGISTER_BSP.\r
 \r
   @return The 64-bit application register BSP.\r
 \r
@@ -1325,7 +1498,7 @@ AsmReadApplicationRegisterBsp (
   Reads application register BSPSTORE.\r
 \r
   This is a worker function for AsmReadApplicationRegister()\r
-  when its parameter Index is IPF_APPLICATION_REGISTER_BSPSTORE\r
+  when its parameter Index is IPF_APPLICATION_REGISTER_BSPSTORE.\r
 \r
   @return The 64-bit application register BSPSTORE.\r
 \r
@@ -1341,7 +1514,7 @@ AsmReadApplicationRegisterBspstore (
   Reads application register RNAT.\r
 \r
   This is a worker function for AsmReadApplicationRegister()\r
-  when its parameter Index is IPF_APPLICATION_REGISTER_RNAT\r
+  when its parameter Index is IPF_APPLICATION_REGISTER_RNAT.\r
 \r
   @return The 64-bit application register RNAT.\r
 \r
@@ -1357,7 +1530,7 @@ AsmReadApplicationRegisterRnat (
   Reads application register FCR.\r
 \r
   This is a worker function for AsmReadApplicationRegister()\r
-  when its parameter Index is IPF_APPLICATION_REGISTER_FCR\r
+  when its parameter Index is IPF_APPLICATION_REGISTER_FCR.\r
 \r
   @return The 64-bit application register FCR.\r
 \r
@@ -1373,7 +1546,7 @@ AsmReadApplicationRegisterFcr (
   Reads application register EFLAG.\r
 \r
   This is a worker function for AsmReadApplicationRegister()\r
-  when its parameter Index is IPF_APPLICATION_REGISTER_EFLAG\r
+  when its parameter Index is IPF_APPLICATION_REGISTER_EFLAG.\r
 \r
   @return The 64-bit application register EFLAG.\r
 \r
@@ -1389,7 +1562,7 @@ AsmReadApplicationRegisterEflag (
   Reads application register CSD.\r
 \r
   This is a worker function for AsmReadApplicationRegister()\r
-  when its parameter Index is IPF_APPLICATION_REGISTER_CSD\r
+  when its parameter Index is IPF_APPLICATION_REGISTER_CSD.\r
 \r
   @return The 64-bit application register CSD.\r
 \r
@@ -1405,7 +1578,7 @@ AsmReadApplicationRegisterCsd (
   Reads application register SSD.\r
 \r
   This is a worker function for AsmReadApplicationRegister()\r
-  when its parameter Index is IPF_APPLICATION_REGISTER_SSD\r
+  when its parameter Index is IPF_APPLICATION_REGISTER_SSD.\r
 \r
   @return The 64-bit application register SSD.\r
 \r
@@ -1421,7 +1594,7 @@ AsmReadApplicationRegisterSsd (
   Reads application register CFLG.\r
 \r
   This is a worker function for AsmReadApplicationRegister()\r
-  when its parameter Index is IPF_APPLICATION_REGISTER_CFLG\r
+  when its parameter Index is IPF_APPLICATION_REGISTER_CFLG.\r
 \r
   @return The 64-bit application register CFLG.\r
 \r
@@ -1437,7 +1610,7 @@ AsmReadApplicationRegisterCflg (
   Reads application register FSR.\r
 \r
   This is a worker function for AsmReadApplicationRegister()\r
-  when its parameter Index is IPF_APPLICATION_REGISTER_FSR\r
+  when its parameter Index is IPF_APPLICATION_REGISTER_FSR.\r
 \r
   @return The 64-bit application register FSR.\r
 \r
@@ -1453,7 +1626,7 @@ AsmReadApplicationRegisterFsr (
   Reads application register FIR.\r
 \r
   This is a worker function for AsmReadApplicationRegister()\r
-  when its parameter Index is IPF_APPLICATION_REGISTER_FIR\r
+  when its parameter Index is IPF_APPLICATION_REGISTER_FIR.\r
 \r
   @return The 64-bit application register FIR.\r
 \r
@@ -1469,7 +1642,7 @@ AsmReadApplicationRegisterFir (
   Reads application register FDR.\r
 \r
   This is a worker function for AsmReadApplicationRegister()\r
-  when its parameter Index is IPF_APPLICATION_REGISTER_FDR\r
+  when its parameter Index is IPF_APPLICATION_REGISTER_FDR.\r
 \r
   @return The 64-bit application register FDR.\r
 \r
@@ -1485,7 +1658,7 @@ AsmReadApplicationRegisterFdr (
   Reads application register CCV.\r
 \r
   This is a worker function for AsmReadApplicationRegister()\r
-  when its parameter Index is IPF_APPLICATION_REGISTER_CCV\r
+  when its parameter Index is IPF_APPLICATION_REGISTER_CCV.\r
 \r
   @return The 64-bit application register CCV.\r
 \r
@@ -1501,7 +1674,7 @@ AsmReadApplicationRegisterCcv (
   Reads application register UNAT.\r
 \r
   This is a worker function for AsmReadApplicationRegister()\r
-  when its parameter Index is IPF_APPLICATION_REGISTER_UNAT\r
+  when its parameter Index is IPF_APPLICATION_REGISTER_UNAT.\r
 \r
   @return The 64-bit application register UNAT.\r
 \r
@@ -1517,7 +1690,7 @@ AsmReadApplicationRegisterUnat (
   Reads application register FPSR.\r
 \r
   This is a worker function for AsmReadApplicationRegister()\r
-  when its parameter Index is IPF_APPLICATION_REGISTER_FPSR\r
+  when its parameter Index is IPF_APPLICATION_REGISTER_FPSR.\r
 \r
   @return The 64-bit application register FPSR.\r
 \r
@@ -1533,7 +1706,7 @@ AsmReadApplicationRegisterFpsr (
   Reads application register ITC.\r
 \r
   This is a worker function for AsmReadApplicationRegister()\r
-  when its parameter Index is IPF_APPLICATION_REGISTER_ITC\r
+  when its parameter Index is IPF_APPLICATION_REGISTER_ITC.\r
 \r
   @return The 64-bit application register ITC.\r
 \r
@@ -1549,7 +1722,7 @@ AsmReadApplicationRegisterItc (
   Reads application register PFS.\r
 \r
   This is a worker function for AsmReadApplicationRegister()\r
-  when its parameter Index is IPF_APPLICATION_REGISTER_PFS\r
+  when its parameter Index is IPF_APPLICATION_REGISTER_PFS.\r
 \r
   @return The 64-bit application register PFS.\r
 \r
@@ -1565,7 +1738,7 @@ AsmReadApplicationRegisterPfs (
   Reads application register LC.\r
 \r
   This is a worker function for AsmReadApplicationRegister()\r
-  when its parameter Index is IPF_APPLICATION_REGISTER_LC\r
+  when its parameter Index is IPF_APPLICATION_REGISTER_LC.\r
 \r
   @return The 64-bit application register LC.\r
 \r
@@ -1581,7 +1754,7 @@ AsmReadApplicationRegisterLc (
   Reads application register EC.\r
 \r
   This is a worker function for AsmReadApplicationRegister()\r
-  when its parameter Index is IPF_APPLICATION_REGISTER_EC\r
+  when its parameter Index is IPF_APPLICATION_REGISTER_EC.\r
 \r
   @return The 64-bit application register EC.\r
 \r
@@ -1625,6 +1798,38 @@ AsmSwitchStackAndBackingStore (
   IN      VOID                      *NewStack,\r
   IN      VOID                      *NewBsp\r
   );\r
+\r
+/**\r
+  Internal worker function to invalidate a range of instruction cache lines\r
+  in the cache coherency domain of the calling CPU.\r
+\r
+  Internal worker function to invalidate the instruction cache lines specified\r
+  by Address and Length. If Address is not aligned on a cache line boundary,\r
+  then entire instruction cache line containing Address is invalidated. If\r
+  Address + Length is not aligned on a cache line boundary, then the entire\r
+  instruction cache line containing Address + Length -1 is invalidated. This\r
+  function may choose to invalidate the entire instruction cache if that is more\r
+  efficient than invalidating the specified range. If Length is 0, the no instruction\r
+  cache lines are invalidated. Address is returned.\r
+  This function is only available on IPF.\r
+\r
+  @param  Address The base address of the instruction cache lines to\r
+                  invalidate. If the CPU is in a physical addressing mode, then\r
+                  Address is a physical address. If the CPU is in a virtual\r
+                  addressing mode, then Address is a virtual address.\r
+\r
+  @param  Length  The number of bytes to invalidate from the instruction cache.\r
+\r
+  @return Address\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+InternalFlushCacheRange (\r
+  IN      VOID                      *Address,\r
+  IN      UINTN                     Length\r
+  );\r
+\r
 #else\r
 \r
 #endif\r