X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdePkg%2FInclude%2FLibrary%2FBaseLib.h;h=dadf367602d6c71dba3d589bc1e0fcd15d7b3f9a;hb=2a53dabf6286ee56774bbd47aadf70aa78f0cd25;hp=45e5bb2228aca1d18aae0a056e76da0dc6caa63d;hpb=285010e7dc951798fcc1e77eda2027c72bedbacf;p=mirror_edk2.git diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/BaseLib.h index 45e5bb2228..dadf367602 100644 --- a/MdePkg/Include/Library/BaseLib.h +++ b/MdePkg/Include/Library/BaseLib.h @@ -2,7 +2,7 @@ Provides string functions, linked list functions, math functions, synchronization functions, and CPU architecture specific functions. -Copyright (c) 2006 - 2008, Intel Corporation +Copyright (c) 2006 - 2008, Intel Corporation
All rights reserved. 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 @@ -39,7 +39,9 @@ typedef struct { #define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT 4 -#elif defined (MDE_CPU_IPF) +#endif // defined (MDE_CPU_IA32) + +#if defined (MDE_CPU_IPF) /// /// IPF context buffer used by SetJump() and LongJump() @@ -87,9 +89,11 @@ typedef struct { #define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT 0x10 -#elif defined (MDE_CPU_X64) +#endif // defined (MDE_CPU_IPF) + +#if defined (MDE_CPU_X64) /// -/// X64 context buffer used by SetJump() and LongJump() +/// x64 context buffer used by SetJump() and LongJump() /// typedef struct { UINT64 Rbx; @@ -106,7 +110,9 @@ typedef struct { #define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT 8 -#elif defined (MDE_CPU_EBC) +#endif // defined (MDE_CPU_X64) + +#if defined (MDE_CPU_EBC) /// /// EBC context buffer used by SetJump() and LongJump() /// @@ -120,9 +126,7 @@ typedef struct { #define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT 8 -#else -#error Unknown Processor Type -#endif +#endif // defined (MDE_CPU_EBC) // // String Services @@ -148,7 +152,7 @@ typedef struct { @param Destination Pointer to a Null-terminated Unicode string. @param Source Pointer to a Null-terminated Unicode string. - @return Destiantion + @return Destination. **/ CHAR16 * @@ -184,7 +188,7 @@ StrCpy ( @param Source Pointer to a Null-terminated Unicode string. @param Length Maximum number of Unicode characters to copy. - @return Destination + @return Destination. **/ CHAR16 * @@ -349,7 +353,7 @@ StrnCmp ( @param Destination Pointer to a Null-terminated Unicode string. @param Source Pointer to a Null-terminated Unicode string. - @return Destination + @return Destination. **/ CHAR16 * @@ -394,7 +398,7 @@ StrCat ( @param Length Maximum number of Unicode characters to concatenate from Source. - @return Destination + @return Destination. **/ CHAR16 * @@ -406,7 +410,7 @@ StrnCat ( ); /** - Returns the first occurance of a Null-terminated Unicode sub-string + Returns the first occurrence of a Null-terminated Unicode sub-string in a Null-terminated Unicode string. This function scans the contents of the Null-terminated Unicode string @@ -602,135 +606,6 @@ StrHexToUint64 ( IN CONST CHAR16 *String ); -/** - Convert a nibble in the low 4 bits of a byte to a Unicode hexadecimal character. - - This function converts a nibble in the low 4 bits of a byte to a Unicode hexadecimal - character For example, the nibble 0x01 and 0x0A will converted to L'1' and L'A' - respectively. - - The upper nibble in the input byte will be masked off. - - @param Nibble The nibble which is in the low 4 bits of the input byte. - - @retval CHAR16 The Unicode hexadecimal character. - -**/ -CHAR16 -EFIAPI -NibbleToHexChar ( - IN UINT8 Nibble - ); - -/** - Convert binary buffer to a Unicode String in a specified sequence. - - This function converts bytes in the memory block pointed by Buffer to a Unicode String Str. - Each byte will be represented by two Unicode characters. For example, byte 0xA1 will - be converted into two Unicode character L'A' and L'1'. In the output String, the Unicode Character - for the Most Significant Nibble will be put before the Unicode Character for the Least Significant - Nibble. The output string for the buffer containing a single byte 0xA1 will be L"A1". - For a buffer with multiple bytes, the Unicode character produced by the first byte will be put into the - the last character in the output string. The one next to first byte will be put into the - character before the last character. This rules applies to the rest of the bytes. The Unicode - character by the last byte will be put into the first character in the output string. For example, - the input buffer for a 64-bits unsigned integrer 0x12345678abcdef1234 will be converted to - a Unicode string equal to L"12345678abcdef1234". - - @param String On input, String is pointed to the buffer allocated for the convertion. - @param StringLen The Length of String buffer to hold the output String. The length must include the tailing '\0' character. - The StringLen required to convert a N bytes Buffer will be a least equal to or greater - than 2*N + 1. - @param Buffer The pointer to a input buffer. - @param BufferSizeInBytes Lenth in bytes of the input buffer. - - - @retval EFI_SUCCESS The convertion is successfull. All bytes in Buffer has been convert to the corresponding - Unicode character and placed into the right place in String. - @retval EFI_BUFFER_TOO_SMALL StringSizeInBytes is smaller than 2 * N + 1the number of bytes required to - complete the convertion. -**/ -RETURN_STATUS -EFIAPI -BufToHexString ( - IN OUT CHAR16 *String, - IN OUT UINTN *StringLen, - IN CONST UINT8 *Buffer, - IN UINTN BufferSizeInBytes - ); - - -/** - Convert a Unicode string consisting of hexadecimal characters to a output byte buffer. - - This function converts a Unicode string consisting of characters in the range of Hexadecimal - character (L'0' to L'9', L'A' to L'F' and L'a' to L'f') to a output byte buffer. The function will stop - at the first non-hexadecimal character or the NULL character. The convertion process can be - simply viewed as the reverse operations defined by BufToHexString. Two Unicode characters will be - converted into one byte. The first Unicode character represents the Most Significant Nibble and the - second Unicode character represents the Least Significant Nibble in the output byte. - The first pair of Unicode characters represents the last byte in the output buffer. The second pair of Unicode - characters represent the the byte preceding the last byte. This rule applies to the rest pairs of bytes. - The last pair represent the first byte in the output buffer. - - For example, a Unciode String L"12345678" will be converted into a buffer wil the following bytes - (first byte is the byte in the lowest memory address): "0x78, 0x56, 0x34, 0x12". - - If String has N valid hexadecimal characters for conversion, the caller must make sure Buffer is at least - N/2 (if N is even) or (N+1)/2 (if N if odd) bytes. - - @param Buffer The output buffer allocated by the caller. - @param BufferSizeInBytes On input, the size in bytes of Buffer. On output, it is updated to - contain the size of the Buffer which is actually used for the converstion. - For Unicode string with 2*N hexadecimal characters (not including the - tailing NULL character), N bytes of Buffer will be used for the output. - @param String The input hexadecimal string. - @param ConvertedStrLen The number of hexadecimal characters used to produce content in output - buffer Buffer. - - @retval RETURN_BUFFER_TOO_SMALL The input BufferSizeInBytes is too small to hold the output. BufferSizeInBytes - will be updated to the size required for the converstion. - @retval RETURN_SUCCESS The convertion is successful or the first Unicode character from String - is hexadecimal. If ConvertedStrLen is not NULL, it is updated - to the number of hexadecimal character used for the converstion. -**/ -RETURN_STATUS -EFIAPI -HexStringToBuf ( - OUT UINT8 *Buffer, - IN OUT UINTN *BufferSizeInBytes, - IN CONST CHAR16 *String, - OUT UINTN *ConvertedStrLen OPTIONAL - ); - - -/** - Test if a Unicode character is a hexadecimal digit. If true, the input - Unicode character is converted to a byte. - - This function tests if a Unicode character is a hexadecimal digit. If true, the input - Unicode character is converted to a byte. For example, Unicode character - L'A' will be converted to 0x0A. - - If Digit is NULL, then ASSERT. - - @param Digit The output hexadecimal digit. - - @param Char The input Unicode character. - - @retval TRUE Char is in the range of Hexadecimal number. Digit is updated - to the byte value of the number. - @retval FALSE Char is not in the range of Hexadecimal number. Digit is keep - intact. - -**/ -BOOLEAN -EFIAPI -IsHexDigit ( - OUT UINT8 *Digit, - IN CHAR16 Char - ); - /** Convert a Null-terminated Unicode string to a Null-terminated ASCII string and returns the ASCII string. @@ -758,7 +633,7 @@ IsHexDigit ( @param Source Pointer to a Null-terminated Unicode string. @param Destination Pointer to a Null-terminated ASCII string. - @return Destination + @return Destination. **/ CHAR8 * @@ -1067,7 +942,7 @@ AsciiStrnCat ( /** - Returns the first occurance of a Null-terminated ASCII sub-string + Returns the first occurrence of a Null-terminated ASCII sub-string in a Null-terminated ASCII string. This function scans the contents of the ASCII string specified by String @@ -1087,7 +962,7 @@ AsciiStrnCat ( @retval NULL If the SearchString does not appear in String. @retval others If there is a match return the first occurrence of SearchingString. - If the lenth of SearchString is zero,return String. + If the length of SearchString is zero,return String. **/ CHAR8 * @@ -1278,7 +1153,7 @@ AsciiStrHexToUint64 ( @param Source Pointer to a Null-terminated ASCII string. @param Destination Pointer to a Null-terminated Unicode string. - @return Destination + @return Destination. **/ CHAR16 * @@ -1299,7 +1174,7 @@ AsciiStrToUnicodeStr ( @param Value The 8-bit value to convert to BCD. Range 0..99. - @return The BCD value + @return The BCD value. **/ UINT8 @@ -1603,7 +1478,7 @@ IsNodeAtEnd ( @param FirstEntry A pointer to a node in a linked list. @param SecondEntry A pointer to another node in the same linked list. - @return SecondEntry + @return SecondEntry. **/ LIST_ENTRY * @@ -1630,9 +1505,9 @@ SwapListEntries ( linked list containing Entry, including the Entry node, is greater than or equal to PcdMaximumLinkedListLength, then ASSERT(). - @param Entry A pointer to a node in a linked list + @param Entry A pointer to a node in a linked list. - @return Entry + @return Entry. **/ LIST_ENTRY * @@ -1657,7 +1532,7 @@ RemoveEntryList ( @param Operand The 64-bit operand to shift left. @param Count The number of bits to shift left. - @return Operand << Count + @return Operand << Count. **/ UINT64 @@ -1751,7 +1626,7 @@ LRotU32 ( @param Operand The 32-bit operand to rotate right. @param Count The number of bits to rotate right. - @return Operand >>> Count + @return Operand >> Count **/ UINT32 @@ -1819,7 +1694,7 @@ RRotU64 ( @param Operand The 32-bit operand to evaluate. - @retval 0-31 The lowest bit set in Operand was found. + @retval 0..31 The lowest bit set in Operand was found. @retval -1 Operand is zero. **/ @@ -1839,7 +1714,7 @@ LowBitSet32 ( @param Operand The 64-bit operand to evaluate. - @retval 0-63 The lowest bit set in Operand was found. + @retval 0..63 The lowest bit set in Operand was found. @retval -1 Operand is zero. @@ -1861,7 +1736,7 @@ LowBitSet64 ( @param Operand The 32-bit operand to evaluate. - @retval 0-31 Position of the highest bit set in Operand if found. + @retval 0..31 Position of the highest bit set in Operand if found. @retval -1 Operand is zero. **/ @@ -1882,7 +1757,7 @@ HighBitSet32 ( @param Operand The 64-bit operand to evaluate. - @retval 0-63 Position of the highest bit set in Operand if found. + @retval 0..63 Position of the highest bit set in Operand if found. @retval -1 Operand is zero. **/ @@ -1940,9 +1815,9 @@ GetPowerOfTwo64 ( from little endian to big endian or vice versa. The byte swapped value is returned. - @param Value Operand A 16-bit unsigned value. + @param Value A 16-bit unsigned value. - @return The byte swapped Operand. + @return The byte swapped value. **/ UINT16 @@ -1959,9 +1834,9 @@ SwapBytes16 ( from little endian to big endian or vice versa. The byte swapped value is returned. - @param Value Operand A 32-bit unsigned value. + @param Value A 32-bit unsigned value. - @return The byte swapped Operand. + @return The byte swapped value. **/ UINT32 @@ -1978,9 +1853,9 @@ SwapBytes32 ( from little endian to big endian or vice versa. The byte swapped value is returned. - @param Value Operand A 64-bit unsigned value. + @param Value A 64-bit unsigned value. - @return The byte swapped Operand. + @return The byte swapped value. **/ UINT64 @@ -1998,8 +1873,6 @@ SwapBytes64 ( unsigned value Multiplier and generates a 64-bit unsigned result. This 64- bit unsigned result is returned. - If the result overflows, then ASSERT(). - @param Multiplicand A 64-bit unsigned value. @param Multiplier A 32-bit unsigned value. @@ -2022,8 +1895,6 @@ MultU64x32 ( unsigned value Multiplier and generates a 64-bit unsigned result. This 64- bit unsigned result is returned. - If the result overflows, then ASSERT(). - @param Multiplicand A 64-bit unsigned value. @param Multiplier A 64-bit unsigned value. @@ -2046,8 +1917,6 @@ MultU64x64 ( signed value Multiplier and generates a 64-bit signed result. This 64-bit signed result is returned. - If the result overflows, then ASSERT(). - @param Multiplicand A 64-bit signed value. @param Multiplier A 64-bit signed value. @@ -2175,7 +2044,7 @@ DivU64x64Remainder ( NULL, then the 64-bit signed remainder is returned in Remainder. This function returns the 64-bit signed quotient. - It is the caller¡¯s responsibility to not call this function with a Divisor of 0. + It is the caller's responsibility to not call this function with a Divisor of 0. If Divisor is 0, then the quotient and remainder should be assumed to be the largest negative integer. @@ -2438,7 +2307,7 @@ BitFieldWrite8 ( Reads a bit field from an 8-bit value, performs a bitwise OR, and returns the result. - Performs a bitwise inclusive OR between the bit field specified by StartBit + Performs a bitwise OR between the bit field specified by StartBit and EndBit in Operand and the value specified by OrData. All other bits in Operand are preserved. The new 8-bit value is returned. @@ -2505,8 +2374,8 @@ BitFieldAnd8 ( bitwise OR, and returns the result. Performs a bitwise AND between the bit field specified by StartBit and EndBit - in Operand and the value specified by AndData, followed by a bitwise - inclusive OR with value specified by OrData. All other bits in Operand are + in Operand and the value specified by AndData, followed by a bitwise + OR with value specified by OrData. All other bits in Operand are preserved. The new 8-bit value is returned. If 8-bit operations are not supported, then ASSERT(). @@ -2600,7 +2469,7 @@ BitFieldWrite16 ( Reads a bit field from a 16-bit value, performs a bitwise OR, and returns the result. - Performs a bitwise inclusive OR between the bit field specified by StartBit + Performs a bitwise OR between the bit field specified by StartBit and EndBit in Operand and the value specified by OrData. All other bits in Operand are preserved. The new 16-bit value is returned. @@ -2667,8 +2536,8 @@ BitFieldAnd16 ( bitwise OR, and returns the result. Performs a bitwise AND between the bit field specified by StartBit and EndBit - in Operand and the value specified by AndData, followed by a bitwise - inclusive OR with value specified by OrData. All other bits in Operand are + in Operand and the value specified by AndData, followed by a bitwise + OR with value specified by OrData. All other bits in Operand are preserved. The new 16-bit value is returned. If 16-bit operations are not supported, then ASSERT(). @@ -2762,7 +2631,7 @@ BitFieldWrite32 ( Reads a bit field from a 32-bit value, performs a bitwise OR, and returns the result. - Performs a bitwise inclusive OR between the bit field specified by StartBit + Performs a bitwise OR between the bit field specified by StartBit and EndBit in Operand and the value specified by OrData. All other bits in Operand are preserved. The new 32-bit value is returned. @@ -2829,8 +2698,8 @@ BitFieldAnd32 ( bitwise OR, and returns the result. Performs a bitwise AND between the bit field specified by StartBit and EndBit - in Operand and the value specified by AndData, followed by a bitwise - inclusive OR with value specified by OrData. All other bits in Operand are + in Operand and the value specified by AndData, followed by a bitwise + OR with value specified by OrData. All other bits in Operand are preserved. The new 32-bit value is returned. If 32-bit operations are not supported, then ASSERT(). @@ -2924,7 +2793,7 @@ BitFieldWrite64 ( Reads a bit field from a 64-bit value, performs a bitwise OR, and returns the result. - Performs a bitwise inclusive OR between the bit field specified by StartBit + Performs a bitwise OR between the bit field specified by StartBit and EndBit in Operand and the value specified by OrData. All other bits in Operand are preserved. The new 64-bit value is returned. @@ -2991,8 +2860,8 @@ BitFieldAnd64 ( bitwise OR, and returns the result. Performs a bitwise AND between the bit field specified by StartBit and EndBit - in Operand and the value specified by AndData, followed by a bitwise - inclusive OR with value specified by OrData. All other bits in Operand are + in Operand and the value specified by AndData, followed by a bitwise + OR with value specified by OrData. All other bits in Operand are preserved. The new 64-bit value is returned. If 64-bit operations are not supported, then ASSERT(). @@ -3089,7 +2958,7 @@ InitializeSpinLock ( @param SpinLock A pointer to the spin lock to place in the acquired state. - @return SpinLock accquired lock. + @return SpinLock acquired lock. **/ SPIN_LOCK * @@ -3295,8 +3164,8 @@ InterlockedCompareExchangePointer ( UINT8 EFIAPI CalculateSum8 ( - IN CONST UINT8 *Buffer, - IN UINTN Length + IN CONST UINT8 *Buffer, + IN UINTN Length ); @@ -3315,14 +3184,14 @@ CalculateSum8 ( @param Buffer Pointer to the buffer to carry out the checksum operation. @param Length The size, in bytes, of Buffer. - @return Checksum The 2's complement checksum of Buffer. + @return Checksum The 2's complement checksum of Buffer. **/ UINT8 EFIAPI CalculateCheckSum8 ( - IN CONST UINT8 *Buffer, - IN UINTN Length + IN CONST UINT8 *Buffer, + IN UINTN Length ); @@ -3348,8 +3217,8 @@ CalculateCheckSum8 ( UINT16 EFIAPI CalculateSum16 ( - IN CONST UINT16 *Buffer, - IN UINTN Length + IN CONST UINT16 *Buffer, + IN UINTN Length ); @@ -3370,14 +3239,14 @@ CalculateSum16 ( @param Buffer Pointer to the buffer to carry out the checksum operation. @param Length The size, in bytes, of Buffer. - @return Checksum The 2's complement checksum of Buffer. + @return Checksum The 2's complement checksum of Buffer. **/ UINT16 EFIAPI CalculateCheckSum16 ( - IN CONST UINT16 *Buffer, - IN UINTN Length + IN CONST UINT16 *Buffer, + IN UINTN Length ); @@ -3403,8 +3272,8 @@ CalculateCheckSum16 ( UINT32 EFIAPI CalculateSum32 ( - IN CONST UINT32 *Buffer, - IN UINTN Length + IN CONST UINT32 *Buffer, + IN UINTN Length ); @@ -3425,14 +3294,14 @@ CalculateSum32 ( @param Buffer Pointer to the buffer to carry out the checksum operation. @param Length The size, in bytes, of Buffer. - @return Checksum The 2's complement checksum of Buffer. + @return Checksum The 2's complement checksum of Buffer. **/ UINT32 EFIAPI CalculateCheckSum32 ( - IN CONST UINT32 *Buffer, - IN UINTN Length + IN CONST UINT32 *Buffer, + IN UINTN Length ); @@ -3458,8 +3327,8 @@ CalculateCheckSum32 ( UINT64 EFIAPI CalculateSum64 ( - IN CONST UINT64 *Buffer, - IN UINTN Length + IN CONST UINT64 *Buffer, + IN UINTN Length ); @@ -3480,20 +3349,28 @@ CalculateSum64 ( @param Buffer Pointer to the buffer to carry out the checksum operation. @param Length The size, in bytes, of Buffer. - @return Checksum The 2's complement checksum of Buffer. + @return Checksum The 2's complement checksum of Buffer. **/ UINT64 EFIAPI CalculateCheckSum64 ( - IN CONST UINT64 *Buffer, - IN UINTN Length + IN CONST UINT64 *Buffer, + IN UINTN Length ); -/// -/// Base Library CPU Functions -/// +// +// Base Library CPU Functions +// + +/** + Function entry point used when a stack switch is requested with SwitchStack() + + @param Context1 Context1 parameter passed into SwitchStack(). + @param Context2 Context2 parameter passed into SwitchStack(). + +**/ typedef VOID (EFIAPI *SWITCH_STACK_ENTRY_POINT)( @@ -3737,21 +3614,20 @@ EFIAPI CpuDeadLoop ( VOID ); - + #if defined (MDE_CPU_IPF) /** Flush a range of cache lines in the cache coherency domain of the calling CPU. - Invalidates the cache lines specified by Address and Length. If Address is - not aligned on a cache line boundary, then entire cache line containing - Address is invalidated. If Address + Length is not aligned on a cache line - boundary, then the entire instruction cache line containing Address + Length - -1 is invalidated. This function may choose to invalidate the entire - instruction cache if that is more efficient than invalidating the specified - range. If Length is 0, the no instruction cache lines are invalidated. - Address is returned. + Flushes the cache lines specified by Address and Length. If Address is not aligned + on a cache line boundary, then entire cache line containing Address is flushed. + If Address + Length is not aligned on a cache line boundary, then the entire cache + line containing Address + Length - 1 is flushed. This function may choose to flush + the entire cache if that is more efficient than flushing the specified range. If + Length is 0, the no cache lines are flushed. Address is returned. + This function is only available on IPF. If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT(). @@ -3762,12 +3638,12 @@ CpuDeadLoop ( @param Length The number of bytes to invalidate from the instruction cache. - @return Address + @return Address. **/ VOID * EFIAPI -IpfFlushCacheRange ( +AsmFlushCacheRange ( IN VOID *Address, IN UINTN Length ); @@ -3779,7 +3655,7 @@ IpfFlushCacheRange ( The cache line size affected is at least 32-bytes (aligned on a 32-byte boundary). An implementation may flush a larger region. This function is only available on IPF. - @param Address The Address of cache line to be flushed. + @param Address The Address of cache line to be flushed. @return The address of FC instruction executed. @@ -3797,7 +3673,7 @@ AsmFc ( The cache line size affected is at least 32-bytes (aligned on a 32-byte boundary). An implementation may flush a larger region. This function is only available on IPF. - @param Address The Address of cache line to be flushed. + @param Address The Address of cache line to be flushed. @return The address of FC.I instruction executed. @@ -3820,7 +3696,7 @@ AsmFci ( must either guarantee that Index is valid, or the caller must set up fault handlers to catch the faults. This function is only available on IPF. - @param Index The 8-bit Processor Identifier Register index to read. + @param Index The 8-bit Processor Identifier Register index to read. @return The current value of Processor Identifier Register specified by Index. @@ -3854,7 +3730,7 @@ AsmReadPsr ( The caller must either guarantee that Value is valid, or the caller must set up fault handlers to catch the faults. This function is only available on IPF. - @param Value The 64-bit value to write to PSR. + @param Value The 64-bit value to write to PSR. @return The 64-bit value written to the PSR. @@ -3868,6 +3744,8 @@ AsmWritePsr ( /** Reads the current value of 64-bit Kernel Register #0 (KR0). + + Reads and returns the current value of KR0. This function is only available on IPF. @return The current value of KR0. @@ -3882,6 +3760,8 @@ AsmReadKr0 ( /** Reads the current value of 64-bit Kernel Register #1 (KR1). + + Reads and returns the current value of KR1. This function is only available on IPF. @return The current value of KR1. @@ -3896,6 +3776,8 @@ AsmReadKr1 ( /** Reads the current value of 64-bit Kernel Register #2 (KR2). + + Reads and returns the current value of KR2. This function is only available on IPF. @return The current value of KR2. @@ -3910,6 +3792,8 @@ AsmReadKr2 ( /** Reads the current value of 64-bit Kernel Register #3 (KR3). + + Reads and returns the current value of KR3. This function is only available on IPF. @return The current value of KR3. @@ -3924,8 +3808,10 @@ AsmReadKr3 ( /** Reads the current value of 64-bit Kernel Register #4 (KR4). - This function is only available on IPF. + Reads and returns the current value of KR4. + This function is only available on IPF. + @return The current value of KR4. **/ @@ -3938,6 +3824,8 @@ AsmReadKr4 ( /** Reads the current value of 64-bit Kernel Register #5 (KR5). + + Reads and returns the current value of KR5. This function is only available on IPF. @return The current value of KR5. @@ -3952,6 +3840,8 @@ AsmReadKr5 ( /** Reads the current value of 64-bit Kernel Register #6 (KR6). + + Reads and returns the current value of KR6. This function is only available on IPF. @return The current value of KR6. @@ -3966,6 +3856,8 @@ AsmReadKr6 ( /** Reads the current value of 64-bit Kernel Register #7 (KR7). + + Reads and returns the current value of KR7. This function is only available on IPF. @return The current value of KR7. @@ -3980,9 +3872,11 @@ AsmReadKr7 ( /** Write the current value of 64-bit Kernel Register #0 (KR0). - This function is only available on IPF. + + Writes the current value of KR0. The 64-bit value written to + the KR0 is returned. This function is only available on IPF. - @param Value The 64-bit value to write to KR0. + @param Value The 64-bit value to write to KR0. @return The 64-bit value written to the KR0. @@ -3996,9 +3890,11 @@ AsmWriteKr0 ( /** Write the current value of 64-bit Kernel Register #1 (KR1). - This function is only available on IPF. - @param Value The 64-bit value to write to KR1. + Writes the current value of KR1. The 64-bit value written to + the KR1 is returned. This function is only available on IPF. + + @param Value The 64-bit value to write to KR1. @return The 64-bit value written to the KR1. @@ -4012,9 +3908,11 @@ AsmWriteKr1 ( /** Write the current value of 64-bit Kernel Register #2 (KR2). - This function is only available on IPF. - @param Value The 64-bit value to write to KR2. + Writes the current value of KR2. The 64-bit value written to + the KR2 is returned. This function is only available on IPF. + + @param Value The 64-bit value to write to KR2. @return The 64-bit value written to the KR2. @@ -4028,9 +3926,11 @@ AsmWriteKr2 ( /** Write the current value of 64-bit Kernel Register #3 (KR3). - This function is only available on IPF. - @param Value The 64-bit value to write to KR3. + Writes the current value of KR3. The 64-bit value written to + the KR3 is returned. This function is only available on IPF. + + @param Value The 64-bit value to write to KR3. @return The 64-bit value written to the KR3. @@ -4044,9 +3944,11 @@ AsmWriteKr3 ( /** Write the current value of 64-bit Kernel Register #4 (KR4). - This function is only available on IPF. - @param Value The 64-bit value to write to KR4. + Writes the current value of KR4. The 64-bit value written to + the KR4 is returned. This function is only available on IPF. + + @param Value The 64-bit value to write to KR4. @return The 64-bit value written to the KR4. @@ -4060,9 +3962,11 @@ AsmWriteKr4 ( /** Write the current value of 64-bit Kernel Register #5 (KR5). - This function is only available on IPF. - @param Value The 64-bit value to write to KR5. + Writes the current value of KR5. The 64-bit value written to + the KR5 is returned. This function is only available on IPF. + + @param Value The 64-bit value to write to KR5. @return The 64-bit value written to the KR5. @@ -4076,9 +3980,11 @@ AsmWriteKr5 ( /** Write the current value of 64-bit Kernel Register #6 (KR6). - This function is only available on IPF. - @param Value The 64-bit value to write to KR6. + Writes the current value of KR6. The 64-bit value written to + the KR6 is returned. This function is only available on IPF. + + @param Value The 64-bit value to write to KR6. @return The 64-bit value written to the KR6. @@ -4092,9 +3998,11 @@ AsmWriteKr6 ( /** Write the current value of 64-bit Kernel Register #7 (KR7). - This function is only available on IPF. - @param Value The 64-bit value to write to KR7. + Writes the current value of KR7. The 64-bit value written to + the KR7 is returned. This function is only available on IPF. + + @param Value The 64-bit value to write to KR7. @return The 64-bit value written to the KR7. @@ -4108,6 +4016,8 @@ AsmWriteKr7 ( /** Reads the current value of Interval Timer Counter Register (ITC). + + Reads and returns the current value of ITC. This function is only available on IPF. @return The current value of ITC. @@ -4122,6 +4032,8 @@ AsmReadItc ( /** Reads the current value of Interval Timer Vector Register (ITV). + + Reads and returns the current value of ITV. This function is only available on IPF. @return The current value of ITV. @@ -4136,6 +4048,8 @@ AsmReadItv ( /** Reads the current value of Interval Timer Match Register (ITM). + + Reads and returns the current value of ITM. This function is only available on IPF. @return The current value of ITM. @@ -4149,9 +4063,11 @@ AsmReadItm ( /** Writes the current value of 64-bit Interval Timer Counter Register (ITC). + + Writes the current value of ITC. The 64-bit value written to the ITC is returned. This function is only available on IPF. - @param Value The 64-bit value to write to ITC. + @param Value The 64-bit value to write to ITC. @return The 64-bit value written to the ITC. @@ -4165,9 +4081,11 @@ AsmWriteItc ( /** Writes the current value of 64-bit Interval Timer Match Register (ITM). + + Writes the current value of ITM. The 64-bit value written to the ITM is returned. This function is only available on IPF. - @param Value The 64-bit value to write to ITM. + @param Value The 64-bit value to write to ITM. @return The 64-bit value written to the ITM. @@ -4181,13 +4099,15 @@ AsmWriteItm ( /** Writes the current value of 64-bit Interval Timer Vector Register (ITV). + + Writes the current value of ITV. The 64-bit value written to the ITV is returned. No parameter checking is performed on Value. All bits of Value corresponding to reserved fields of ITV must be 0 or a Reserved Register/Field fault may occur. The caller must either guarantee that Value is valid, or the caller must set up fault handlers to catch the faults. This function is only available on IPF. - @param Value The 64-bit value to write to ITV. + @param Value The 64-bit value to write to ITV. @return The 64-bit value written to the ITV. @@ -4201,7 +4121,8 @@ AsmWriteItv ( /** Reads the current value of Default Control Register (DCR). - This function is only available on IPF. + + Reads and returns the current value of DCR. This function is only available on IPF. @return The current value of DCR. @@ -4215,7 +4136,8 @@ AsmReadDcr ( /** Reads the current value of Interruption Vector Address Register (IVA). - This function is only available on IPF. + + Reads and returns the current value of IVA. This function is only available on IPF. @return The current value of IVA. **/ @@ -4228,7 +4150,8 @@ AsmReadIva ( /** Reads the current value of Page Table Address Register (PTA). - This function is only available on IPF. + + Reads and returns the current value of PTA. This function is only available on IPF. @return The current value of PTA. @@ -4242,13 +4165,15 @@ AsmReadPta ( /** Writes the current value of 64-bit Default Control Register (DCR). + + Writes the current value of DCR. The 64-bit value written to the DCR is returned. No parameter checking is performed on Value. All bits of Value corresponding to reserved fields of DCR must be 0 or a Reserved Register/Field fault may occur. The caller must either guarantee that Value is valid, or the caller must set up fault handlers to catch the faults. This function is only available on IPF. - @param Value The 64-bit value to write to DCR. + @param Value The 64-bit value to write to DCR. @return The 64-bit value written to the DCR. @@ -4262,11 +4187,13 @@ AsmWriteDcr ( /** Writes the current value of 64-bit Interruption Vector Address Register (IVA). + + Writes the current value of IVA. The 64-bit value written to the IVA is returned. The size of vector table is 32 K bytes and is 32 K bytes aligned the low 15 bits of Value is ignored when written. This function is only available on IPF. - @param Value The 64-bit value to write to IVA. + @param Value The 64-bit value to write to IVA. @return The 64-bit value written to the IVA. @@ -4280,13 +4207,15 @@ AsmWriteIva ( /** Writes the current value of 64-bit Page Table Address Register (PTA). + + Writes the current value of PTA. The 64-bit value written to the PTA is returned. No parameter checking is performed on Value. All bits of Value corresponding to reserved fields of DCR must be 0 or a Reserved Register/Field fault may occur. The caller must either guarantee that Value is valid, or the caller must set up fault handlers to catch the faults. This function is only available on IPF. - @param Value The 64-bit value to write to PTA. + @param Value The 64-bit value to write to PTA. @return The 64-bit value written to the PTA. **/ @@ -4299,7 +4228,8 @@ AsmWritePta ( /** Reads the current value of Local Interrupt ID Register (LID). - This function is only available on IPF. + + Reads and returns the current value of LID. This function is only available on IPF. @return The current value of LID. @@ -4313,7 +4243,8 @@ AsmReadLid ( /** Reads the current value of External Interrupt Vector Register (IVR). - This function is only available on IPF. + + Reads and returns the current value of IVR. This function is only available on IPF. @return The current value of IVR. @@ -4327,7 +4258,8 @@ AsmReadIvr ( /** Reads the current value of Task Priority Register (TPR). - This function is only available on IPF. + + Reads and returns the current value of TPR. This function is only available on IPF. @return The current value of TPR. @@ -4341,7 +4273,8 @@ AsmReadTpr ( /** Reads the current value of External Interrupt Request Register #0 (IRR0). - This function is only available on IPF. + + Reads and returns the current value of IRR0. This function is only available on IPF. @return The current value of IRR0. @@ -4355,7 +4288,8 @@ AsmReadIrr0 ( /** Reads the current value of External Interrupt Request Register #1 (IRR1). - This function is only available on IPF. + + Reads and returns the current value of IRR1. This function is only available on IPF. @return The current value of IRR1. @@ -4369,7 +4303,8 @@ AsmReadIrr1 ( /** Reads the current value of External Interrupt Request Register #2 (IRR2). - This function is only available on IPF. + + Reads and returns the current value of IRR2. This function is only available on IPF. @return The current value of IRR2. @@ -4383,7 +4318,8 @@ AsmReadIrr2 ( /** Reads the current value of External Interrupt Request Register #3 (IRR3). - This function is only available on IPF. + + Reads and returns the current value of IRR3. This function is only available on IPF. @return The current value of IRR3. @@ -4397,7 +4333,8 @@ AsmReadIrr3 ( /** Reads the current value of Performance Monitor Vector Register (PMV). - This function is only available on IPF. + + Reads and returns the current value of PMV. This function is only available on IPF. @return The current value of PMV. @@ -4411,7 +4348,8 @@ AsmReadPmv ( /** Reads the current value of Corrected Machine Check Vector Register (CMCV). - This function is only available on IPF. + + Reads and returns the current value of CMCV. This function is only available on IPF. @return The current value of CMCV. @@ -4425,7 +4363,8 @@ AsmReadCmcv ( /** Reads the current value of Local Redirection Register #0 (LRR0). - This function is only available on IPF. + + Reads and returns the current value of LRR0. This function is only available on IPF. @return The current value of LRR0. @@ -4439,7 +4378,8 @@ AsmReadLrr0 ( /** Reads the current value of Local Redirection Register #1 (LRR1). - This function is only available on IPF. + + Reads and returns the current value of LRR1. This function is only available on IPF. @return The current value of LRR1. @@ -4453,13 +4393,15 @@ AsmReadLrr1 ( /** Writes the current value of 64-bit Page Local Interrupt ID Register (LID). + + Writes the current value of LID. The 64-bit value written to the LID is returned. No parameter checking is performed on Value. All bits of Value corresponding to reserved fields of LID must be 0 or a Reserved Register/Field fault may occur. The caller must either guarantee that Value is valid, or the caller must set up fault handlers to catch the faults. This function is only available on IPF. - @param Value The 64-bit value to write to LID. + @param Value The 64-bit value to write to LID. @return The 64-bit value written to the LID. @@ -4473,13 +4415,15 @@ AsmWriteLid ( /** Writes the current value of 64-bit Task Priority Register (TPR). + + Writes the current value of TPR. The 64-bit value written to the TPR is returned. No parameter checking is performed on Value. All bits of Value corresponding to reserved fields of TPR must be 0 or a Reserved Register/Field fault may occur. The caller must either guarantee that Value is valid, or the caller must set up fault handlers to catch the faults. This function is only available on IPF. - @param Value The 64-bit value to write to TPR. + @param Value The 64-bit value to write to TPR. @return The 64-bit value written to the TPR. @@ -4493,6 +4437,7 @@ AsmWriteTpr ( /** Performs a write operation on End OF External Interrupt Register (EOI). + Writes a value of 0 to the EOI Register. This function is only available on IPF. **/ @@ -4505,13 +4450,15 @@ AsmWriteEoi ( /** Writes the current value of 64-bit Performance Monitor Vector Register (PMV). + + Writes the current value of PMV. The 64-bit value written to the PMV is returned. No parameter checking is performed on Value. All bits of Value corresponding to reserved fields of PMV must be 0 or a Reserved Register/Field fault may occur. The caller must either guarantee that Value is valid, or the caller must set up fault handlers to catch the faults. This function is only available on IPF. - @param Value The 64-bit value to write to PMV. + @param Value The 64-bit value to write to PMV. @return The 64-bit value written to the PMV. @@ -4525,13 +4472,15 @@ AsmWritePmv ( /** Writes the current value of 64-bit Corrected Machine Check Vector Register (CMCV). + + Writes the current value of CMCV. The 64-bit value written to the CMCV is returned. No parameter checking is performed on Value. All bits of Value corresponding to reserved fields of CMCV must be 0 or a Reserved Register/Field fault may occur. The caller must either guarantee that Value is valid, or the caller must set up fault handlers to catch the faults. This function is only available on IPF. - @param Value The 64-bit value to write to CMCV. + @param Value The 64-bit value to write to CMCV. @return The 64-bit value written to the CMCV. @@ -4545,13 +4494,15 @@ AsmWriteCmcv ( /** Writes the current value of 64-bit Local Redirection Register #0 (LRR0). + + Writes the current value of LRR0. The 64-bit value written to the LRR0 is returned. No parameter checking is performed on Value. All bits of Value corresponding to reserved fields of LRR0 must be 0 or a Reserved Register/Field fault may occur. The caller must either guarantee that Value is valid, or the caller must set up fault handlers to catch the faults. This function is only available on IPF. - @param Value The 64-bit value to write to LRR0. + @param Value The 64-bit value to write to LRR0. @return The 64-bit value written to the LRR0. @@ -4565,13 +4516,15 @@ AsmWriteLrr0 ( /** Writes the current value of 64-bit Local Redirection Register #1 (LRR1). + + Writes the current value of LRR1. The 64-bit value written to the LRR1 is returned. No parameter checking is performed on Value. All bits of Value corresponding to reserved fields of LRR1 must be 0 or a Reserved Register/Field fault may occur. The caller must either guarantee that Value is valid, or the caller must set up fault handlers to catch the faults. This function is only available on IPF. - @param Value The 64-bit value to write to LRR1. + @param Value The 64-bit value to write to LRR1. @return The 64-bit value written to the LRR1. @@ -4596,7 +4549,7 @@ AsmWriteLrr1 ( set up fault handlers to catch the faults. This function is only available on IPF. - @param Index The 8-bit Instruction Breakpoint Register index to read. + @param Index The 8-bit Instruction Breakpoint Register index to read. @return The current value of Instruction Breakpoint Register specified by Index. @@ -4621,7 +4574,7 @@ AsmReadIbr ( fault handlers to catch the faults. This function is only available on IPF. - @param Index The 8-bit Data Breakpoint Register index to read. + @param Index The 8-bit Data Breakpoint Register index to read. @return The current value of Data Breakpoint Register specified by Index. @@ -4646,10 +4599,10 @@ AsmReadDbr ( zero value will be returned. This function is only available on IPF. - @param Index The 8-bit Performance Monitor Configuration Register index to read. + @param Index The 8-bit Performance Monitor Configuration Register index to read. - @return The current value of Performance Monitor Configuration Register - specified by Index. + @return The current value of Performance Monitor Configuration Register + specified by Index. **/ UINT64 @@ -4672,7 +4625,7 @@ AsmReadPmc ( zero value will be returned. This function is only available on IPF. - @param Index The 8-bit Performance Monitor Data Register index to read. + @param Index The 8-bit Performance Monitor Data Register index to read. @return The current value of Performance Monitor Data Register specified by Index. @@ -4698,8 +4651,8 @@ AsmReadPmd ( set up fault handlers to catch the faults. This function is only available on IPF. - @param Index The 8-bit Instruction Breakpoint Register index to write. - @param Value The 64-bit value to write to IBR. + @param Index The 8-bit Instruction Breakpoint Register index to write. + @param Value The 64-bit value to write to IBR. @return The 64-bit value written to the IBR. @@ -4726,8 +4679,8 @@ AsmWriteIbr ( catch the faults. This function is only available on IPF. - @param Index The 8-bit Data Breakpoint Register index to write. - @param Value The 64-bit value to write to DBR. + @param Index The 8-bit Data Breakpoint Register index to write. + @param Value The 64-bit value to write to DBR. @return The 64-bit value written to the DBR. @@ -4753,8 +4706,8 @@ AsmWriteDbr ( beyond the implemented PMC register range, the write is ignored. This function is only available on IPF. - @param Index The 8-bit Performance Monitor Configuration Register index to write. - @param Value The 64-bit value to write to PMC. + @param Index The 8-bit Performance Monitor Configuration Register index to write. + @param Value The 64-bit value to write to PMC. @return The 64-bit value written to the PMC. @@ -4780,8 +4733,8 @@ AsmWritePmc ( Index value is beyond the implemented PMD register range, the write is ignored. This function is only available on IPF. - @param Index The 8-bit Performance Monitor Data Register index to write. - @param Value The 64-bit value to write to PMD. + @param Index The 8-bit Performance Monitor Data Register index to write. + @param Value The 64-bit value to write to PMD. @return The 64-bit value written to the PMD. @@ -4845,6 +4798,105 @@ AsmReadSp ( ); +/// +/// Valid Index value for AsmReadControlRegister() +/// +#define IPF_CONTROL_REGISTER_DCR 0 +#define IPF_CONTROL_REGISTER_ITM 1 +#define IPF_CONTROL_REGISTER_IVA 2 +#define IPF_CONTROL_REGISTER_PTA 8 +#define IPF_CONTROL_REGISTER_IPSR 16 +#define IPF_CONTROL_REGISTER_ISR 17 +#define IPF_CONTROL_REGISTER_IIP 19 +#define IPF_CONTROL_REGISTER_IFA 20 +#define IPF_CONTROL_REGISTER_ITIR 21 +#define IPF_CONTROL_REGISTER_IIPA 22 +#define IPF_CONTROL_REGISTER_IFS 23 +#define IPF_CONTROL_REGISTER_IIM 24 +#define IPF_CONTROL_REGISTER_IHA 25 +#define IPF_CONTROL_REGISTER_LID 64 +#define IPF_CONTROL_REGISTER_IVR 65 +#define IPF_CONTROL_REGISTER_TPR 66 +#define IPF_CONTROL_REGISTER_EOI 67 +#define IPF_CONTROL_REGISTER_IRR0 68 +#define IPF_CONTROL_REGISTER_IRR1 69 +#define IPF_CONTROL_REGISTER_IRR2 70 +#define IPF_CONTROL_REGISTER_IRR3 71 +#define IPF_CONTROL_REGISTER_ITV 72 +#define IPF_CONTROL_REGISTER_PMV 73 +#define IPF_CONTROL_REGISTER_CMCV 74 +#define IPF_CONTROL_REGISTER_LRR0 80 +#define IPF_CONTROL_REGISTER_LRR1 81 + +/** + Reads a 64-bit control register. + + Reads and returns the control register specified by Index. The valid Index valued are defined + above in "Related Definitions". + If Index is invalid then 0xFFFFFFFFFFFFFFFF is returned. This function is only available on IPF. + + @param Index The index of the control register to read. + + @return The control register specified by Index. + +**/ +UINT64 +EFIAPI +AsmReadControlRegister ( + IN UINT64 Index + ); + + +/// +/// Valid Index value for AsmReadApplicationRegister() +/// +#define IPF_APPLICATION_REGISTER_K0 0 +#define IPF_APPLICATION_REGISTER_K1 1 +#define IPF_APPLICATION_REGISTER_K2 2 +#define IPF_APPLICATION_REGISTER_K3 3 +#define IPF_APPLICATION_REGISTER_K4 4 +#define IPF_APPLICATION_REGISTER_K5 5 +#define IPF_APPLICATION_REGISTER_K6 6 +#define IPF_APPLICATION_REGISTER_K7 7 +#define IPF_APPLICATION_REGISTER_RSC 16 +#define IPF_APPLICATION_REGISTER_BSP 17 +#define IPF_APPLICATION_REGISTER_BSPSTORE 18 +#define IPF_APPLICATION_REGISTER_RNAT 19 +#define IPF_APPLICATION_REGISTER_FCR 21 +#define IPF_APPLICATION_REGISTER_EFLAG 24 +#define IPF_APPLICATION_REGISTER_CSD 25 +#define IPF_APPLICATION_REGISTER_SSD 26 +#define IPF_APPLICATION_REGISTER_CFLG 27 +#define IPF_APPLICATION_REGISTER_FSR 28 +#define IPF_APPLICATION_REGISTER_FIR 29 +#define IPF_APPLICATION_REGISTER_FDR 30 +#define IPF_APPLICATION_REGISTER_CCV 32 +#define IPF_APPLICATION_REGISTER_UNAT 36 +#define IPF_APPLICATION_REGISTER_FPSR 40 +#define IPF_APPLICATION_REGISTER_ITC 44 +#define IPF_APPLICATION_REGISTER_PFS 64 +#define IPF_APPLICATION_REGISTER_LC 65 +#define IPF_APPLICATION_REGISTER_EC 66 + +/** + Reads a 64-bit application register. + + Reads and returns the application register specified by Index. The valid Index valued are defined + above in "Related Definitions". + If Index is invalid then 0xFFFFFFFFFFFFFFFF is returned. This function is only available on IPF. + + @param Index The index of the application register to read. + + @return The application register specified by Index. + +**/ +UINT64 +EFIAPI +AsmReadApplicationRegister ( + IN UINT64 Index + ); + + /** Determines if the CPU is currently executing in virtual, physical, or mixed mode. @@ -4889,11 +4941,11 @@ AsmCpuVirtual ( PAL entry point then the system behavior is undefined. This function is only available on IPF. - @param PalEntryPoint The PAL procedure calls entry point. - @param Index The PAL procedure Index number. - @param Arg2 The 2nd parameter for PAL procedure calls. - @param Arg3 The 3rd parameter for PAL procedure calls. - @param Arg4 The 4th parameter for PAL procedure calls. + @param PalEntryPoint The PAL procedure calls entry point. + @param Index The PAL procedure Index number. + @param Arg2 The 2nd parameter for PAL procedure calls. + @param Arg3 The 3rd parameter for PAL procedure calls. + @param Arg4 The 4th parameter for PAL procedure calls. @return structure returned from the PAL Call procedure, including the status and return value. @@ -4909,89 +4961,28 @@ AsmPalCall ( ); -/** - Transfers control to a function starting with a new stack. - - Transfers control to the function specified by EntryPoint using the new stack - specified by NewStack and passing in the parameters specified by Context1 and - Context2. Context1 and Context2 are optional and may be NULL. The function - EntryPoint must never return. - - If EntryPoint is NULL, then ASSERT(). - If NewStack is NULL, then ASSERT(). - - @param EntryPoint A pointer to function to call with the new stack. - @param Context1 A pointer to the context to pass into the EntryPoint - function. - @param Context2 A pointer to the context to pass into the EntryPoint - function. - @param NewStack A pointer to the new stack to use for the EntryPoint - function. - @param NewBsp A pointer to the new memory location for RSE backing - store. - -**/ -VOID -EFIAPI -AsmSwitchStackAndBackingStore ( - IN SWITCH_STACK_ENTRY_POINT EntryPoint, - IN VOID *Context1, OPTIONAL - IN VOID *Context2, OPTIONAL - IN VOID *NewStack, - IN VOID *NewBsp - ); - -/** - @todo This call should be removed after the PalCall - Instance issue has been fixed. - - Performs a PAL call using static calling convention. - - An internal function to perform a PAL call using static calling convention. - - @param PalEntryPoint The entry point address of PAL. The address in ar.kr5 - would be used if this parameter were NULL on input. - @param Arg1 The first argument of a PAL call. - @param Arg2 The second argument of a PAL call. - @param Arg3 The third argument of a PAL call. - @param Arg4 The fourth argument of a PAL call. - - @return The values returned in r8, r9, r10 and r11. - -**/ -PAL_CALL_RETURN -PalCallStatic ( - IN CONST VOID *PalEntryPoint, - IN UINT64 Arg1, - IN UINT64 Arg2, - IN UINT64 Arg3, - IN UINT64 Arg4 - ); - - - #elif defined (MDE_CPU_IA32) || defined (MDE_CPU_X64) /// -/// IA32 and X64 Specific Functions +/// IA32 and x64 Specific Functions /// Byte packed structure for 16-bit Real Mode EFLAGS /// typedef union { struct { - UINT32 CF:1; /// Carry Flag - UINT32 Reserved_0:1; /// Reserved - UINT32 PF:1; /// Parity Flag - UINT32 Reserved_1:1; /// Reserved - UINT32 AF:1; /// Auxiliary Carry Flag - UINT32 Reserved_2:1; /// Reserved - UINT32 ZF:1; /// Zero Flag - UINT32 SF:1; /// Sign Flag - UINT32 TF:1; /// Trap Flag - UINT32 IF:1; /// Interrupt Enable Flag - UINT32 DF:1; /// Direction Flag - UINT32 OF:1; /// Overflow Flag - UINT32 IOPL:2; /// I/O Privilege Level - UINT32 NT:1; /// Nested Task - UINT32 Reserved_3:1; /// Reserved + UINT32 CF:1; ///< Carry Flag + UINT32 Reserved_0:1; ///< Reserved + UINT32 PF:1; ///< Parity Flag + UINT32 Reserved_1:1; ///< Reserved + UINT32 AF:1; ///< Auxiliary Carry Flag + UINT32 Reserved_2:1; ///< Reserved + UINT32 ZF:1; ///< Zero Flag + UINT32 SF:1; ///< Sign Flag + UINT32 TF:1; ///< Trap Flag + UINT32 IF:1; ///< Interrupt Enable Flag + UINT32 DF:1; ///< Direction Flag + UINT32 OF:1; ///< Overflow Flag + UINT32 IOPL:2; ///< I/O Privilege Level + UINT32 NT:1; ///< Nested Task + UINT32 Reserved_3:1; ///< Reserved } Bits; UINT16 Uint16; } IA32_FLAGS16; @@ -4999,32 +4990,32 @@ typedef union { /// /// Byte packed structure for EFLAGS/RFLAGS /// 32-bits on IA-32 -/// 64-bits on X64. The upper 32-bits on X64 are reserved +/// 64-bits on x64. The upper 32-bits on x64 are reserved /// typedef union { struct { - UINT32 CF:1; /// Carry Flag - UINT32 Reserved_0:1; /// Reserved - UINT32 PF:1; /// Parity Flag - UINT32 Reserved_1:1; /// Reserved - UINT32 AF:1; /// Auxiliary Carry Flag - UINT32 Reserved_2:1; /// Reserved - UINT32 ZF:1; /// Zero Flag - UINT32 SF:1; /// Sign Flag - UINT32 TF:1; /// Trap Flag - UINT32 IF:1; /// Interrupt Enable Flag - UINT32 DF:1; /// Direction Flag - UINT32 OF:1; /// Overflow Flag - UINT32 IOPL:2; /// I/O Privilege Level - UINT32 NT:1; /// Nested Task - UINT32 Reserved_3:1; /// Reserved - UINT32 RF:1; /// Resume Flag - UINT32 VM:1; /// Virtual 8086 Mode - UINT32 AC:1; /// Alignment Check - UINT32 VIF:1; /// Virtual Interrupt Flag - UINT32 VIP:1; /// Virtual Interrupt Pending - UINT32 ID:1; /// ID Flag - UINT32 Reserved_4:10; /// Reserved + UINT32 CF:1; ///< Carry Flag + UINT32 Reserved_0:1; ///< Reserved + UINT32 PF:1; ///< Parity Flag + UINT32 Reserved_1:1; ///< Reserved + UINT32 AF:1; ///< Auxiliary Carry Flag + UINT32 Reserved_2:1; ///< Reserved + UINT32 ZF:1; ///< Zero Flag + UINT32 SF:1; ///< Sign Flag + UINT32 TF:1; ///< Trap Flag + UINT32 IF:1; ///< Interrupt Enable Flag + UINT32 DF:1; ///< Direction Flag + UINT32 OF:1; ///< Overflow Flag + UINT32 IOPL:2; ///< I/O Privilege Level + UINT32 NT:1; ///< Nested Task + UINT32 Reserved_3:1; ///< Reserved + UINT32 RF:1; ///< Resume Flag + UINT32 VM:1; ///< Virtual 8086 Mode + UINT32 AC:1; ///< Alignment Check + UINT32 VIF:1; ///< Virtual Interrupt Flag + UINT32 VIP:1; ///< Virtual Interrupt Pending + UINT32 ID:1; ///< ID Flag + UINT32 Reserved_4:10; ///< Reserved } Bits; UINTN UintN; } IA32_EFLAGS32; @@ -5032,24 +5023,24 @@ typedef union { /// /// Byte packed structure for Control Register 0 (CR0) /// 32-bits on IA-32 -/// 64-bits on X64. The upper 32-bits on X64 are reserved +/// 64-bits on x64. The upper 32-bits on x64 are reserved /// typedef union { struct { - UINT32 PE:1; /// Protection Enable - UINT32 MP:1; /// Monitor Coprocessor - UINT32 EM:1; /// Emulation - UINT32 TS:1; /// Task Switched - UINT32 ET:1; /// Extension Type - UINT32 NE:1; /// Numeric Error - UINT32 Reserved_0:10; /// Reserved - UINT32 WP:1; /// Write Protect - UINT32 Reserved_1:1; /// Reserved - UINT32 AM:1; /// Alignment Mask - UINT32 Reserved_2:10; /// Reserved - UINT32 NW:1; /// Mot Write-through - UINT32 CD:1; /// Cache Disable - UINT32 PG:1; /// Paging + UINT32 PE:1; ///< Protection Enable + UINT32 MP:1; ///< Monitor Coprocessor + UINT32 EM:1; ///< Emulation + UINT32 TS:1; ///< Task Switched + UINT32 ET:1; ///< Extension Type + UINT32 NE:1; ///< Numeric Error + UINT32 Reserved_0:10; ///< Reserved + UINT32 WP:1; ///< Write Protect + UINT32 Reserved_1:1; ///< Reserved + UINT32 AM:1; ///< Alignment Mask + UINT32 Reserved_2:10; ///< Reserved + UINT32 NW:1; ///< Mot Write-through + UINT32 CD:1; ///< Cache Disable + UINT32 PG:1; ///< Paging } Bits; UINTN UintN; } IA32_CR0; @@ -5057,35 +5048,34 @@ typedef union { /// /// Byte packed structure for Control Register 4 (CR4) /// 32-bits on IA-32 -/// 64-bits on X64. The upper 32-bits on X64 are reserved +/// 64-bits on x64. The upper 32-bits on x64 are reserved /// typedef union { struct { - UINT32 VME:1; /// Virtual-8086 Mode Extensions - UINT32 PVI:1; /// Protected-Mode Virtual Interrupts - UINT32 TSD:1; /// Time Stamp Disable - UINT32 DE:1; /// Debugging Extensions - UINT32 PSE:1; /// Page Size Extensions - UINT32 PAE:1; /// Physical Address Extension - UINT32 MCE:1; /// Machine Check Enable - UINT32 PGE:1; /// Page Global Enable - UINT32 PCE:1; /// Performance Monitoring Counter - /// Enable - UINT32 OSFXSR:1; /// Operating System Support for - /// FXSAVE and FXRSTOR instructions - UINT32 OSXMMEXCPT:1; /// Operating System Support for - /// Unmasked SIMD Floating Point - /// Exceptions - UINT32 Reserved_0:2; /// Reserved - UINT32 VMXE:1; /// VMX Enable - UINT32 Reserved_1:18; /// Reseved + UINT32 VME:1; ///< Virtual-8086 Mode Extensions + UINT32 PVI:1; ///< Protected-Mode Virtual Interrupts + UINT32 TSD:1; ///< Time Stamp Disable + UINT32 DE:1; ///< Debugging Extensions + UINT32 PSE:1; ///< Page Size Extensions + UINT32 PAE:1; ///< Physical Address Extension + UINT32 MCE:1; ///< Machine Check Enable + UINT32 PGE:1; ///< Page Global Enable + UINT32 PCE:1; ///< Performance Monitoring Counter + ///< Enable + UINT32 OSFXSR:1; ///< Operating System Support for + ///< FXSAVE and FXRSTOR instructions + UINT32 OSXMMEXCPT:1; ///< Operating System Support for + ///< Unmasked SIMD Floating Point + ///< Exceptions + UINT32 Reserved_0:2; ///< Reserved + UINT32 VMXE:1; ///< VMX Enable + UINT32 Reserved_1:18; ///< Reseved } Bits; UINTN UintN; } IA32_CR4; /// /// Byte packed structure for an IDTR, GDTR, LDTR descriptor -/// @todo How to make this structure byte-packed in a compiler independent way? /// #pragma pack (1) typedef struct { @@ -5232,7 +5222,7 @@ typedef struct { If Ebx is not NULL, then the value of EBX after CPUID is returned in Ebx. If Ecx is not NULL, then the value of ECX after CPUID is returned in Ecx. If Edx is not NULL, then the value of EDX after CPUID is returned in Edx. - This function is only available on IA-32 and X64. + This function is only available on IA-32 and x64. @param Index The 32-bit value to load into EAX prior to invoking the CPUID instruction. @@ -5245,7 +5235,7 @@ typedef struct { @param Edx Pointer to the 32-bit EDX value returned by the CPUID instruction. This is an optional parameter that may be NULL. - @return Index + @return Index. **/ UINT32 @@ -5288,7 +5278,7 @@ AsmCpuid ( instruction. This is an optional parameter that may be NULL. - @return Index + @return Index. **/ UINT32 @@ -5303,6 +5293,34 @@ AsmCpuidEx ( ); +/** + Set CD bit and clear NW bit of CR0 followed by a WBINVD. + + Disables the caches by setting the CD bit of CR0 to 1, clearing the NW bit of CR0 to 0, + and executing a WBINVD instruction. This function is only available on IA-32 and x64. + +**/ +VOID +EFIAPI +AsmDisableCache ( + VOID + ); + + +/** + Perform a WBINVD and clear both the CD and NW bits of CR0. + + Enables the caches by executing a WBINVD instruction and then clear both the CD and NW + bits of CR0 to 0. This function is only available on IA-32 and x64. + +**/ +VOID +EFIAPI +AsmEnableCache ( + VOID + ); + + /** Returns the lower 32-bits of a Machine Specific Register(MSR). @@ -5310,7 +5328,7 @@ AsmCpuidEx ( No parameter checking is performed on Index, and some Index values may cause CPU exceptions. The caller must either guarantee that Index is valid, or the caller must set up exception handlers to catch the exceptions. This function - is only available on IA-32 and X64. + is only available on IA-32 and x64. @param Index The 32-bit MSR index to read. @@ -5333,7 +5351,7 @@ AsmReadMsr32 ( the MSR is returned. No parameter checking is performed on Index or Value, and some of these may cause CPU exceptions. The caller must either guarantee that Index and Value are valid, or the caller must establish proper exception - handlers. This function is only available on IA-32 and X64. + handlers. This function is only available on IA-32 and x64. @param Index The 32-bit MSR index to write. @param Value The 32-bit value to write to the MSR. @@ -5350,17 +5368,17 @@ AsmWriteMsr32 ( /** - Reads a 64-bit MSR, performs a bitwise inclusive OR on the lower 32-bits, and + Reads a 64-bit MSR, performs a bitwise OR on the lower 32-bits, and writes the result back to the 64-bit MSR. - Reads the 64-bit MSR specified by Index, performs a bitwise inclusive OR + Reads the 64-bit MSR specified by Index, performs a bitwise OR between the lower 32-bits of the read result and the value specified by OrData, and writes the result to the 64-bit MSR specified by Index. The lower 32-bits of the value written to the MSR is returned. No parameter checking is performed on Index or OrData, and some of these may cause CPU exceptions. The caller must either guarantee that Index and OrData are valid, or the caller must establish proper exception handlers. This function is only available on - IA-32 and X64. + IA-32 and x64. @param Index The 32-bit MSR index to write. @param OrData The value to OR with the read value from the MSR. @@ -5387,7 +5405,7 @@ AsmMsrOr32 ( on Index or AndData, and some of these may cause CPU exceptions. The caller must either guarantee that Index and AndData are valid, or the caller must establish proper exception handlers. This function is only available on IA-32 - and X64. + and x64. @param Index The 32-bit MSR index to write. @param AndData The value to AND with the read value from the MSR. @@ -5404,19 +5422,19 @@ AsmMsrAnd32 ( /** - Reads a 64-bit MSR, performs a bitwise AND followed by a bitwise inclusive OR + Reads a 64-bit MSR, performs a bitwise AND followed by a bitwise OR on the lower 32-bits, and writes the result back to the 64-bit MSR. Reads the 64-bit MSR specified by Index, performs a bitwise AND between the lower 32-bits of the read result and the value specified by AndData - preserving the upper 32-bits, performs a bitwise inclusive OR between the + preserving the upper 32-bits, performs a bitwise OR between the result of the AND operation and the value specified by OrData, and writes the result to the 64-bit MSR specified by Address. The lower 32-bits of the value written to the MSR is returned. No parameter checking is performed on Index, AndData, or OrData, and some of these may cause CPU exceptions. The caller must either guarantee that Index, AndData, and OrData are valid, or the caller must establish proper exception handlers. This function is only - available on IA-32 and X64. + available on IA-32 and x64. @param Index The 32-bit MSR index to write. @param AndData The value to AND with the read value from the MSR. @@ -5441,7 +5459,7 @@ AsmMsrAndThenOr32 ( specified by the StartBit and the EndBit. The value of the bit field is returned. The caller must either guarantee that Index is valid, or the caller must set up exception handlers to catch the exceptions. This function is only - available on IA-32 and X64. + available on IA-32 and x64. If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). @@ -5468,13 +5486,12 @@ AsmMsrBitFieldRead32 ( /** Writes a bit field to an MSR. - Writes Value to a bit field in the lower 32-bits of a 64-bit MSR. The bit + Writes Value to a bit field in the lower 32-bits of a 64-bit MSR. The bit field is specified by the StartBit and the EndBit. All other bits in the destination MSR are preserved. The lower 32-bits of the MSR written is - returned. Extra left bits in Value are stripped. The caller must either - guarantee that Index and the data written is valid, or the caller must set up - exception handlers to catch the exceptions. This function is only available - on IA-32 and X64. + returned. The caller must either guarantee that Index and the data written + is valid, or the caller must set up exception handlers to catch the exceptions. + This function is only available on IA-32 and x64. If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). @@ -5504,13 +5521,13 @@ AsmMsrBitFieldWrite32 ( Reads a bit field in a 64-bit MSR, performs a bitwise OR, and writes the result back to the bit field in the 64-bit MSR. - Reads the 64-bit MSR specified by Index, performs a bitwise inclusive OR + Reads the 64-bit MSR specified by Index, performs a bitwise OR between the read result and the value specified by OrData, and writes the result to the 64-bit MSR specified by Index. The lower 32-bits of the value written to the MSR are returned. Extra left bits in OrData are stripped. The caller must either guarantee that Index and the data written is valid, or the caller must set up exception handlers to catch the exceptions. This - function is only available on IA-32 and X64. + function is only available on IA-32 and x64. If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). @@ -5546,7 +5563,7 @@ AsmMsrBitFieldOr32 ( MSR are returned. Extra left bits in AndData are stripped. The caller must either guarantee that Index and the data written is valid, or the caller must set up exception handlers to catch the exceptions. This function is only - available on IA-32 and X64. + available on IA-32 and x64. If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). @@ -5574,17 +5591,17 @@ AsmMsrBitFieldAnd32 ( /** Reads a bit field in a 64-bit MSR, performs a bitwise AND followed by a - bitwise inclusive OR, and writes the result back to the bit field in the + bitwise OR, and writes the result back to the bit field in the 64-bit MSR. Reads the 64-bit MSR specified by Index, performs a bitwise AND followed by a - bitwise inclusive OR between the read result and the value specified by + bitwise OR between the read result and the value specified by AndData, and writes the result to the 64-bit MSR specified by Index. The lower 32-bits of the value written to the MSR are returned. Extra left bits in both AndData and OrData are stripped. The caller must either guarantee that Index and the data written is valid, or the caller must set up exception handlers to catch the exceptions. This function is only available on IA-32 - and X64. + and x64. If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). @@ -5619,7 +5636,7 @@ AsmMsrBitFieldAndThenOr32 ( performed on Index, and some Index values may cause CPU exceptions. The caller must either guarantee that Index is valid, or the caller must set up exception handlers to catch the exceptions. This function is only available - on IA-32 and X64. + on IA-32 and x64. @param Index The 32-bit MSR index to read. @@ -5642,7 +5659,7 @@ AsmReadMsr64 ( performed on Index or Value, and some of these may cause CPU exceptions. The caller must either guarantee that Index and Value are valid, or the caller must establish proper exception handlers. This function is only available on - IA-32 and X64. + IA-32 and x64. @param Index The 32-bit MSR index to write. @param Value The 64-bit value to write to the MSR. @@ -5659,16 +5676,16 @@ AsmWriteMsr64 ( /** - Reads a 64-bit MSR, performs a bitwise inclusive OR, and writes the result + Reads a 64-bit MSR, performs a bitwise OR, and writes the result back to the 64-bit MSR. - Reads the 64-bit MSR specified by Index, performs a bitwise inclusive OR + Reads the 64-bit MSR specified by Index, performs a bitwise OR between the read result and the value specified by OrData, and writes the result to the 64-bit MSR specified by Index. The value written to the MSR is returned. No parameter checking is performed on Index or OrData, and some of these may cause CPU exceptions. The caller must either guarantee that Index and OrData are valid, or the caller must establish proper exception handlers. - This function is only available on IA-32 and X64. + This function is only available on IA-32 and x64. @param Index The 32-bit MSR index to write. @param OrData The value to OR with the read value from the MSR. @@ -5694,7 +5711,7 @@ AsmMsrOr64 ( parameter checking is performed on Index or OrData, and some of these may cause CPU exceptions. The caller must either guarantee that Index and OrData are valid, or the caller must establish proper exception handlers. This - function is only available on IA-32 and X64. + function is only available on IA-32 and x64. @param Index The 32-bit MSR index to write. @param AndData The value to AND with the read value from the MSR. @@ -5711,18 +5728,18 @@ AsmMsrAnd64 ( /** - Reads a 64-bit MSR, performs a bitwise AND followed by a bitwise inclusive + Reads a 64-bit MSR, performs a bitwise AND followed by a bitwise OR, and writes the result back to the 64-bit MSR. Reads the 64-bit MSR specified by Index, performs a bitwise AND between read - result and the value specified by AndData, performs a bitwise inclusive OR + result and the value specified by AndData, performs a bitwise OR between the result of the AND operation and the value specified by OrData, and writes the result to the 64-bit MSR specified by Index. The value written to the MSR is returned. No parameter checking is performed on Index, AndData, or OrData, and some of these may cause CPU exceptions. The caller must either guarantee that Index, AndData, and OrData are valid, or the caller must establish proper exception handlers. This function is only available on IA-32 - and X64. + and x64. @param Index The 32-bit MSR index to write. @param AndData The value to AND with the read value from the MSR. @@ -5747,7 +5764,7 @@ AsmMsrAndThenOr64 ( StartBit and the EndBit. The value of the bit field is returned. The caller must either guarantee that Index is valid, or the caller must set up exception handlers to catch the exceptions. This function is only available - on IA-32 and X64. + on IA-32 and x64. If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). @@ -5776,10 +5793,9 @@ AsmMsrBitFieldRead64 ( Writes Value to a bit field in a 64-bit MSR. The bit field is specified by the StartBit and the EndBit. All other bits in the destination MSR are - preserved. The MSR written is returned. Extra left bits in Value are - stripped. The caller must either guarantee that Index and the data written is - valid, or the caller must set up exception handlers to catch the exceptions. - This function is only available on IA-32 and X64. + preserved. The MSR written is returned. The caller must either guarantee + that Index and the data written is valid, or the caller must set up exception + handlers to catch the exceptions. This function is only available on IA-32 and x64. If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). @@ -5806,16 +5822,16 @@ AsmMsrBitFieldWrite64 ( /** - Reads a bit field in a 64-bit MSR, performs a bitwise inclusive OR, and + Reads a bit field in a 64-bit MSR, performs a bitwise OR, and writes the result back to the bit field in the 64-bit MSR. - Reads the 64-bit MSR specified by Index, performs a bitwise inclusive OR + Reads the 64-bit MSR specified by Index, performs a bitwise OR between the read result and the value specified by OrData, and writes the result to the 64-bit MSR specified by Index. The value written to the MSR is returned. Extra left bits in OrData are stripped. The caller must either guarantee that Index and the data written is valid, or the caller must set up exception handlers to catch the exceptions. This function is only available - on IA-32 and X64. + on IA-32 and x64. If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). @@ -5851,7 +5867,7 @@ AsmMsrBitFieldOr64 ( Extra left bits in AndData are stripped. The caller must either guarantee that Index and the data written is valid, or the caller must set up exception handlers to catch the exceptions. This function is only available on IA-32 - and X64. + and x64. If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). @@ -5879,16 +5895,16 @@ AsmMsrBitFieldAnd64 ( /** Reads a bit field in a 64-bit MSR, performs a bitwise AND followed by a - bitwise inclusive OR, and writes the result back to the bit field in the + bitwise OR, and writes the result back to the bit field in the 64-bit MSR. Reads the 64-bit MSR specified by Index, performs a bitwise AND followed by - a bitwise inclusive OR between the read result and the value specified by + a bitwise OR between the read result and the value specified by AndData, and writes the result to the 64-bit MSR specified by Index. The value written to the MSR is returned. Extra left bits in both AndData and OrData are stripped. The caller must either guarantee that Index and the data written is valid, or the caller must set up exception handlers to catch the - exceptions. This function is only available on IA-32 and X64. + exceptions. This function is only available on IA-32 and x64. If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). @@ -5920,10 +5936,10 @@ AsmMsrBitFieldAndThenOr64 ( Reads the current value of the EFLAGS register. Reads and returns the current value of the EFLAGS register. This function is - only available on IA-32 and X64. This returns a 32-bit value on IA-32 and a - 64-bit value on X64. + only available on IA-32 and x64. This returns a 32-bit value on IA-32 and a + 64-bit value on x64. - @return EFLAGS on IA-32 or RFLAGS on X64. + @return EFLAGS on IA-32 or RFLAGS on x64. **/ UINTN @@ -5937,8 +5953,8 @@ AsmReadEflags ( Reads the current value of the Control Register 0 (CR0). Reads and returns the current value of CR0. This function is only available - on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on - X64. + on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on + x64. @return The value of the Control Register 0 (CR0). @@ -5954,8 +5970,8 @@ AsmReadCr0 ( Reads the current value of the Control Register 2 (CR2). Reads and returns the current value of CR2. This function is only available - on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on - X64. + on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on + x64. @return The value of the Control Register 2 (CR2). @@ -5971,8 +5987,8 @@ AsmReadCr2 ( Reads the current value of the Control Register 3 (CR3). Reads and returns the current value of CR3. This function is only available - on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on - X64. + on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on + x64. @return The value of the Control Register 3 (CR3). @@ -5988,8 +6004,8 @@ AsmReadCr3 ( Reads the current value of the Control Register 4 (CR4). Reads and returns the current value of CR4. This function is only available - on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on - X64. + on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on + x64. @return The value of the Control Register 4 (CR4). @@ -6005,7 +6021,7 @@ AsmReadCr4 ( Writes a value to Control Register 0 (CR0). Writes and returns a new value to CR0. This function is only available on - IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. + IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64. @param Cr0 The value to write to CR0. @@ -6023,7 +6039,7 @@ AsmWriteCr0 ( Writes a value to Control Register 2 (CR2). Writes and returns a new value to CR2. This function is only available on - IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. + IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64. @param Cr2 The value to write to CR2. @@ -6041,7 +6057,7 @@ AsmWriteCr2 ( Writes a value to Control Register 3 (CR3). Writes and returns a new value to CR3. This function is only available on - IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. + IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64. @param Cr3 The value to write to CR3. @@ -6059,7 +6075,7 @@ AsmWriteCr3 ( Writes a value to Control Register 4 (CR4). Writes and returns a new value to CR4. This function is only available on - IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. + IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64. @param Cr4 The value to write to CR4. @@ -6077,8 +6093,8 @@ AsmWriteCr4 ( Reads the current value of Debug Register 0 (DR0). Reads and returns the current value of DR0. This function is only available - on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on - X64. + on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on + x64. @return The value of Debug Register 0 (DR0). @@ -6094,8 +6110,8 @@ AsmReadDr0 ( Reads the current value of Debug Register 1 (DR1). Reads and returns the current value of DR1. This function is only available - on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on - X64. + on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on + x64. @return The value of Debug Register 1 (DR1). @@ -6111,8 +6127,8 @@ AsmReadDr1 ( Reads the current value of Debug Register 2 (DR2). Reads and returns the current value of DR2. This function is only available - on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on - X64. + on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on + x64. @return The value of Debug Register 2 (DR2). @@ -6128,8 +6144,8 @@ AsmReadDr2 ( Reads the current value of Debug Register 3 (DR3). Reads and returns the current value of DR3. This function is only available - on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on - X64. + on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on + x64. @return The value of Debug Register 3 (DR3). @@ -6145,8 +6161,8 @@ AsmReadDr3 ( Reads the current value of Debug Register 4 (DR4). Reads and returns the current value of DR4. This function is only available - on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on - X64. + on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on + x64. @return The value of Debug Register 4 (DR4). @@ -6162,8 +6178,8 @@ AsmReadDr4 ( Reads the current value of Debug Register 5 (DR5). Reads and returns the current value of DR5. This function is only available - on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on - X64. + on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on + x64. @return The value of Debug Register 5 (DR5). @@ -6179,8 +6195,8 @@ AsmReadDr5 ( Reads the current value of Debug Register 6 (DR6). Reads and returns the current value of DR6. This function is only available - on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on - X64. + on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on + x64. @return The value of Debug Register 6 (DR6). @@ -6196,8 +6212,8 @@ AsmReadDr6 ( Reads the current value of Debug Register 7 (DR7). Reads and returns the current value of DR7. This function is only available - on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on - X64. + on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on + x64. @return The value of Debug Register 7 (DR7). @@ -6213,7 +6229,7 @@ AsmReadDr7 ( Writes a value to Debug Register 0 (DR0). Writes and returns a new value to DR0. This function is only available on - IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. + IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64. @param Dr0 The value to write to Dr0. @@ -6231,7 +6247,7 @@ AsmWriteDr0 ( Writes a value to Debug Register 1 (DR1). Writes and returns a new value to DR1. This function is only available on - IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. + IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64. @param Dr1 The value to write to Dr1. @@ -6249,7 +6265,7 @@ AsmWriteDr1 ( Writes a value to Debug Register 2 (DR2). Writes and returns a new value to DR2. This function is only available on - IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. + IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64. @param Dr2 The value to write to Dr2. @@ -6267,7 +6283,7 @@ AsmWriteDr2 ( Writes a value to Debug Register 3 (DR3). Writes and returns a new value to DR3. This function is only available on - IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. + IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64. @param Dr3 The value to write to Dr3. @@ -6285,7 +6301,7 @@ AsmWriteDr3 ( Writes a value to Debug Register 4 (DR4). Writes and returns a new value to DR4. This function is only available on - IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. + IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64. @param Dr4 The value to write to Dr4. @@ -6303,7 +6319,7 @@ AsmWriteDr4 ( Writes a value to Debug Register 5 (DR5). Writes and returns a new value to DR5. This function is only available on - IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. + IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64. @param Dr5 The value to write to Dr5. @@ -6321,7 +6337,7 @@ AsmWriteDr5 ( Writes a value to Debug Register 6 (DR6). Writes and returns a new value to DR6. This function is only available on - IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. + IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64. @param Dr6 The value to write to Dr6. @@ -6339,7 +6355,7 @@ AsmWriteDr6 ( Writes a value to Debug Register 7 (DR7). Writes and returns a new value to DR7. This function is only available on - IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. + IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64. @param Dr7 The value to write to Dr7. @@ -6357,7 +6373,7 @@ AsmWriteDr7 ( Reads the current value of Code Segment Register (CS). Reads and returns the current value of CS. This function is only available on - IA-32 and X64. + IA-32 and x64. @return The current value of CS. @@ -6373,7 +6389,7 @@ AsmReadCs ( Reads the current value of Data Segment Register (DS). Reads and returns the current value of DS. This function is only available on - IA-32 and X64. + IA-32 and x64. @return The current value of DS. @@ -6389,7 +6405,7 @@ AsmReadDs ( Reads the current value of Extra Segment Register (ES). Reads and returns the current value of ES. This function is only available on - IA-32 and X64. + IA-32 and x64. @return The current value of ES. @@ -6405,7 +6421,7 @@ AsmReadEs ( Reads the current value of FS Data Segment Register (FS). Reads and returns the current value of FS. This function is only available on - IA-32 and X64. + IA-32 and x64. @return The current value of FS. @@ -6421,7 +6437,7 @@ AsmReadFs ( Reads the current value of GS Data Segment Register (GS). Reads and returns the current value of GS. This function is only available on - IA-32 and X64. + IA-32 and x64. @return The current value of GS. @@ -6437,7 +6453,7 @@ AsmReadGs ( Reads the current value of Stack Segment Register (SS). Reads and returns the current value of SS. This function is only available on - IA-32 and X64. + IA-32 and x64. @return The current value of SS. @@ -6453,7 +6469,7 @@ AsmReadSs ( Reads the current value of Task Register (TR). Reads and returns the current value of TR. This function is only available on - IA-32 and X64. + IA-32 and x64. @return The current value of TR. @@ -6469,7 +6485,7 @@ AsmReadTr ( Reads the current Global Descriptor Table Register(GDTR) descriptor. Reads and returns the current GDTR descriptor and returns it in Gdtr. This - function is only available on IA-32 and X64. + function is only available on IA-32 and x64. If Gdtr is NULL, then ASSERT(). @@ -6487,7 +6503,7 @@ AsmReadGdtr ( Writes the current Global Descriptor Table Register (GDTR) descriptor. Writes and the current GDTR descriptor specified by Gdtr. This function is - only available on IA-32 and X64. + only available on IA-32 and x64. If Gdtr is NULL, then ASSERT(). @@ -6505,7 +6521,7 @@ AsmWriteGdtr ( Reads the current Interrupt Descriptor Table Register(IDTR) descriptor. Reads and returns the current IDTR descriptor and returns it in Idtr. This - function is only available on IA-32 and X64. + function is only available on IA-32 and x64. If Idtr is NULL, then ASSERT(). @@ -6523,7 +6539,7 @@ AsmReadIdtr ( Writes the current Interrupt Descriptor Table Register(IDTR) descriptor. Writes the current IDTR descriptor and returns it in Idtr. This function is - only available on IA-32 and X64. + only available on IA-32 and x64. If Idtr is NULL, then ASSERT(). @@ -6541,7 +6557,7 @@ AsmWriteIdtr ( Reads the current Local Descriptor Table Register(LDTR) selector. Reads and returns the current 16-bit LDTR descriptor value. This function is - only available on IA-32 and X64. + only available on IA-32 and x64. @return The current selector of LDT. @@ -6557,7 +6573,7 @@ AsmReadLdtr ( Writes the current Local Descriptor Table Register (LDTR) selector. Writes and the current LDTR descriptor specified by Ldtr. This function is - only available on IA-32 and X64. + only available on IA-32 and x64. @param Ldtr 16-bit LDTR selector value. @@ -6574,7 +6590,7 @@ AsmWriteLdtr ( Saves the current floating point/SSE/SSE2 state to the buffer specified by Buffer. Buffer must be aligned on a 16-byte boundary. This function is only - available on IA-32 and X64. + available on IA-32 and x64. If Buffer is NULL, then ASSERT(). If Buffer is not aligned on a 16-byte boundary, then ASSERT(). @@ -6594,7 +6610,7 @@ AsmFxSave ( Restores the current floating point/SSE/SSE2 state from the buffer specified by Buffer. Buffer must be aligned on a 16-byte boundary. This function is - only available on IA-32 and X64. + only available on IA-32 and x64. If Buffer is NULL, then ASSERT(). If Buffer is not aligned on a 16-byte boundary, then ASSERT(). @@ -6614,7 +6630,7 @@ AsmFxRestore ( Reads the current value of 64-bit MMX Register #0 (MM0). Reads and returns the current value of MM0. This function is only available - on IA-32 and X64. + on IA-32 and x64. @return The current value of MM0. @@ -6630,7 +6646,7 @@ AsmReadMm0 ( Reads the current value of 64-bit MMX Register #1 (MM1). Reads and returns the current value of MM1. This function is only available - on IA-32 and X64. + on IA-32 and x64. @return The current value of MM1. @@ -6646,7 +6662,7 @@ AsmReadMm1 ( Reads the current value of 64-bit MMX Register #2 (MM2). Reads and returns the current value of MM2. This function is only available - on IA-32 and X64. + on IA-32 and x64. @return The current value of MM2. @@ -6662,7 +6678,7 @@ AsmReadMm2 ( Reads the current value of 64-bit MMX Register #3 (MM3). Reads and returns the current value of MM3. This function is only available - on IA-32 and X64. + on IA-32 and x64. @return The current value of MM3. @@ -6678,7 +6694,7 @@ AsmReadMm3 ( Reads the current value of 64-bit MMX Register #4 (MM4). Reads and returns the current value of MM4. This function is only available - on IA-32 and X64. + on IA-32 and x64. @return The current value of MM4. @@ -6694,7 +6710,7 @@ AsmReadMm4 ( Reads the current value of 64-bit MMX Register #5 (MM5). Reads and returns the current value of MM5. This function is only available - on IA-32 and X64. + on IA-32 and x64. @return The current value of MM5. @@ -6710,7 +6726,7 @@ AsmReadMm5 ( Reads the current value of 64-bit MMX Register #6 (MM6). Reads and returns the current value of MM6. This function is only available - on IA-32 and X64. + on IA-32 and x64. @return The current value of MM6. @@ -6726,7 +6742,7 @@ AsmReadMm6 ( Reads the current value of 64-bit MMX Register #7 (MM7). Reads and returns the current value of MM7. This function is only available - on IA-32 and X64. + on IA-32 and x64. @return The current value of MM7. @@ -6742,7 +6758,7 @@ AsmReadMm7 ( Writes the current value of 64-bit MMX Register #0 (MM0). Writes the current value of MM0. This function is only available on IA32 and - X64. + x64. @param Value The 64-bit value to write to MM0. @@ -6758,7 +6774,7 @@ AsmWriteMm0 ( Writes the current value of 64-bit MMX Register #1 (MM1). Writes the current value of MM1. This function is only available on IA32 and - X64. + x64. @param Value The 64-bit value to write to MM1. @@ -6774,7 +6790,7 @@ AsmWriteMm1 ( Writes the current value of 64-bit MMX Register #2 (MM2). Writes the current value of MM2. This function is only available on IA32 and - X64. + x64. @param Value The 64-bit value to write to MM2. @@ -6790,7 +6806,7 @@ AsmWriteMm2 ( Writes the current value of 64-bit MMX Register #3 (MM3). Writes the current value of MM3. This function is only available on IA32 and - X64. + x64. @param Value The 64-bit value to write to MM3. @@ -6806,7 +6822,7 @@ AsmWriteMm3 ( Writes the current value of 64-bit MMX Register #4 (MM4). Writes the current value of MM4. This function is only available on IA32 and - X64. + x64. @param Value The 64-bit value to write to MM4. @@ -6822,7 +6838,7 @@ AsmWriteMm4 ( Writes the current value of 64-bit MMX Register #5 (MM5). Writes the current value of MM5. This function is only available on IA32 and - X64. + x64. @param Value The 64-bit value to write to MM5. @@ -6838,7 +6854,7 @@ AsmWriteMm5 ( Writes the current value of 64-bit MMX Register #6 (MM6). Writes the current value of MM6. This function is only available on IA32 and - X64. + x64. @param Value The 64-bit value to write to MM6. @@ -6854,7 +6870,7 @@ AsmWriteMm6 ( Writes the current value of 64-bit MMX Register #7 (MM7). Writes the current value of MM7. This function is only available on IA32 and - X64. + x64. @param Value The 64-bit value to write to MM7. @@ -6870,7 +6886,7 @@ AsmWriteMm7 ( Reads the current value of Time Stamp Counter (TSC). Reads and returns the current value of TSC. This function is only available - on IA-32 and X64. + on IA-32 and x64. @return The current value of TSC @@ -6886,7 +6902,7 @@ AsmReadTsc ( Reads the current value of a Performance Counter (PMC). Reads and returns the current value of performance counter specified by - Index. This function is only available on IA-32 and X64. + Index. This function is only available on IA-32 and x64. @param Index The 32-bit Performance Counter index to read. @@ -6904,7 +6920,7 @@ AsmReadPmc ( Sets up a monitor buffer that is used by AsmMwait(). Executes a MONITOR instruction with the register state specified by Eax, Ecx - and Edx. Returns Eax. This function is only available on IA-32 and X64. + and Edx. Returns Eax. This function is only available on IA-32 and x64. @param Eax The value to load into EAX or RAX before executing the MONITOR instruction. @@ -6929,7 +6945,7 @@ AsmMonitor ( Executes an MWAIT instruction. Executes an MWAIT instruction with the register state specified by Eax and - Ecx. Returns Eax. This function is only available on IA-32 and X64. + Ecx. Returns Eax. This function is only available on IA-32 and x64. @param Eax The value to load into EAX or RAX before executing the MONITOR instruction. @@ -6951,7 +6967,7 @@ AsmMwait ( Executes a WBINVD instruction. Executes a WBINVD instruction. This function is only available on IA-32 and - X64. + x64. **/ VOID @@ -6965,7 +6981,7 @@ AsmWbinvd ( Executes a INVD instruction. Executes a INVD instruction. This function is only available on IA-32 and - X64. + x64. **/ VOID @@ -6980,7 +6996,7 @@ AsmInvd ( coherency domain of the CPU. Flushed the cache line specified by LinearAddress, and returns LinearAddress. - This function is only available on IA-32 and X64. + This function is only available on IA-32 and x64. @param LinearAddress The address of the cache line to flush. If the CPU is in a physical addressing mode, then LinearAddress is a @@ -7136,7 +7152,7 @@ AsmEnablePaging64 ( Disables the 64-bit paging mode on the CPU and returns to 32-bit protected mode. This function assumes the current execution mode is 64-paging mode. - This function is only available on X64. After the 64-bit paging mode is + This function is only available on x64. After the 64-bit paging mode is disabled, control is transferred to the function specified by EntryPoint using the new stack specified by NewStack and passing in the parameters specified by Context1 and Context2. Context1 and Context2 are optional and