2 Provides string functions, linked list functions, math functions, synchronization
3 functions, file path functions, and CPU architecture-specific functions.
5 Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
6 Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
7 This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php.
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
21 // Definitions for architecture-specific types
23 #if defined (MDE_CPU_IA32)
25 /// The IA-32 architecture context buffer used by SetJump() and LongJump().
34 } BASE_LIBRARY_JUMP_BUFFER
;
36 #define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT 4
38 #endif // defined (MDE_CPU_IA32)
40 #if defined (MDE_CPU_IPF)
43 /// The Itanium architecture context buffer used by SetJump() and LongJump().
78 UINT64 AfterSpillUNAT
;
84 } BASE_LIBRARY_JUMP_BUFFER
;
86 #define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT 0x10
88 #endif // defined (MDE_CPU_IPF)
90 #if defined (MDE_CPU_X64)
92 /// The x64 architecture context buffer used by SetJump() and LongJump().
106 UINT8 XmmBuffer
[160]; ///< XMM6-XMM15.
107 } BASE_LIBRARY_JUMP_BUFFER
;
109 #define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT 8
111 #endif // defined (MDE_CPU_X64)
113 #if defined (MDE_CPU_EBC)
115 /// The EBC context buffer used by SetJump() and LongJump().
123 } BASE_LIBRARY_JUMP_BUFFER
;
125 #define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT 8
127 #endif // defined (MDE_CPU_EBC)
129 #if defined (MDE_CPU_ARM)
132 UINT32 R3
; ///< A copy of R13.
143 } BASE_LIBRARY_JUMP_BUFFER
;
145 #define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT 4
147 #endif // defined (MDE_CPU_ARM)
149 #if defined (MDE_CPU_AARCH64)
175 } BASE_LIBRARY_JUMP_BUFFER
;
177 #define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT 8
179 #endif // defined (MDE_CPU_AARCH64)
188 Returns the length of a Null-terminated Unicode string.
190 This function is similar as strlen_s defined in C11.
192 If String is not aligned on a 16-bit boundary, then ASSERT().
194 @param String A pointer to a Null-terminated Unicode string.
195 @param MaxSize The maximum number of Destination Unicode
196 char, including terminating null char.
198 @retval 0 If String is NULL.
199 @retval MaxSize If there is no null character in the first MaxSize characters of String.
200 @return The number of characters that percede the terminating null character.
206 IN CONST CHAR16
*String
,
211 Returns the size of a Null-terminated Unicode string in bytes, including the
214 This function returns the size of the Null-terminated Unicode string
215 specified by String in bytes, including the Null terminator.
217 If String is not aligned on a 16-bit boundary, then ASSERT().
219 @param String A pointer to a Null-terminated Unicode string.
220 @param MaxSize The maximum number of Destination Unicode
221 char, including the Null terminator.
223 @retval 0 If String is NULL.
224 @retval (sizeof (CHAR16) * (MaxSize + 1))
225 If there is no Null terminator in the first MaxSize characters of
227 @return The size of the Null-terminated Unicode string in bytes, including
234 IN CONST CHAR16
*String
,
239 Copies the string pointed to by Source (including the terminating null char)
240 to the array pointed to by Destination.
242 This function is similar as strcpy_s defined in C11.
244 If Destination is not aligned on a 16-bit boundary, then ASSERT().
245 If Source is not aligned on a 16-bit boundary, then ASSERT().
246 If an error would be returned, then the function will also ASSERT().
248 If an error is returned, then the Destination is unmodified.
250 @param Destination A pointer to a Null-terminated Unicode string.
251 @param DestMax The maximum number of Destination Unicode
252 char, including terminating null char.
253 @param Source A pointer to a Null-terminated Unicode string.
255 @retval RETURN_SUCCESS String is copied.
256 @retval RETURN_BUFFER_TOO_SMALL If DestMax is NOT greater than StrLen(Source).
257 @retval RETURN_INVALID_PARAMETER If Destination is NULL.
259 If PcdMaximumUnicodeStringLength is not zero,
260 and DestMax is greater than
261 PcdMaximumUnicodeStringLength.
263 @retval RETURN_ACCESS_DENIED If Source and Destination overlap.
268 OUT CHAR16
*Destination
,
270 IN CONST CHAR16
*Source
274 Copies not more than Length successive char from the string pointed to by
275 Source to the array pointed to by Destination. If no null char is copied from
276 Source, then Destination[Length] is always set to null.
278 This function is similar as strncpy_s defined in C11.
280 If Length > 0 and Destination is not aligned on a 16-bit boundary, then ASSERT().
281 If Length > 0 and Source is not aligned on a 16-bit boundary, then ASSERT().
282 If an error would be returned, then the function will also ASSERT().
284 If an error is returned, then the Destination is unmodified.
286 @param Destination A pointer to a Null-terminated Unicode string.
287 @param DestMax The maximum number of Destination Unicode
288 char, including terminating null char.
289 @param Source A pointer to a Null-terminated Unicode string.
290 @param Length The maximum number of Unicode characters to copy.
292 @retval RETURN_SUCCESS String is copied.
293 @retval RETURN_BUFFER_TOO_SMALL If DestMax is NOT greater than
294 MIN(StrLen(Source), Length).
295 @retval RETURN_INVALID_PARAMETER If Destination is NULL.
297 If PcdMaximumUnicodeStringLength is not zero,
298 and DestMax is greater than
299 PcdMaximumUnicodeStringLength.
301 @retval RETURN_ACCESS_DENIED If Source and Destination overlap.
306 OUT CHAR16
*Destination
,
308 IN CONST CHAR16
*Source
,
313 Appends a copy of the string pointed to by Source (including the terminating
314 null char) to the end of the string pointed to by Destination.
316 This function is similar as strcat_s defined in C11.
318 If Destination is not aligned on a 16-bit boundary, then ASSERT().
319 If Source is not aligned on a 16-bit boundary, then ASSERT().
320 If an error would be returned, then the function will also ASSERT().
322 If an error is returned, then the Destination is unmodified.
324 @param Destination A pointer to a Null-terminated Unicode string.
325 @param DestMax The maximum number of Destination Unicode
326 char, including terminating null char.
327 @param Source A pointer to a Null-terminated Unicode string.
329 @retval RETURN_SUCCESS String is appended.
330 @retval RETURN_BAD_BUFFER_SIZE If DestMax is NOT greater than
332 @retval RETURN_BUFFER_TOO_SMALL If (DestMax - StrLen(Destination)) is NOT
333 greater than StrLen(Source).
334 @retval RETURN_INVALID_PARAMETER If Destination is NULL.
336 If PcdMaximumUnicodeStringLength is not zero,
337 and DestMax is greater than
338 PcdMaximumUnicodeStringLength.
340 @retval RETURN_ACCESS_DENIED If Source and Destination overlap.
345 IN OUT CHAR16
*Destination
,
347 IN CONST CHAR16
*Source
351 Appends not more than Length successive char from the string pointed to by
352 Source to the end of the string pointed to by Destination. If no null char is
353 copied from Source, then Destination[StrLen(Destination) + Length] is always
356 This function is similar as strncat_s defined in C11.
358 If Destination is not aligned on a 16-bit boundary, then ASSERT().
359 If Source is not aligned on a 16-bit boundary, then ASSERT().
360 If an error would be returned, then the function will also ASSERT().
362 If an error is returned, then the Destination is unmodified.
364 @param Destination A pointer to a Null-terminated Unicode string.
365 @param DestMax The maximum number of Destination Unicode
366 char, including terminating null char.
367 @param Source A pointer to a Null-terminated Unicode string.
368 @param Length The maximum number of Unicode characters to copy.
370 @retval RETURN_SUCCESS String is appended.
371 @retval RETURN_BAD_BUFFER_SIZE If DestMax is NOT greater than
373 @retval RETURN_BUFFER_TOO_SMALL If (DestMax - StrLen(Destination)) is NOT
374 greater than MIN(StrLen(Source), Length).
375 @retval RETURN_INVALID_PARAMETER If Destination is NULL.
377 If PcdMaximumUnicodeStringLength is not zero,
378 and DestMax is greater than
379 PcdMaximumUnicodeStringLength.
381 @retval RETURN_ACCESS_DENIED If Source and Destination overlap.
386 IN OUT CHAR16
*Destination
,
388 IN CONST CHAR16
*Source
,
393 Convert a Null-terminated Unicode decimal string to a value of type UINTN.
395 This function outputs a value of type UINTN by interpreting the contents of
396 the Unicode string specified by String as a decimal number. The format of the
397 input Unicode string String is:
399 [spaces] [decimal digits].
401 The valid decimal digit character is in the range [0-9]. The function will
402 ignore the pad space, which includes spaces or tab characters, before
403 [decimal digits]. The running zero in the beginning of [decimal digits] will
404 be ignored. Then, the function stops at the first character that is a not a
405 valid decimal character or a Null-terminator, whichever one comes first.
407 If String is NULL, then ASSERT().
408 If Data is NULL, then ASSERT().
409 If String is not aligned in a 16-bit boundary, then ASSERT().
410 If PcdMaximumUnicodeStringLength is not zero, and String contains more than
411 PcdMaximumUnicodeStringLength Unicode characters, not including the
412 Null-terminator, then ASSERT().
414 If String has no valid decimal digits in the above format, then 0 is stored
415 at the location pointed to by Data.
416 If the number represented by String exceeds the range defined by UINTN, then
417 MAX_UINTN is stored at the location pointed to by Data.
419 If EndPointer is not NULL, a pointer to the character that stopped the scan
420 is stored at the location pointed to by EndPointer. If String has no valid
421 decimal digits right after the optional pad spaces, the value of String is
422 stored at the location pointed to by EndPointer.
424 @param String Pointer to a Null-terminated Unicode string.
425 @param EndPointer Pointer to character that stops scan.
426 @param Data Pointer to the converted value.
428 @retval RETURN_SUCCESS Value is translated from String.
429 @retval RETURN_INVALID_PARAMETER If String is NULL.
431 If PcdMaximumUnicodeStringLength is not
432 zero, and String contains more than
433 PcdMaximumUnicodeStringLength Unicode
434 characters, not including the
436 @retval RETURN_UNSUPPORTED If the number represented by String exceeds
437 the range defined by UINTN.
443 IN CONST CHAR16
*String
,
444 OUT CHAR16
**EndPointer
, OPTIONAL
449 Convert a Null-terminated Unicode decimal string to a value of type UINT64.
451 This function outputs a value of type UINT64 by interpreting the contents of
452 the Unicode string specified by String as a decimal number. The format of the
453 input Unicode string String is:
455 [spaces] [decimal digits].
457 The valid decimal digit character is in the range [0-9]. The function will
458 ignore the pad space, which includes spaces or tab characters, before
459 [decimal digits]. The running zero in the beginning of [decimal digits] will
460 be ignored. Then, the function stops at the first character that is a not a
461 valid decimal character or a Null-terminator, whichever one comes first.
463 If String is NULL, then ASSERT().
464 If Data is NULL, then ASSERT().
465 If String is not aligned in a 16-bit boundary, then ASSERT().
466 If PcdMaximumUnicodeStringLength is not zero, and String contains more than
467 PcdMaximumUnicodeStringLength Unicode characters, not including the
468 Null-terminator, then ASSERT().
470 If String has no valid decimal digits in the above format, then 0 is stored
471 at the location pointed to by Data.
472 If the number represented by String exceeds the range defined by UINT64, then
473 MAX_UINT64 is stored at the location pointed to by Data.
475 If EndPointer is not NULL, a pointer to the character that stopped the scan
476 is stored at the location pointed to by EndPointer. If String has no valid
477 decimal digits right after the optional pad spaces, the value of String is
478 stored at the location pointed to by EndPointer.
480 @param String Pointer to a Null-terminated Unicode string.
481 @param EndPointer Pointer to character that stops scan.
482 @param Data Pointer to the converted value.
484 @retval RETURN_SUCCESS Value is translated from String.
485 @retval RETURN_INVALID_PARAMETER If String is NULL.
487 If PcdMaximumUnicodeStringLength is not
488 zero, and String contains more than
489 PcdMaximumUnicodeStringLength Unicode
490 characters, not including the
492 @retval RETURN_UNSUPPORTED If the number represented by String exceeds
493 the range defined by UINT64.
498 StrDecimalToUint64S (
499 IN CONST CHAR16
*String
,
500 OUT CHAR16
**EndPointer
, OPTIONAL
505 Convert a Null-terminated Unicode hexadecimal string to a value of type
508 This function outputs a value of type UINTN by interpreting the contents of
509 the Unicode string specified by String as a hexadecimal number. The format of
510 the input Unicode string String is:
512 [spaces][zeros][x][hexadecimal digits].
514 The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].
515 The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix.
516 If "x" appears in the input string, it must be prefixed with at least one 0.
517 The function will ignore the pad space, which includes spaces or tab
518 characters, before [zeros], [x] or [hexadecimal digit]. The running zero
519 before [x] or [hexadecimal digit] will be ignored. Then, the decoding starts
520 after [x] or the first valid hexadecimal digit. Then, the function stops at
521 the first character that is a not a valid hexadecimal character or NULL,
522 whichever one comes first.
524 If String is NULL, then ASSERT().
525 If Data is NULL, then ASSERT().
526 If String is not aligned in a 16-bit boundary, then ASSERT().
527 If PcdMaximumUnicodeStringLength is not zero, and String contains more than
528 PcdMaximumUnicodeStringLength Unicode characters, not including the
529 Null-terminator, then ASSERT().
531 If String has no valid hexadecimal digits in the above format, then 0 is
532 stored at the location pointed to by Data.
533 If the number represented by String exceeds the range defined by UINTN, then
534 MAX_UINTN is stored at the location pointed to by Data.
536 If EndPointer is not NULL, a pointer to the character that stopped the scan
537 is stored at the location pointed to by EndPointer. If String has no valid
538 hexadecimal digits right after the optional pad spaces, the value of String
539 is stored at the location pointed to by EndPointer.
541 @param String Pointer to a Null-terminated Unicode string.
542 @param EndPointer Pointer to character that stops scan.
543 @param Data Pointer to the converted value.
545 @retval RETURN_SUCCESS Value is translated from String.
546 @retval RETURN_INVALID_PARAMETER If String is NULL.
548 If PcdMaximumUnicodeStringLength is not
549 zero, and String contains more than
550 PcdMaximumUnicodeStringLength Unicode
551 characters, not including the
553 @retval RETURN_UNSUPPORTED If the number represented by String exceeds
554 the range defined by UINTN.
560 IN CONST CHAR16
*String
,
561 OUT CHAR16
**EndPointer
, OPTIONAL
566 Convert a Null-terminated Unicode hexadecimal string to a value of type
569 This function outputs a value of type UINT64 by interpreting the contents of
570 the Unicode string specified by String as a hexadecimal number. The format of
571 the input Unicode string String is:
573 [spaces][zeros][x][hexadecimal digits].
575 The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].
576 The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix.
577 If "x" appears in the input string, it must be prefixed with at least one 0.
578 The function will ignore the pad space, which includes spaces or tab
579 characters, before [zeros], [x] or [hexadecimal digit]. The running zero
580 before [x] or [hexadecimal digit] will be ignored. Then, the decoding starts
581 after [x] or the first valid hexadecimal digit. Then, the function stops at
582 the first character that is a not a valid hexadecimal character or NULL,
583 whichever one comes first.
585 If String is NULL, then ASSERT().
586 If Data is NULL, then ASSERT().
587 If String is not aligned in a 16-bit boundary, then ASSERT().
588 If PcdMaximumUnicodeStringLength is not zero, and String contains more than
589 PcdMaximumUnicodeStringLength Unicode characters, not including the
590 Null-terminator, then ASSERT().
592 If String has no valid hexadecimal digits in the above format, then 0 is
593 stored at the location pointed to by Data.
594 If the number represented by String exceeds the range defined by UINT64, then
595 MAX_UINT64 is stored at the location pointed to by Data.
597 If EndPointer is not NULL, a pointer to the character that stopped the scan
598 is stored at the location pointed to by EndPointer. If String has no valid
599 hexadecimal digits right after the optional pad spaces, the value of String
600 is stored at the location pointed to by EndPointer.
602 @param String Pointer to a Null-terminated Unicode string.
603 @param EndPointer Pointer to character that stops scan.
604 @param Data Pointer to the converted value.
606 @retval RETURN_SUCCESS Value is translated from String.
607 @retval RETURN_INVALID_PARAMETER If String is NULL.
609 If PcdMaximumUnicodeStringLength is not
610 zero, and String contains more than
611 PcdMaximumUnicodeStringLength Unicode
612 characters, not including the
614 @retval RETURN_UNSUPPORTED If the number represented by String exceeds
615 the range defined by UINT64.
621 IN CONST CHAR16
*String
,
622 OUT CHAR16
**EndPointer
, OPTIONAL
627 Returns the length of a Null-terminated Ascii string.
629 This function is similar as strlen_s defined in C11.
631 @param String A pointer to a Null-terminated Ascii string.
632 @param MaxSize The maximum number of Destination Ascii
633 char, including terminating null char.
635 @retval 0 If String is NULL.
636 @retval MaxSize If there is no null character in the first MaxSize characters of String.
637 @return The number of characters that percede the terminating null character.
643 IN CONST CHAR8
*String
,
648 Returns the size of a Null-terminated Ascii string in bytes, including the
651 This function returns the size of the Null-terminated Ascii string specified
652 by String in bytes, including the Null terminator.
654 @param String A pointer to a Null-terminated Ascii string.
655 @param MaxSize The maximum number of Destination Ascii
656 char, including the Null terminator.
658 @retval 0 If String is NULL.
659 @retval (sizeof (CHAR8) * (MaxSize + 1))
660 If there is no Null terminator in the first MaxSize characters of
662 @return The size of the Null-terminated Ascii string in bytes, including the
669 IN CONST CHAR8
*String
,
674 Copies the string pointed to by Source (including the terminating null char)
675 to the array pointed to by Destination.
677 This function is similar as strcpy_s defined in C11.
679 If an error would be returned, then the function will also ASSERT().
681 If an error is returned, then the Destination is unmodified.
683 @param Destination A pointer to a Null-terminated Ascii string.
684 @param DestMax The maximum number of Destination Ascii
685 char, including terminating null char.
686 @param Source A pointer to a Null-terminated Ascii string.
688 @retval RETURN_SUCCESS String is copied.
689 @retval RETURN_BUFFER_TOO_SMALL If DestMax is NOT greater than StrLen(Source).
690 @retval RETURN_INVALID_PARAMETER If Destination is NULL.
692 If PcdMaximumAsciiStringLength is not zero,
693 and DestMax is greater than
694 PcdMaximumAsciiStringLength.
696 @retval RETURN_ACCESS_DENIED If Source and Destination overlap.
701 OUT CHAR8
*Destination
,
703 IN CONST CHAR8
*Source
707 Copies not more than Length successive char from the string pointed to by
708 Source to the array pointed to by Destination. If no null char is copied from
709 Source, then Destination[Length] is always set to null.
711 This function is similar as strncpy_s defined in C11.
713 If an error would be returned, then the function will also ASSERT().
715 If an error is returned, then the Destination is unmodified.
717 @param Destination A pointer to a Null-terminated Ascii string.
718 @param DestMax The maximum number of Destination Ascii
719 char, including terminating null char.
720 @param Source A pointer to a Null-terminated Ascii string.
721 @param Length The maximum number of Ascii characters to copy.
723 @retval RETURN_SUCCESS String is copied.
724 @retval RETURN_BUFFER_TOO_SMALL If DestMax is NOT greater than
725 MIN(StrLen(Source), Length).
726 @retval RETURN_INVALID_PARAMETER If Destination is NULL.
728 If PcdMaximumAsciiStringLength is not zero,
729 and DestMax is greater than
730 PcdMaximumAsciiStringLength.
732 @retval RETURN_ACCESS_DENIED If Source and Destination overlap.
737 OUT CHAR8
*Destination
,
739 IN CONST CHAR8
*Source
,
744 Appends a copy of the string pointed to by Source (including the terminating
745 null char) to the end of the string pointed to by Destination.
747 This function is similar as strcat_s defined in C11.
749 If an error would be returned, then the function will also ASSERT().
751 If an error is returned, then the Destination is unmodified.
753 @param Destination A pointer to a Null-terminated Ascii string.
754 @param DestMax The maximum number of Destination Ascii
755 char, including terminating null char.
756 @param Source A pointer to a Null-terminated Ascii string.
758 @retval RETURN_SUCCESS String is appended.
759 @retval RETURN_BAD_BUFFER_SIZE If DestMax is NOT greater than
761 @retval RETURN_BUFFER_TOO_SMALL If (DestMax - StrLen(Destination)) is NOT
762 greater than StrLen(Source).
763 @retval RETURN_INVALID_PARAMETER If Destination is NULL.
765 If PcdMaximumAsciiStringLength is not zero,
766 and DestMax is greater than
767 PcdMaximumAsciiStringLength.
769 @retval RETURN_ACCESS_DENIED If Source and Destination overlap.
774 IN OUT CHAR8
*Destination
,
776 IN CONST CHAR8
*Source
780 Appends not more than Length successive char from the string pointed to by
781 Source to the end of the string pointed to by Destination. If no null char is
782 copied from Source, then Destination[StrLen(Destination) + Length] is always
785 This function is similar as strncat_s defined in C11.
787 If an error would be returned, then the function will also ASSERT().
789 If an error is returned, then the Destination is unmodified.
791 @param Destination A pointer to a Null-terminated Ascii string.
792 @param DestMax The maximum number of Destination Ascii
793 char, including terminating null char.
794 @param Source A pointer to a Null-terminated Ascii string.
795 @param Length The maximum number of Ascii characters to copy.
797 @retval RETURN_SUCCESS String is appended.
798 @retval RETURN_BAD_BUFFER_SIZE If DestMax is NOT greater than
800 @retval RETURN_BUFFER_TOO_SMALL If (DestMax - StrLen(Destination)) is NOT
801 greater than MIN(StrLen(Source), Length).
802 @retval RETURN_INVALID_PARAMETER If Destination is NULL.
804 If PcdMaximumAsciiStringLength is not zero,
805 and DestMax is greater than
806 PcdMaximumAsciiStringLength.
808 @retval RETURN_ACCESS_DENIED If Source and Destination overlap.
813 IN OUT CHAR8
*Destination
,
815 IN CONST CHAR8
*Source
,
820 Convert a Null-terminated Ascii decimal string to a value of type UINTN.
822 This function outputs a value of type UINTN by interpreting the contents of
823 the Ascii string specified by String as a decimal number. The format of the
824 input Ascii string String is:
826 [spaces] [decimal digits].
828 The valid decimal digit character is in the range [0-9]. The function will
829 ignore the pad space, which includes spaces or tab characters, before
830 [decimal digits]. The running zero in the beginning of [decimal digits] will
831 be ignored. Then, the function stops at the first character that is a not a
832 valid decimal character or a Null-terminator, whichever one comes first.
834 If String is NULL, then ASSERT().
835 If Data is NULL, then ASSERT().
836 If PcdMaximumAsciiStringLength is not zero, and String contains more than
837 PcdMaximumAsciiStringLength Ascii characters, not including the
838 Null-terminator, then ASSERT().
840 If String has no valid decimal digits in the above format, then 0 is stored
841 at the location pointed to by Data.
842 If the number represented by String exceeds the range defined by UINTN, then
843 MAX_UINTN is stored at the location pointed to by Data.
845 If EndPointer is not NULL, a pointer to the character that stopped the scan
846 is stored at the location pointed to by EndPointer. If String has no valid
847 decimal digits right after the optional pad spaces, the value of String is
848 stored at the location pointed to by EndPointer.
850 @param String Pointer to a Null-terminated Ascii string.
851 @param EndPointer Pointer to character that stops scan.
852 @param Data Pointer to the converted value.
854 @retval RETURN_SUCCESS Value is translated from String.
855 @retval RETURN_INVALID_PARAMETER If String is NULL.
857 If PcdMaximumAsciiStringLength is not zero,
858 and String contains more than
859 PcdMaximumAsciiStringLength Ascii
860 characters, not including the
862 @retval RETURN_UNSUPPORTED If the number represented by String exceeds
863 the range defined by UINTN.
868 AsciiStrDecimalToUintnS (
869 IN CONST CHAR8
*String
,
870 OUT CHAR8
**EndPointer
, OPTIONAL
875 Convert a Null-terminated Ascii decimal string to a value of type UINT64.
877 This function outputs a value of type UINT64 by interpreting the contents of
878 the Ascii string specified by String as a decimal number. The format of the
879 input Ascii string String is:
881 [spaces] [decimal digits].
883 The valid decimal digit character is in the range [0-9]. The function will
884 ignore the pad space, which includes spaces or tab characters, before
885 [decimal digits]. The running zero in the beginning of [decimal digits] will
886 be ignored. Then, the function stops at the first character that is a not a
887 valid decimal character or a Null-terminator, whichever one comes first.
889 If String is NULL, then ASSERT().
890 If Data is NULL, then ASSERT().
891 If PcdMaximumAsciiStringLength is not zero, and String contains more than
892 PcdMaximumAsciiStringLength Ascii characters, not including the
893 Null-terminator, then ASSERT().
895 If String has no valid decimal digits in the above format, then 0 is stored
896 at the location pointed to by Data.
897 If the number represented by String exceeds the range defined by UINT64, then
898 MAX_UINT64 is stored at the location pointed to by Data.
900 If EndPointer is not NULL, a pointer to the character that stopped the scan
901 is stored at the location pointed to by EndPointer. If String has no valid
902 decimal digits right after the optional pad spaces, the value of String is
903 stored at the location pointed to by EndPointer.
905 @param String Pointer to a Null-terminated Ascii string.
906 @param EndPointer Pointer to character that stops scan.
907 @param Data Pointer to the converted value.
909 @retval RETURN_SUCCESS Value is translated from String.
910 @retval RETURN_INVALID_PARAMETER If String is NULL.
912 If PcdMaximumAsciiStringLength is not zero,
913 and String contains more than
914 PcdMaximumAsciiStringLength Ascii
915 characters, not including the
917 @retval RETURN_UNSUPPORTED If the number represented by String exceeds
918 the range defined by UINT64.
923 AsciiStrDecimalToUint64S (
924 IN CONST CHAR8
*String
,
925 OUT CHAR8
**EndPointer
, OPTIONAL
930 Convert a Null-terminated Ascii hexadecimal string to a value of type UINTN.
932 This function outputs a value of type UINTN by interpreting the contents of
933 the Ascii string specified by String as a hexadecimal number. The format of
934 the input Ascii string String is:
936 [spaces][zeros][x][hexadecimal digits].
938 The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].
939 The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. If
940 "x" appears in the input string, it must be prefixed with at least one 0. The
941 function will ignore the pad space, which includes spaces or tab characters,
942 before [zeros], [x] or [hexadecimal digits]. The running zero before [x] or
943 [hexadecimal digits] will be ignored. Then, the decoding starts after [x] or
944 the first valid hexadecimal digit. Then, the function stops at the first
945 character that is a not a valid hexadecimal character or Null-terminator,
946 whichever on comes first.
948 If String is NULL, then ASSERT().
949 If Data is NULL, then ASSERT().
950 If PcdMaximumAsciiStringLength is not zero, and String contains more than
951 PcdMaximumAsciiStringLength Ascii characters, not including the
952 Null-terminator, then ASSERT().
954 If String has no valid hexadecimal digits in the above format, then 0 is
955 stored at the location pointed to by Data.
956 If the number represented by String exceeds the range defined by UINTN, then
957 MAX_UINTN is stored at the location pointed to by Data.
959 If EndPointer is not NULL, a pointer to the character that stopped the scan
960 is stored at the location pointed to by EndPointer. If String has no valid
961 hexadecimal digits right after the optional pad spaces, the value of String
962 is stored at the location pointed to by EndPointer.
964 @param String Pointer to a Null-terminated Ascii string.
965 @param EndPointer Pointer to character that stops scan.
966 @param Data Pointer to the converted value.
968 @retval RETURN_SUCCESS Value is translated from String.
969 @retval RETURN_INVALID_PARAMETER If String is NULL.
971 If PcdMaximumAsciiStringLength is not zero,
972 and String contains more than
973 PcdMaximumAsciiStringLength Ascii
974 characters, not including the
976 @retval RETURN_UNSUPPORTED If the number represented by String exceeds
977 the range defined by UINTN.
982 AsciiStrHexToUintnS (
983 IN CONST CHAR8
*String
,
984 OUT CHAR8
**EndPointer
, OPTIONAL
989 Convert a Null-terminated Ascii hexadecimal string to a value of type UINT64.
991 This function outputs a value of type UINT64 by interpreting the contents of
992 the Ascii string specified by String as a hexadecimal number. The format of
993 the input Ascii string String is:
995 [spaces][zeros][x][hexadecimal digits].
997 The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].
998 The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. If
999 "x" appears in the input string, it must be prefixed with at least one 0. The
1000 function will ignore the pad space, which includes spaces or tab characters,
1001 before [zeros], [x] or [hexadecimal digits]. The running zero before [x] or
1002 [hexadecimal digits] will be ignored. Then, the decoding starts after [x] or
1003 the first valid hexadecimal digit. Then, the function stops at the first
1004 character that is a not a valid hexadecimal character or Null-terminator,
1005 whichever on comes first.
1007 If String is NULL, then ASSERT().
1008 If Data is NULL, then ASSERT().
1009 If PcdMaximumAsciiStringLength is not zero, and String contains more than
1010 PcdMaximumAsciiStringLength Ascii characters, not including the
1011 Null-terminator, then ASSERT().
1013 If String has no valid hexadecimal digits in the above format, then 0 is
1014 stored at the location pointed to by Data.
1015 If the number represented by String exceeds the range defined by UINT64, then
1016 MAX_UINT64 is stored at the location pointed to by Data.
1018 If EndPointer is not NULL, a pointer to the character that stopped the scan
1019 is stored at the location pointed to by EndPointer. If String has no valid
1020 hexadecimal digits right after the optional pad spaces, the value of String
1021 is stored at the location pointed to by EndPointer.
1023 @param String Pointer to a Null-terminated Ascii string.
1024 @param EndPointer Pointer to character that stops scan.
1025 @param Data Pointer to the converted value.
1027 @retval RETURN_SUCCESS Value is translated from String.
1028 @retval RETURN_INVALID_PARAMETER If String is NULL.
1030 If PcdMaximumAsciiStringLength is not zero,
1031 and String contains more than
1032 PcdMaximumAsciiStringLength Ascii
1033 characters, not including the
1035 @retval RETURN_UNSUPPORTED If the number represented by String exceeds
1036 the range defined by UINT64.
1041 AsciiStrHexToUint64S (
1042 IN CONST CHAR8
*String
,
1043 OUT CHAR8
**EndPointer
, OPTIONAL
1048 #ifndef DISABLE_NEW_DEPRECATED_INTERFACES
1051 [ATTENTION] This function is deprecated for security reason.
1053 Copies one Null-terminated Unicode string to another Null-terminated Unicode
1054 string and returns the new Unicode string.
1056 This function copies the contents of the Unicode string Source to the Unicode
1057 string Destination, and returns Destination. If Source and Destination
1058 overlap, then the results are undefined.
1060 If Destination is NULL, then ASSERT().
1061 If Destination is not aligned on a 16-bit boundary, then ASSERT().
1062 If Source is NULL, then ASSERT().
1063 If Source is not aligned on a 16-bit boundary, then ASSERT().
1064 If Source and Destination overlap, then ASSERT().
1065 If PcdMaximumUnicodeStringLength is not zero, and Source contains more than
1066 PcdMaximumUnicodeStringLength Unicode characters not including the
1067 Null-terminator, then ASSERT().
1069 @param Destination The pointer to a Null-terminated Unicode string.
1070 @param Source The pointer to a Null-terminated Unicode string.
1072 @return Destination.
1078 OUT CHAR16
*Destination
,
1079 IN CONST CHAR16
*Source
1084 [ATTENTION] This function is deprecated for security reason.
1086 Copies up to a specified length from one Null-terminated Unicode string to
1087 another Null-terminated Unicode string and returns the new Unicode string.
1089 This function copies the contents of the Unicode string Source to the Unicode
1090 string Destination, and returns Destination. At most, Length Unicode
1091 characters are copied from Source to Destination. If Length is 0, then
1092 Destination is returned unmodified. If Length is greater that the number of
1093 Unicode characters in Source, then Destination is padded with Null Unicode
1094 characters. If Source and Destination overlap, then the results are
1097 If Length > 0 and Destination is NULL, then ASSERT().
1098 If Length > 0 and Destination is not aligned on a 16-bit boundary, then ASSERT().
1099 If Length > 0 and Source is NULL, then ASSERT().
1100 If Length > 0 and Source is not aligned on a 16-bit boundary, then ASSERT().
1101 If Source and Destination overlap, then ASSERT().
1102 If PcdMaximumUnicodeStringLength is not zero, and Length is greater than
1103 PcdMaximumUnicodeStringLength, then ASSERT().
1104 If PcdMaximumUnicodeStringLength is not zero, and Source contains more than
1105 PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator,
1108 @param Destination The pointer to a Null-terminated Unicode string.
1109 @param Source The pointer to a Null-terminated Unicode string.
1110 @param Length The maximum number of Unicode characters to copy.
1112 @return Destination.
1118 OUT CHAR16
*Destination
,
1119 IN CONST CHAR16
*Source
,
1125 Returns the length of a Null-terminated Unicode string.
1127 This function returns the number of Unicode characters in the Null-terminated
1128 Unicode string specified by String.
1130 If String is NULL, then ASSERT().
1131 If String is not aligned on a 16-bit boundary, then ASSERT().
1132 If PcdMaximumUnicodeStringLength is not zero, and String contains more than
1133 PcdMaximumUnicodeStringLength Unicode characters not including the
1134 Null-terminator, then ASSERT().
1136 @param String Pointer to a Null-terminated Unicode string.
1138 @return The length of String.
1144 IN CONST CHAR16
*String
1149 Returns the size of a Null-terminated Unicode string in bytes, including the
1152 This function returns the size, in bytes, of the Null-terminated Unicode string
1153 specified by String.
1155 If String is NULL, then ASSERT().
1156 If String is not aligned on a 16-bit boundary, then ASSERT().
1157 If PcdMaximumUnicodeStringLength is not zero, and String contains more than
1158 PcdMaximumUnicodeStringLength Unicode characters not including the
1159 Null-terminator, then ASSERT().
1161 @param String The pointer to a Null-terminated Unicode string.
1163 @return The size of String.
1169 IN CONST CHAR16
*String
1174 Compares two Null-terminated Unicode strings, and returns the difference
1175 between the first mismatched Unicode characters.
1177 This function compares the Null-terminated Unicode string FirstString to the
1178 Null-terminated Unicode string SecondString. If FirstString is identical to
1179 SecondString, then 0 is returned. Otherwise, the value returned is the first
1180 mismatched Unicode character in SecondString subtracted from the first
1181 mismatched Unicode character in FirstString.
1183 If FirstString is NULL, then ASSERT().
1184 If FirstString is not aligned on a 16-bit boundary, then ASSERT().
1185 If SecondString is NULL, then ASSERT().
1186 If SecondString is not aligned on a 16-bit boundary, then ASSERT().
1187 If PcdMaximumUnicodeStringLength is not zero, and FirstString contains more
1188 than PcdMaximumUnicodeStringLength Unicode characters not including the
1189 Null-terminator, then ASSERT().
1190 If PcdMaximumUnicodeStringLength is not zero, and SecondString contains more
1191 than PcdMaximumUnicodeStringLength Unicode characters, not including the
1192 Null-terminator, then ASSERT().
1194 @param FirstString The pointer to a Null-terminated Unicode string.
1195 @param SecondString The pointer to a Null-terminated Unicode string.
1197 @retval 0 FirstString is identical to SecondString.
1198 @return others FirstString is not identical to SecondString.
1204 IN CONST CHAR16
*FirstString
,
1205 IN CONST CHAR16
*SecondString
1210 Compares up to a specified length the contents of two Null-terminated Unicode strings,
1211 and returns the difference between the first mismatched Unicode characters.
1213 This function compares the Null-terminated Unicode string FirstString to the
1214 Null-terminated Unicode string SecondString. At most, Length Unicode
1215 characters will be compared. If Length is 0, then 0 is returned. If
1216 FirstString is identical to SecondString, then 0 is returned. Otherwise, the
1217 value returned is the first mismatched Unicode character in SecondString
1218 subtracted from the first mismatched Unicode character in FirstString.
1220 If Length > 0 and FirstString is NULL, then ASSERT().
1221 If Length > 0 and FirstString is not aligned on a 16-bit boundary, then ASSERT().
1222 If Length > 0 and SecondString is NULL, then ASSERT().
1223 If Length > 0 and SecondString is not aligned on a 16-bit boundary, then ASSERT().
1224 If PcdMaximumUnicodeStringLength is not zero, and Length is greater than
1225 PcdMaximumUnicodeStringLength, then ASSERT().
1226 If PcdMaximumUnicodeStringLength is not zero, and FirstString contains more than
1227 PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator,
1229 If PcdMaximumUnicodeStringLength is not zero, and SecondString contains more than
1230 PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator,
1233 @param FirstString The pointer to a Null-terminated Unicode string.
1234 @param SecondString The pointer to a Null-terminated Unicode string.
1235 @param Length The maximum number of Unicode characters to compare.
1237 @retval 0 FirstString is identical to SecondString.
1238 @return others FirstString is not identical to SecondString.
1244 IN CONST CHAR16
*FirstString
,
1245 IN CONST CHAR16
*SecondString
,
1250 #ifndef DISABLE_NEW_DEPRECATED_INTERFACES
1253 [ATTENTION] This function is deprecated for security reason.
1255 Concatenates one Null-terminated Unicode string to another Null-terminated
1256 Unicode string, and returns the concatenated Unicode string.
1258 This function concatenates two Null-terminated Unicode strings. The contents
1259 of Null-terminated Unicode string Source are concatenated to the end of
1260 Null-terminated Unicode string Destination. The Null-terminated concatenated
1261 Unicode String is returned. If Source and Destination overlap, then the
1262 results are undefined.
1264 If Destination is NULL, then ASSERT().
1265 If Destination is not aligned on a 16-bit boundary, then ASSERT().
1266 If Source is NULL, then ASSERT().
1267 If Source is not aligned on a 16-bit boundary, then ASSERT().
1268 If Source and Destination overlap, then ASSERT().
1269 If PcdMaximumUnicodeStringLength is not zero, and Destination contains more
1270 than PcdMaximumUnicodeStringLength Unicode characters, not including the
1271 Null-terminator, then ASSERT().
1272 If PcdMaximumUnicodeStringLength is not zero, and Source contains more than
1273 PcdMaximumUnicodeStringLength Unicode characters, not including the
1274 Null-terminator, then ASSERT().
1275 If PcdMaximumUnicodeStringLength is not zero, and concatenating Destination
1276 and Source results in a Unicode string with more than
1277 PcdMaximumUnicodeStringLength Unicode characters, not including the
1278 Null-terminator, then ASSERT().
1280 @param Destination The pointer to a Null-terminated Unicode string.
1281 @param Source The pointer to a Null-terminated Unicode string.
1283 @return Destination.
1289 IN OUT CHAR16
*Destination
,
1290 IN CONST CHAR16
*Source
1295 [ATTENTION] This function is deprecated for security reason.
1297 Concatenates up to a specified length one Null-terminated Unicode to the end
1298 of another Null-terminated Unicode string, and returns the concatenated
1301 This function concatenates two Null-terminated Unicode strings. The contents
1302 of Null-terminated Unicode string Source are concatenated to the end of
1303 Null-terminated Unicode string Destination, and Destination is returned. At
1304 most, Length Unicode characters are concatenated from Source to the end of
1305 Destination, and Destination is always Null-terminated. If Length is 0, then
1306 Destination is returned unmodified. If Source and Destination overlap, then
1307 the results are undefined.
1309 If Destination is NULL, then ASSERT().
1310 If Length > 0 and Destination is not aligned on a 16-bit boundary, then ASSERT().
1311 If Length > 0 and Source is NULL, then ASSERT().
1312 If Length > 0 and Source is not aligned on a 16-bit boundary, then ASSERT().
1313 If Source and Destination overlap, then ASSERT().
1314 If PcdMaximumUnicodeStringLength is not zero, and Length is greater than
1315 PcdMaximumUnicodeStringLength, then ASSERT().
1316 If PcdMaximumUnicodeStringLength is not zero, and Destination contains more
1317 than PcdMaximumUnicodeStringLength Unicode characters, not including the
1318 Null-terminator, then ASSERT().
1319 If PcdMaximumUnicodeStringLength is not zero, and Source contains more than
1320 PcdMaximumUnicodeStringLength Unicode characters, not including the
1321 Null-terminator, then ASSERT().
1322 If PcdMaximumUnicodeStringLength is not zero, and concatenating Destination
1323 and Source results in a Unicode string with more than PcdMaximumUnicodeStringLength
1324 Unicode characters, not including the Null-terminator, then ASSERT().
1326 @param Destination The pointer to a Null-terminated Unicode string.
1327 @param Source The pointer to a Null-terminated Unicode string.
1328 @param Length The maximum number of Unicode characters to concatenate from
1331 @return Destination.
1337 IN OUT CHAR16
*Destination
,
1338 IN CONST CHAR16
*Source
,
1344 Returns the first occurrence of a Null-terminated Unicode sub-string
1345 in a Null-terminated Unicode string.
1347 This function scans the contents of the Null-terminated Unicode string
1348 specified by String and returns the first occurrence of SearchString.
1349 If SearchString is not found in String, then NULL is returned. If
1350 the length of SearchString is zero, then String is returned.
1352 If String is NULL, then ASSERT().
1353 If String is not aligned on a 16-bit boundary, then ASSERT().
1354 If SearchString is NULL, then ASSERT().
1355 If SearchString is not aligned on a 16-bit boundary, then ASSERT().
1357 If PcdMaximumUnicodeStringLength is not zero, and SearchString
1358 or String contains more than PcdMaximumUnicodeStringLength Unicode
1359 characters, not including the Null-terminator, then ASSERT().
1361 @param String The pointer to a Null-terminated Unicode string.
1362 @param SearchString The pointer to a Null-terminated Unicode string to search for.
1364 @retval NULL If the SearchString does not appear in String.
1365 @return others If there is a match.
1371 IN CONST CHAR16
*String
,
1372 IN CONST CHAR16
*SearchString
1376 Convert a Null-terminated Unicode decimal string to a value of
1379 This function returns a value of type UINTN by interpreting the contents
1380 of the Unicode string specified by String as a decimal number. The format
1381 of the input Unicode string String is:
1383 [spaces] [decimal digits].
1385 The valid decimal digit character is in the range [0-9]. The
1386 function will ignore the pad space, which includes spaces or
1387 tab characters, before [decimal digits]. The running zero in the
1388 beginning of [decimal digits] will be ignored. Then, the function
1389 stops at the first character that is a not a valid decimal character
1390 or a Null-terminator, whichever one comes first.
1392 If String is NULL, then ASSERT().
1393 If String is not aligned in a 16-bit boundary, then ASSERT().
1394 If String has only pad spaces, then 0 is returned.
1395 If String has no pad spaces or valid decimal digits,
1397 If the number represented by String overflows according
1398 to the range defined by UINTN, then MAX_UINTN is returned.
1400 If PcdMaximumUnicodeStringLength is not zero, and String contains
1401 more than PcdMaximumUnicodeStringLength Unicode characters not including
1402 the Null-terminator, then ASSERT().
1404 @param String The pointer to a Null-terminated Unicode string.
1406 @retval Value translated from String.
1412 IN CONST CHAR16
*String
1416 Convert a Null-terminated Unicode decimal string to a value of
1419 This function returns a value of type UINT64 by interpreting the contents
1420 of the Unicode string specified by String as a decimal number. The format
1421 of the input Unicode string String is:
1423 [spaces] [decimal digits].
1425 The valid decimal digit character is in the range [0-9]. The
1426 function will ignore the pad space, which includes spaces or
1427 tab characters, before [decimal digits]. The running zero in the
1428 beginning of [decimal digits] will be ignored. Then, the function
1429 stops at the first character that is a not a valid decimal character
1430 or a Null-terminator, whichever one comes first.
1432 If String is NULL, then ASSERT().
1433 If String is not aligned in a 16-bit boundary, then ASSERT().
1434 If String has only pad spaces, then 0 is returned.
1435 If String has no pad spaces or valid decimal digits,
1437 If the number represented by String overflows according
1438 to the range defined by UINT64, then MAX_UINT64 is returned.
1440 If PcdMaximumUnicodeStringLength is not zero, and String contains
1441 more than PcdMaximumUnicodeStringLength Unicode characters not including
1442 the Null-terminator, then ASSERT().
1444 @param String The pointer to a Null-terminated Unicode string.
1446 @retval Value translated from String.
1451 StrDecimalToUint64 (
1452 IN CONST CHAR16
*String
1457 Convert a Null-terminated Unicode hexadecimal string to a value of type UINTN.
1459 This function returns a value of type UINTN by interpreting the contents
1460 of the Unicode string specified by String as a hexadecimal number.
1461 The format of the input Unicode string String is:
1463 [spaces][zeros][x][hexadecimal digits].
1465 The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].
1466 The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix.
1467 If "x" appears in the input string, it must be prefixed with at least one 0.
1468 The function will ignore the pad space, which includes spaces or tab characters,
1469 before [zeros], [x] or [hexadecimal digit]. The running zero before [x] or
1470 [hexadecimal digit] will be ignored. Then, the decoding starts after [x] or the
1471 first valid hexadecimal digit. Then, the function stops at the first character
1472 that is a not a valid hexadecimal character or NULL, whichever one comes first.
1474 If String is NULL, then ASSERT().
1475 If String is not aligned in a 16-bit boundary, then ASSERT().
1476 If String has only pad spaces, then zero is returned.
1477 If String has no leading pad spaces, leading zeros or valid hexadecimal digits,
1478 then zero is returned.
1479 If the number represented by String overflows according to the range defined by
1480 UINTN, then MAX_UINTN is returned.
1482 If PcdMaximumUnicodeStringLength is not zero, and String contains more than
1483 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator,
1486 @param String The pointer to a Null-terminated Unicode string.
1488 @retval Value translated from String.
1494 IN CONST CHAR16
*String
1499 Convert a Null-terminated Unicode hexadecimal string to a value of type UINT64.
1501 This function returns a value of type UINT64 by interpreting the contents
1502 of the Unicode string specified by String as a hexadecimal number.
1503 The format of the input Unicode string String is
1505 [spaces][zeros][x][hexadecimal digits].
1507 The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].
1508 The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix.
1509 If "x" appears in the input string, it must be prefixed with at least one 0.
1510 The function will ignore the pad space, which includes spaces or tab characters,
1511 before [zeros], [x] or [hexadecimal digit]. The running zero before [x] or
1512 [hexadecimal digit] will be ignored. Then, the decoding starts after [x] or the
1513 first valid hexadecimal digit. Then, the function stops at the first character that is
1514 a not a valid hexadecimal character or NULL, whichever one comes first.
1516 If String is NULL, then ASSERT().
1517 If String is not aligned in a 16-bit boundary, then ASSERT().
1518 If String has only pad spaces, then zero is returned.
1519 If String has no leading pad spaces, leading zeros or valid hexadecimal digits,
1520 then zero is returned.
1521 If the number represented by String overflows according to the range defined by
1522 UINT64, then MAX_UINT64 is returned.
1524 If PcdMaximumUnicodeStringLength is not zero, and String contains more than
1525 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator,
1528 @param String The pointer to a Null-terminated Unicode string.
1530 @retval Value translated from String.
1536 IN CONST CHAR16
*String
1539 #ifndef DISABLE_NEW_DEPRECATED_INTERFACES
1542 [ATTENTION] This function is deprecated for security reason.
1544 Convert a Null-terminated Unicode string to a Null-terminated
1545 ASCII string and returns the ASCII string.
1547 This function converts the content of the Unicode string Source
1548 to the ASCII string Destination by copying the lower 8 bits of
1549 each Unicode character. It returns Destination.
1551 The caller is responsible to make sure Destination points to a buffer with size
1552 equal or greater than ((StrLen (Source) + 1) * sizeof (CHAR8)) in bytes.
1554 If any Unicode characters in Source contain non-zero value in
1555 the upper 8 bits, then ASSERT().
1557 If Destination is NULL, then ASSERT().
1558 If Source is NULL, then ASSERT().
1559 If Source is not aligned on a 16-bit boundary, then ASSERT().
1560 If Source and Destination overlap, then ASSERT().
1562 If PcdMaximumUnicodeStringLength is not zero, and Source contains
1563 more than PcdMaximumUnicodeStringLength Unicode characters not including
1564 the Null-terminator, then ASSERT().
1566 If PcdMaximumAsciiStringLength is not zero, and Source contains more
1567 than PcdMaximumAsciiStringLength Unicode characters not including the
1568 Null-terminator, then ASSERT().
1570 @param Source The pointer to a Null-terminated Unicode string.
1571 @param Destination The pointer to a Null-terminated ASCII string.
1573 @return Destination.
1578 UnicodeStrToAsciiStr (
1579 IN CONST CHAR16
*Source
,
1580 OUT CHAR8
*Destination
1586 Convert a Null-terminated Unicode string to a Null-terminated
1589 This function is similar to AsciiStrCpyS.
1591 This function converts the content of the Unicode string Source
1592 to the ASCII string Destination by copying the lower 8 bits of
1593 each Unicode character. The function terminates the ASCII string
1594 Destination by appending a Null-terminator character at the end.
1596 The caller is responsible to make sure Destination points to a buffer with size
1597 equal or greater than ((StrLen (Source) + 1) * sizeof (CHAR8)) in bytes.
1599 If any Unicode characters in Source contain non-zero value in
1600 the upper 8 bits, then ASSERT().
1602 If Source is not aligned on a 16-bit boundary, then ASSERT().
1603 If an error would be returned, then the function will also ASSERT().
1605 If an error is returned, then the Destination is unmodified.
1607 @param Source The pointer to a Null-terminated Unicode string.
1608 @param Destination The pointer to a Null-terminated ASCII string.
1609 @param DestMax The maximum number of Destination Ascii
1610 char, including terminating null char.
1612 @retval RETURN_SUCCESS String is converted.
1613 @retval RETURN_BUFFER_TOO_SMALL If DestMax is NOT greater than StrLen(Source).
1614 @retval RETURN_INVALID_PARAMETER If Destination is NULL.
1616 If PcdMaximumAsciiStringLength is not zero,
1617 and DestMax is greater than
1618 PcdMaximumAsciiStringLength.
1619 If PcdMaximumUnicodeStringLength is not zero,
1620 and DestMax is greater than
1621 PcdMaximumUnicodeStringLength.
1623 @retval RETURN_ACCESS_DENIED If Source and Destination overlap.
1628 UnicodeStrToAsciiStrS (
1629 IN CONST CHAR16
*Source
,
1630 OUT CHAR8
*Destination
,
1635 Convert not more than Length successive characters from a Null-terminated
1636 Unicode string to a Null-terminated Ascii string. If no null char is copied
1637 from Source, then Destination[Length] is always set to null.
1639 This function converts not more than Length successive characters from the
1640 Unicode string Source to the Ascii string Destination by copying the lower 8
1641 bits of each Unicode character. The function terminates the Ascii string
1642 Destination by appending a Null-terminator character at the end.
1644 The caller is responsible to make sure Destination points to a buffer with size
1645 equal or greater than ((StrLen (Source) + 1) * sizeof (CHAR8)) in bytes.
1647 If any Unicode characters in Source contain non-zero value in the upper 8
1648 bits, then ASSERT().
1649 If Source is not aligned on a 16-bit boundary, then ASSERT().
1650 If an error would be returned, then the function will also ASSERT().
1652 If an error is returned, then the Destination is unmodified.
1654 @param Source The pointer to a Null-terminated Unicode string.
1655 @param Length The maximum number of Unicode characters to
1657 @param Destination The pointer to a Null-terminated Ascii string.
1658 @param DestMax The maximum number of Destination Ascii
1659 char, including terminating null char.
1660 @param DestinationLength The number of Unicode characters converted.
1662 @retval RETURN_SUCCESS String is converted.
1663 @retval RETURN_INVALID_PARAMETER If Destination is NULL.
1665 If DestinationLength is NULL.
1666 If PcdMaximumAsciiStringLength is not zero,
1667 and Length or DestMax is greater than
1668 PcdMaximumAsciiStringLength.
1669 If PcdMaximumUnicodeStringLength is not
1670 zero, and Length or DestMax is greater than
1671 PcdMaximumUnicodeStringLength.
1673 @retval RETURN_BUFFER_TOO_SMALL If DestMax is NOT greater than
1674 MIN(StrLen(Source), Length).
1675 @retval RETURN_ACCESS_DENIED If Source and Destination overlap.
1680 UnicodeStrnToAsciiStrS (
1681 IN CONST CHAR16
*Source
,
1683 OUT CHAR8
*Destination
,
1685 OUT UINTN
*DestinationLength
1688 #ifndef DISABLE_NEW_DEPRECATED_INTERFACES
1691 [ATTENTION] This function is deprecated for security reason.
1693 Copies one Null-terminated ASCII string to another Null-terminated ASCII
1694 string and returns the new ASCII string.
1696 This function copies the contents of the ASCII string Source to the ASCII
1697 string Destination, and returns Destination. If Source and Destination
1698 overlap, then the results are undefined.
1700 If Destination is NULL, then ASSERT().
1701 If Source is NULL, then ASSERT().
1702 If Source and Destination overlap, then ASSERT().
1703 If PcdMaximumAsciiStringLength is not zero and Source contains more than
1704 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
1707 @param Destination The pointer to a Null-terminated ASCII string.
1708 @param Source The pointer to a Null-terminated ASCII string.
1716 OUT CHAR8
*Destination
,
1717 IN CONST CHAR8
*Source
1722 [ATTENTION] This function is deprecated for security reason.
1724 Copies up to a specified length one Null-terminated ASCII string to another
1725 Null-terminated ASCII string and returns the new ASCII string.
1727 This function copies the contents of the ASCII string Source to the ASCII
1728 string Destination, and returns Destination. At most, Length ASCII characters
1729 are copied from Source to Destination. If Length is 0, then Destination is
1730 returned unmodified. If Length is greater that the number of ASCII characters
1731 in Source, then Destination is padded with Null ASCII characters. If Source
1732 and Destination overlap, then the results are undefined.
1734 If Destination is NULL, then ASSERT().
1735 If Source is NULL, then ASSERT().
1736 If Source and Destination overlap, then ASSERT().
1737 If PcdMaximumAsciiStringLength is not zero, and Length is greater than
1738 PcdMaximumAsciiStringLength, then ASSERT().
1739 If PcdMaximumAsciiStringLength is not zero, and Source contains more than
1740 PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,
1743 @param Destination The pointer to a Null-terminated ASCII string.
1744 @param Source The pointer to a Null-terminated ASCII string.
1745 @param Length The maximum number of ASCII characters to copy.
1753 OUT CHAR8
*Destination
,
1754 IN CONST CHAR8
*Source
,
1760 Returns the length of a Null-terminated ASCII string.
1762 This function returns the number of ASCII characters in the Null-terminated
1763 ASCII string specified by String.
1765 If Length > 0 and Destination is NULL, then ASSERT().
1766 If Length > 0 and Source is NULL, then ASSERT().
1767 If PcdMaximumAsciiStringLength is not zero and String contains more than
1768 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
1771 @param String The pointer to a Null-terminated ASCII string.
1773 @return The length of String.
1779 IN CONST CHAR8
*String
1784 Returns the size of a Null-terminated ASCII string in bytes, including the
1787 This function returns the size, in bytes, of the Null-terminated ASCII string
1788 specified by String.
1790 If String is NULL, then ASSERT().
1791 If PcdMaximumAsciiStringLength is not zero and String contains more than
1792 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
1795 @param String The pointer to a Null-terminated ASCII string.
1797 @return The size of String.
1803 IN CONST CHAR8
*String
1808 Compares two Null-terminated ASCII strings, and returns the difference
1809 between the first mismatched ASCII characters.
1811 This function compares the Null-terminated ASCII string FirstString to the
1812 Null-terminated ASCII string SecondString. If FirstString is identical to
1813 SecondString, then 0 is returned. Otherwise, the value returned is the first
1814 mismatched ASCII character in SecondString subtracted from the first
1815 mismatched ASCII character in FirstString.
1817 If FirstString is NULL, then ASSERT().
1818 If SecondString is NULL, then ASSERT().
1819 If PcdMaximumAsciiStringLength is not zero and FirstString contains more than
1820 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
1822 If PcdMaximumAsciiStringLength is not zero and SecondString contains more
1823 than PcdMaximumAsciiStringLength ASCII characters not including the
1824 Null-terminator, then ASSERT().
1826 @param FirstString The pointer to a Null-terminated ASCII string.
1827 @param SecondString The pointer to a Null-terminated ASCII string.
1829 @retval ==0 FirstString is identical to SecondString.
1830 @retval !=0 FirstString is not identical to SecondString.
1836 IN CONST CHAR8
*FirstString
,
1837 IN CONST CHAR8
*SecondString
1842 Performs a case insensitive comparison of two Null-terminated ASCII strings,
1843 and returns the difference between the first mismatched ASCII characters.
1845 This function performs a case insensitive comparison of the Null-terminated
1846 ASCII string FirstString to the Null-terminated ASCII string SecondString. If
1847 FirstString is identical to SecondString, then 0 is returned. Otherwise, the
1848 value returned is the first mismatched lower case ASCII character in
1849 SecondString subtracted from the first mismatched lower case ASCII character
1852 If FirstString is NULL, then ASSERT().
1853 If SecondString is NULL, then ASSERT().
1854 If PcdMaximumAsciiStringLength is not zero and FirstString contains more than
1855 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
1857 If PcdMaximumAsciiStringLength is not zero and SecondString contains more
1858 than PcdMaximumAsciiStringLength ASCII characters not including the
1859 Null-terminator, then ASSERT().
1861 @param FirstString The pointer to a Null-terminated ASCII string.
1862 @param SecondString The pointer to a Null-terminated ASCII string.
1864 @retval ==0 FirstString is identical to SecondString using case insensitive
1866 @retval !=0 FirstString is not identical to SecondString using case
1867 insensitive comparisons.
1873 IN CONST CHAR8
*FirstString
,
1874 IN CONST CHAR8
*SecondString
1879 Compares two Null-terminated ASCII strings with maximum lengths, and returns
1880 the difference between the first mismatched ASCII characters.
1882 This function compares the Null-terminated ASCII string FirstString to the
1883 Null-terminated ASCII string SecondString. At most, Length ASCII characters
1884 will be compared. If Length is 0, then 0 is returned. If FirstString is
1885 identical to SecondString, then 0 is returned. Otherwise, the value returned
1886 is the first mismatched ASCII character in SecondString subtracted from the
1887 first mismatched ASCII character in FirstString.
1889 If Length > 0 and FirstString is NULL, then ASSERT().
1890 If Length > 0 and SecondString is NULL, then ASSERT().
1891 If PcdMaximumAsciiStringLength is not zero, and Length is greater than
1892 PcdMaximumAsciiStringLength, then ASSERT().
1893 If PcdMaximumAsciiStringLength is not zero, and FirstString contains more than
1894 PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,
1896 If PcdMaximumAsciiStringLength is not zero, and SecondString contains more than
1897 PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,
1900 @param FirstString The pointer to a Null-terminated ASCII string.
1901 @param SecondString The pointer to a Null-terminated ASCII string.
1902 @param Length The maximum number of ASCII characters for compare.
1904 @retval ==0 FirstString is identical to SecondString.
1905 @retval !=0 FirstString is not identical to SecondString.
1911 IN CONST CHAR8
*FirstString
,
1912 IN CONST CHAR8
*SecondString
,
1917 #ifndef DISABLE_NEW_DEPRECATED_INTERFACES
1920 [ATTENTION] This function is deprecated for security reason.
1922 Concatenates one Null-terminated ASCII string to another Null-terminated
1923 ASCII string, and returns the concatenated ASCII string.
1925 This function concatenates two Null-terminated ASCII strings. The contents of
1926 Null-terminated ASCII string Source are concatenated to the end of Null-
1927 terminated ASCII string Destination. The Null-terminated concatenated ASCII
1930 If Destination is NULL, then ASSERT().
1931 If Source is NULL, then ASSERT().
1932 If PcdMaximumAsciiStringLength is not zero and Destination contains more than
1933 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
1935 If PcdMaximumAsciiStringLength is not zero and Source contains more than
1936 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
1938 If PcdMaximumAsciiStringLength is not zero and concatenating Destination and
1939 Source results in a ASCII string with more than PcdMaximumAsciiStringLength
1940 ASCII characters, then ASSERT().
1942 @param Destination The pointer to a Null-terminated ASCII string.
1943 @param Source The pointer to a Null-terminated ASCII string.
1951 IN OUT CHAR8
*Destination
,
1952 IN CONST CHAR8
*Source
1957 [ATTENTION] This function is deprecated for security reason.
1959 Concatenates up to a specified length one Null-terminated ASCII string to
1960 the end of another Null-terminated ASCII string, and returns the
1961 concatenated ASCII string.
1963 This function concatenates two Null-terminated ASCII strings. The contents
1964 of Null-terminated ASCII string Source are concatenated to the end of Null-
1965 terminated ASCII string Destination, and Destination is returned. At most,
1966 Length ASCII characters are concatenated from Source to the end of
1967 Destination, and Destination is always Null-terminated. If Length is 0, then
1968 Destination is returned unmodified. If Source and Destination overlap, then
1969 the results are undefined.
1971 If Length > 0 and Destination is NULL, then ASSERT().
1972 If Length > 0 and Source is NULL, then ASSERT().
1973 If Source and Destination overlap, then ASSERT().
1974 If PcdMaximumAsciiStringLength is not zero, and Length is greater than
1975 PcdMaximumAsciiStringLength, then ASSERT().
1976 If PcdMaximumAsciiStringLength is not zero, and Destination contains more than
1977 PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,
1979 If PcdMaximumAsciiStringLength is not zero, and Source contains more than
1980 PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,
1982 If PcdMaximumAsciiStringLength is not zero, and concatenating Destination and
1983 Source results in a ASCII string with more than PcdMaximumAsciiStringLength
1984 ASCII characters, not including the Null-terminator, then ASSERT().
1986 @param Destination The pointer to a Null-terminated ASCII string.
1987 @param Source The pointer to a Null-terminated ASCII string.
1988 @param Length The maximum number of ASCII characters to concatenate from
1997 IN OUT CHAR8
*Destination
,
1998 IN CONST CHAR8
*Source
,
2004 Returns the first occurrence of a Null-terminated ASCII sub-string
2005 in a Null-terminated ASCII string.
2007 This function scans the contents of the ASCII string specified by String
2008 and returns the first occurrence of SearchString. If SearchString is not
2009 found in String, then NULL is returned. If the length of SearchString is zero,
2010 then String is returned.
2012 If String is NULL, then ASSERT().
2013 If SearchString is NULL, then ASSERT().
2015 If PcdMaximumAsciiStringLength is not zero, and SearchString or
2016 String contains more than PcdMaximumAsciiStringLength Unicode characters
2017 not including the Null-terminator, then ASSERT().
2019 @param String The pointer to a Null-terminated ASCII string.
2020 @param SearchString The pointer to a Null-terminated ASCII string to search for.
2022 @retval NULL If the SearchString does not appear in String.
2023 @retval others If there is a match return the first occurrence of SearchingString.
2024 If the length of SearchString is zero,return String.
2030 IN CONST CHAR8
*String
,
2031 IN CONST CHAR8
*SearchString
2036 Convert a Null-terminated ASCII decimal string to a value of type
2039 This function returns a value of type UINTN by interpreting the contents
2040 of the ASCII string String as a decimal number. The format of the input
2041 ASCII string String is:
2043 [spaces] [decimal digits].
2045 The valid decimal digit character is in the range [0-9]. The function will
2046 ignore the pad space, which includes spaces or tab characters, before the digits.
2047 The running zero in the beginning of [decimal digits] will be ignored. Then, the
2048 function stops at the first character that is a not a valid decimal character or
2049 Null-terminator, whichever on comes first.
2051 If String has only pad spaces, then 0 is returned.
2052 If String has no pad spaces or valid decimal digits, then 0 is returned.
2053 If the number represented by String overflows according to the range defined by
2054 UINTN, then MAX_UINTN is returned.
2055 If String is NULL, then ASSERT().
2056 If PcdMaximumAsciiStringLength is not zero, and String contains more than
2057 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
2060 @param String The pointer to a Null-terminated ASCII string.
2062 @retval The value translated from String.
2067 AsciiStrDecimalToUintn (
2068 IN CONST CHAR8
*String
2073 Convert a Null-terminated ASCII decimal string to a value of type
2076 This function returns a value of type UINT64 by interpreting the contents
2077 of the ASCII string String as a decimal number. The format of the input
2078 ASCII string String is:
2080 [spaces] [decimal digits].
2082 The valid decimal digit character is in the range [0-9]. The function will
2083 ignore the pad space, which includes spaces or tab characters, before the digits.
2084 The running zero in the beginning of [decimal digits] will be ignored. Then, the
2085 function stops at the first character that is a not a valid decimal character or
2086 Null-terminator, whichever on comes first.
2088 If String has only pad spaces, then 0 is returned.
2089 If String has no pad spaces or valid decimal digits, then 0 is returned.
2090 If the number represented by String overflows according to the range defined by
2091 UINT64, then MAX_UINT64 is returned.
2092 If String is NULL, then ASSERT().
2093 If PcdMaximumAsciiStringLength is not zero, and String contains more than
2094 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
2097 @param String The pointer to a Null-terminated ASCII string.
2099 @retval Value translated from String.
2104 AsciiStrDecimalToUint64 (
2105 IN CONST CHAR8
*String
2110 Convert a Null-terminated ASCII hexadecimal string to a value of type UINTN.
2112 This function returns a value of type UINTN by interpreting the contents of
2113 the ASCII string String as a hexadecimal number. The format of the input ASCII
2116 [spaces][zeros][x][hexadecimal digits].
2118 The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].
2119 The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. If "x"
2120 appears in the input string, it must be prefixed with at least one 0. The function
2121 will ignore the pad space, which includes spaces or tab characters, before [zeros],
2122 [x] or [hexadecimal digits]. The running zero before [x] or [hexadecimal digits]
2123 will be ignored. Then, the decoding starts after [x] or the first valid hexadecimal
2124 digit. Then, the function stops at the first character that is a not a valid
2125 hexadecimal character or Null-terminator, whichever on comes first.
2127 If String has only pad spaces, then 0 is returned.
2128 If String has no leading pad spaces, leading zeros or valid hexadecimal digits, then
2131 If the number represented by String overflows according to the range defined by UINTN,
2132 then MAX_UINTN is returned.
2133 If String is NULL, then ASSERT().
2134 If PcdMaximumAsciiStringLength is not zero,
2135 and String contains more than PcdMaximumAsciiStringLength ASCII characters not including
2136 the Null-terminator, then ASSERT().
2138 @param String The pointer to a Null-terminated ASCII string.
2140 @retval Value translated from String.
2145 AsciiStrHexToUintn (
2146 IN CONST CHAR8
*String
2151 Convert a Null-terminated ASCII hexadecimal string to a value of type UINT64.
2153 This function returns a value of type UINT64 by interpreting the contents of
2154 the ASCII string String as a hexadecimal number. The format of the input ASCII
2157 [spaces][zeros][x][hexadecimal digits].
2159 The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].
2160 The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. If "x"
2161 appears in the input string, it must be prefixed with at least one 0. The function
2162 will ignore the pad space, which includes spaces or tab characters, before [zeros],
2163 [x] or [hexadecimal digits]. The running zero before [x] or [hexadecimal digits]
2164 will be ignored. Then, the decoding starts after [x] or the first valid hexadecimal
2165 digit. Then, the function stops at the first character that is a not a valid
2166 hexadecimal character or Null-terminator, whichever on comes first.
2168 If String has only pad spaces, then 0 is returned.
2169 If String has no leading pad spaces, leading zeros or valid hexadecimal digits, then
2172 If the number represented by String overflows according to the range defined by UINT64,
2173 then MAX_UINT64 is returned.
2174 If String is NULL, then ASSERT().
2175 If PcdMaximumAsciiStringLength is not zero,
2176 and String contains more than PcdMaximumAsciiStringLength ASCII characters not including
2177 the Null-terminator, then ASSERT().
2179 @param String The pointer to a Null-terminated ASCII string.
2181 @retval Value translated from String.
2186 AsciiStrHexToUint64 (
2187 IN CONST CHAR8
*String
2190 #ifndef DISABLE_NEW_DEPRECATED_INTERFACES
2193 [ATTENTION] This function is deprecated for security reason.
2195 Convert one Null-terminated ASCII string to a Null-terminated
2196 Unicode string and returns the Unicode string.
2198 This function converts the contents of the ASCII string Source to the Unicode
2199 string Destination, and returns Destination. The function terminates the
2200 Unicode string Destination by appending a Null-terminator character at the end.
2201 The caller is responsible to make sure Destination points to a buffer with size
2202 equal or greater than ((AsciiStrLen (Source) + 1) * sizeof (CHAR16)) in bytes.
2204 If Destination is NULL, then ASSERT().
2205 If Destination is not aligned on a 16-bit boundary, then ASSERT().
2206 If Source is NULL, then ASSERT().
2207 If Source and Destination overlap, then ASSERT().
2208 If PcdMaximumAsciiStringLength is not zero, and Source contains more than
2209 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
2211 If PcdMaximumUnicodeStringLength is not zero, and Source contains more than
2212 PcdMaximumUnicodeStringLength ASCII characters not including the
2213 Null-terminator, then ASSERT().
2215 @param Source The pointer to a Null-terminated ASCII string.
2216 @param Destination The pointer to a Null-terminated Unicode string.
2218 @return Destination.
2223 AsciiStrToUnicodeStr (
2224 IN CONST CHAR8
*Source
,
2225 OUT CHAR16
*Destination
2231 Convert one Null-terminated ASCII string to a Null-terminated
2234 This function is similar to StrCpyS.
2236 This function converts the contents of the ASCII string Source to the Unicode
2237 string Destination. The function terminates the Unicode string Destination by
2238 appending a Null-terminator character at the end.
2240 The caller is responsible to make sure Destination points to a buffer with size
2241 equal or greater than ((AsciiStrLen (Source) + 1) * sizeof (CHAR16)) in bytes.
2243 If Destination is not aligned on a 16-bit boundary, then ASSERT().
2244 If an error would be returned, then the function will also ASSERT().
2246 If an error is returned, then the Destination is unmodified.
2248 @param Source The pointer to a Null-terminated ASCII string.
2249 @param Destination The pointer to a Null-terminated Unicode string.
2250 @param DestMax The maximum number of Destination Unicode
2251 char, including terminating null char.
2253 @retval RETURN_SUCCESS String is converted.
2254 @retval RETURN_BUFFER_TOO_SMALL If DestMax is NOT greater than StrLen(Source).
2255 @retval RETURN_INVALID_PARAMETER If Destination is NULL.
2257 If PcdMaximumUnicodeStringLength is not zero,
2258 and DestMax is greater than
2259 PcdMaximumUnicodeStringLength.
2260 If PcdMaximumAsciiStringLength is not zero,
2261 and DestMax is greater than
2262 PcdMaximumAsciiStringLength.
2264 @retval RETURN_ACCESS_DENIED If Source and Destination overlap.
2269 AsciiStrToUnicodeStrS (
2270 IN CONST CHAR8
*Source
,
2271 OUT CHAR16
*Destination
,
2276 Convert not more than Length successive characters from a Null-terminated
2277 Ascii string to a Null-terminated Unicode string. If no null char is copied
2278 from Source, then Destination[Length] is always set to null.
2280 This function converts not more than Length successive characters from the
2281 Ascii string Source to the Unicode string Destination. The function
2282 terminates the Unicode string Destination by appending a Null-terminator
2283 character at the end.
2285 The caller is responsible to make sure Destination points to a buffer with
2286 size not smaller than
2287 ((MIN(AsciiStrLen(Source), Length) + 1) * sizeof (CHAR8)) in bytes.
2289 If Destination is not aligned on a 16-bit boundary, then ASSERT().
2290 If an error would be returned, then the function will also ASSERT().
2292 If an error is returned, then Destination and DestinationLength are
2295 @param Source The pointer to a Null-terminated Ascii string.
2296 @param Length The maximum number of Ascii characters to convert.
2297 @param Destination The pointer to a Null-terminated Unicode string.
2298 @param DestMax The maximum number of Destination Unicode char,
2299 including terminating null char.
2300 @param DestinationLength The number of Ascii characters converted.
2302 @retval RETURN_SUCCESS String is converted.
2303 @retval RETURN_INVALID_PARAMETER If Destination is NULL.
2305 If DestinationLength is NULL.
2306 If PcdMaximumUnicodeStringLength is not
2307 zero, and Length or DestMax is greater than
2308 PcdMaximumUnicodeStringLength.
2309 If PcdMaximumAsciiStringLength is not zero,
2310 and Length or DestMax is greater than
2311 PcdMaximumAsciiStringLength.
2313 @retval RETURN_BUFFER_TOO_SMALL If DestMax is NOT greater than
2314 MIN(AsciiStrLen(Source), Length).
2315 @retval RETURN_ACCESS_DENIED If Source and Destination overlap.
2320 AsciiStrnToUnicodeStrS (
2321 IN CONST CHAR8
*Source
,
2323 OUT CHAR16
*Destination
,
2325 OUT UINTN
*DestinationLength
2329 Converts an 8-bit value to an 8-bit BCD value.
2331 Converts the 8-bit value specified by Value to BCD. The BCD value is
2334 If Value >= 100, then ASSERT().
2336 @param Value The 8-bit value to convert to BCD. Range 0..99.
2338 @return The BCD value.
2349 Converts an 8-bit BCD value to an 8-bit value.
2351 Converts the 8-bit BCD value specified by Value to an 8-bit value. The 8-bit
2354 If Value >= 0xA0, then ASSERT().
2355 If (Value & 0x0F) >= 0x0A, then ASSERT().
2357 @param Value The 8-bit BCD value to convert to an 8-bit value.
2359 @return The 8-bit value is returned.
2369 // File Path Manipulation Functions
2373 Removes the last directory or file entry in a path.
2375 @param[in, out] Path The pointer to the path to modify.
2377 @retval FALSE Nothing was found to remove.
2378 @retval TRUE A directory or file was removed.
2387 Function to clean up paths.
2388 - Single periods in the path are removed.
2389 - Double periods in the path are removed along with a single parent directory.
2390 - Forward slashes L'/' are converted to backward slashes L'\'.
2392 This will be done inline and the existing buffer may be larger than required
2395 @param[in] Path The pointer to the string containing the path.
2397 @return Returns Path, otherwise returns NULL to indicate that an error has occurred.
2401 PathCleanUpDirectories(
2406 // Linked List Functions and Macros
2410 Initializes the head node of a doubly linked list that is declared as a
2411 global variable in a module.
2413 Initializes the forward and backward links of a new linked list. After
2414 initializing a linked list with this macro, the other linked list functions
2415 may be used to add and remove nodes from the linked list. This macro results
2416 in smaller executables by initializing the linked list in the data section,
2417 instead if calling the InitializeListHead() function to perform the
2418 equivalent operation.
2420 @param ListHead The head note of a list to initialize.
2423 #define INITIALIZE_LIST_HEAD_VARIABLE(ListHead) {&(ListHead), &(ListHead)}
2427 Initializes the head node of a doubly linked list, and returns the pointer to
2428 the head node of the doubly linked list.
2430 Initializes the forward and backward links of a new linked list. After
2431 initializing a linked list with this function, the other linked list
2432 functions may be used to add and remove nodes from the linked list. It is up
2433 to the caller of this function to allocate the memory for ListHead.
2435 If ListHead is NULL, then ASSERT().
2437 @param ListHead A pointer to the head node of a new doubly linked list.
2444 InitializeListHead (
2445 IN OUT LIST_ENTRY
*ListHead
2450 Adds a node to the beginning of a doubly linked list, and returns the pointer
2451 to the head node of the doubly linked list.
2453 Adds the node Entry at the beginning of the doubly linked list denoted by
2454 ListHead, and returns ListHead.
2456 If ListHead is NULL, then ASSERT().
2457 If Entry is NULL, then ASSERT().
2458 If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or
2459 InitializeListHead(), then ASSERT().
2460 If PcdMaximumLinkedListLength is not zero, and prior to insertion the number
2461 of nodes in ListHead, including the ListHead node, is greater than or
2462 equal to PcdMaximumLinkedListLength, then ASSERT().
2464 @param ListHead A pointer to the head node of a doubly linked list.
2465 @param Entry A pointer to a node that is to be inserted at the beginning
2466 of a doubly linked list.
2474 IN OUT LIST_ENTRY
*ListHead
,
2475 IN OUT LIST_ENTRY
*Entry
2480 Adds a node to the end of a doubly linked list, and returns the pointer to
2481 the head node of the doubly linked list.
2483 Adds the node Entry to the end of the doubly linked list denoted by ListHead,
2484 and returns ListHead.
2486 If ListHead is NULL, then ASSERT().
2487 If Entry is NULL, then ASSERT().
2488 If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or
2489 InitializeListHead(), then ASSERT().
2490 If PcdMaximumLinkedListLength is not zero, and prior to insertion the number
2491 of nodes in ListHead, including the ListHead node, is greater than or
2492 equal to PcdMaximumLinkedListLength, then ASSERT().
2494 @param ListHead A pointer to the head node of a doubly linked list.
2495 @param Entry A pointer to a node that is to be added at the end of the
2504 IN OUT LIST_ENTRY
*ListHead
,
2505 IN OUT LIST_ENTRY
*Entry
2510 Retrieves the first node of a doubly linked list.
2512 Returns the first node of a doubly linked list. List must have been
2513 initialized with INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead().
2514 If List is empty, then List is returned.
2516 If List is NULL, then ASSERT().
2517 If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or
2518 InitializeListHead(), then ASSERT().
2519 If PcdMaximumLinkedListLength is not zero, and the number of nodes
2520 in List, including the List node, is greater than or equal to
2521 PcdMaximumLinkedListLength, then ASSERT().
2523 @param List A pointer to the head node of a doubly linked list.
2525 @return The first node of a doubly linked list.
2526 @retval List The list is empty.
2532 IN CONST LIST_ENTRY
*List
2537 Retrieves the next node of a doubly linked list.
2539 Returns the node of a doubly linked list that follows Node.
2540 List must have been initialized with INTIALIZE_LIST_HEAD_VARIABLE()
2541 or InitializeListHead(). If List is empty, then List is returned.
2543 If List is NULL, then ASSERT().
2544 If Node is NULL, then ASSERT().
2545 If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or
2546 InitializeListHead(), then ASSERT().
2547 If PcdMaximumLinkedListLength is not zero, and List contains more than
2548 PcdMaximumLinkedListLength nodes, then ASSERT().
2549 If PcdVerifyNodeInList is TRUE and Node is not a node in List, then ASSERT().
2551 @param List A pointer to the head node of a doubly linked list.
2552 @param Node A pointer to a node in the doubly linked list.
2554 @return The pointer to the next node if one exists. Otherwise List is returned.
2560 IN CONST LIST_ENTRY
*List
,
2561 IN CONST LIST_ENTRY
*Node
2566 Retrieves the previous node of a doubly linked list.
2568 Returns the node of a doubly linked list that precedes Node.
2569 List must have been initialized with INTIALIZE_LIST_HEAD_VARIABLE()
2570 or InitializeListHead(). If List is empty, then List is returned.
2572 If List is NULL, then ASSERT().
2573 If Node is NULL, then ASSERT().
2574 If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or
2575 InitializeListHead(), then ASSERT().
2576 If PcdMaximumLinkedListLength is not zero, and List contains more than
2577 PcdMaximumLinkedListLength nodes, then ASSERT().
2578 If PcdVerifyNodeInList is TRUE and Node is not a node in List, then ASSERT().
2580 @param List A pointer to the head node of a doubly linked list.
2581 @param Node A pointer to a node in the doubly linked list.
2583 @return The pointer to the previous node if one exists. Otherwise List is returned.
2589 IN CONST LIST_ENTRY
*List
,
2590 IN CONST LIST_ENTRY
*Node
2595 Checks to see if a doubly linked list is empty or not.
2597 Checks to see if the doubly linked list is empty. If the linked list contains
2598 zero nodes, this function returns TRUE. Otherwise, it returns FALSE.
2600 If ListHead is NULL, then ASSERT().
2601 If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or
2602 InitializeListHead(), then ASSERT().
2603 If PcdMaximumLinkedListLength is not zero, and the number of nodes
2604 in List, including the List node, is greater than or equal to
2605 PcdMaximumLinkedListLength, then ASSERT().
2607 @param ListHead A pointer to the head node of a doubly linked list.
2609 @retval TRUE The linked list is empty.
2610 @retval FALSE The linked list is not empty.
2616 IN CONST LIST_ENTRY
*ListHead
2621 Determines if a node in a doubly linked list is the head node of a the same
2622 doubly linked list. This function is typically used to terminate a loop that
2623 traverses all the nodes in a doubly linked list starting with the head node.
2625 Returns TRUE if Node is equal to List. Returns FALSE if Node is one of the
2626 nodes in the doubly linked list specified by List. List must have been
2627 initialized with INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead().
2629 If List is NULL, then ASSERT().
2630 If Node is NULL, then ASSERT().
2631 If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead(),
2633 If PcdMaximumLinkedListLength is not zero, and the number of nodes
2634 in List, including the List node, is greater than or equal to
2635 PcdMaximumLinkedListLength, then ASSERT().
2636 If PcdVerifyNodeInList is TRUE and Node is not a node in List the and Node is not equal
2637 to List, then ASSERT().
2639 @param List A pointer to the head node of a doubly linked list.
2640 @param Node A pointer to a node in the doubly linked list.
2642 @retval TRUE Node is the head of the doubly-linked list pointed by List.
2643 @retval FALSE Node is not the head of the doubly-linked list pointed by List.
2649 IN CONST LIST_ENTRY
*List
,
2650 IN CONST LIST_ENTRY
*Node
2655 Determines if a node the last node in a doubly linked list.
2657 Returns TRUE if Node is the last node in the doubly linked list specified by
2658 List. Otherwise, FALSE is returned. List must have been initialized with
2659 INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead().
2661 If List is NULL, then ASSERT().
2662 If Node is NULL, then ASSERT().
2663 If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or
2664 InitializeListHead(), then ASSERT().
2665 If PcdMaximumLinkedListLength is not zero, and the number of nodes
2666 in List, including the List node, is greater than or equal to
2667 PcdMaximumLinkedListLength, then ASSERT().
2668 If PcdVerifyNodeInList is TRUE and Node is not a node in List, then ASSERT().
2670 @param List A pointer to the head node of a doubly linked list.
2671 @param Node A pointer to a node in the doubly linked list.
2673 @retval TRUE Node is the last node in the linked list.
2674 @retval FALSE Node is not the last node in the linked list.
2680 IN CONST LIST_ENTRY
*List
,
2681 IN CONST LIST_ENTRY
*Node
2686 Swaps the location of two nodes in a doubly linked list, and returns the
2687 first node after the swap.
2689 If FirstEntry is identical to SecondEntry, then SecondEntry is returned.
2690 Otherwise, the location of the FirstEntry node is swapped with the location
2691 of the SecondEntry node in a doubly linked list. SecondEntry must be in the
2692 same double linked list as FirstEntry and that double linked list must have
2693 been initialized with INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead().
2694 SecondEntry is returned after the nodes are swapped.
2696 If FirstEntry is NULL, then ASSERT().
2697 If SecondEntry is NULL, then ASSERT().
2698 If PcdVerifyNodeInList is TRUE and SecondEntry and FirstEntry are not in the
2699 same linked list, then ASSERT().
2700 If PcdMaximumLinkedListLength is not zero, and the number of nodes in the
2701 linked list containing the FirstEntry and SecondEntry nodes, including
2702 the FirstEntry and SecondEntry nodes, is greater than or equal to
2703 PcdMaximumLinkedListLength, then ASSERT().
2705 @param FirstEntry A pointer to a node in a linked list.
2706 @param SecondEntry A pointer to another node in the same linked list.
2708 @return SecondEntry.
2714 IN OUT LIST_ENTRY
*FirstEntry
,
2715 IN OUT LIST_ENTRY
*SecondEntry
2720 Removes a node from a doubly linked list, and returns the node that follows
2723 Removes the node Entry from a doubly linked list. It is up to the caller of
2724 this function to release the memory used by this node if that is required. On
2725 exit, the node following Entry in the doubly linked list is returned. If
2726 Entry is the only node in the linked list, then the head node of the linked
2729 If Entry is NULL, then ASSERT().
2730 If Entry is the head node of an empty list, then ASSERT().
2731 If PcdMaximumLinkedListLength is not zero, and the number of nodes in the
2732 linked list containing Entry, including the Entry node, is greater than
2733 or equal to PcdMaximumLinkedListLength, then ASSERT().
2735 @param Entry A pointer to a node in a linked list.
2743 IN CONST LIST_ENTRY
*Entry
2751 Shifts a 64-bit integer left between 0 and 63 bits. The low bits are filled
2752 with zeros. The shifted value is returned.
2754 This function shifts the 64-bit value Operand to the left by Count bits. The
2755 low Count bits are set to zero. The shifted value is returned.
2757 If Count is greater than 63, then ASSERT().
2759 @param Operand The 64-bit operand to shift left.
2760 @param Count The number of bits to shift left.
2762 @return Operand << Count.
2774 Shifts a 64-bit integer right between 0 and 63 bits. This high bits are
2775 filled with zeros. The shifted value is returned.
2777 This function shifts the 64-bit value Operand to the right by Count bits. The
2778 high Count bits are set to zero. The shifted value is returned.
2780 If Count is greater than 63, then ASSERT().
2782 @param Operand The 64-bit operand to shift right.
2783 @param Count The number of bits to shift right.
2785 @return Operand >> Count
2797 Shifts a 64-bit integer right between 0 and 63 bits. The high bits are filled
2798 with original integer's bit 63. The shifted value is returned.
2800 This function shifts the 64-bit value Operand to the right by Count bits. The
2801 high Count bits are set to bit 63 of Operand. The shifted value is returned.
2803 If Count is greater than 63, then ASSERT().
2805 @param Operand The 64-bit operand to shift right.
2806 @param Count The number of bits to shift right.
2808 @return Operand >> Count
2820 Rotates a 32-bit integer left between 0 and 31 bits, filling the low bits
2821 with the high bits that were rotated.
2823 This function rotates the 32-bit value Operand to the left by Count bits. The
2824 low Count bits are fill with the high Count bits of Operand. The rotated
2827 If Count is greater than 31, then ASSERT().
2829 @param Operand The 32-bit operand to rotate left.
2830 @param Count The number of bits to rotate left.
2832 @return Operand << Count
2844 Rotates a 32-bit integer right between 0 and 31 bits, filling the high bits
2845 with the low bits that were rotated.
2847 This function rotates the 32-bit value Operand to the right by Count bits.
2848 The high Count bits are fill with the low Count bits of Operand. The rotated
2851 If Count is greater than 31, then ASSERT().
2853 @param Operand The 32-bit operand to rotate right.
2854 @param Count The number of bits to rotate right.
2856 @return Operand >> Count
2868 Rotates a 64-bit integer left between 0 and 63 bits, filling the low bits
2869 with the high bits that were rotated.
2871 This function rotates the 64-bit value Operand to the left by Count bits. The
2872 low Count bits are fill with the high Count bits of Operand. The rotated
2875 If Count is greater than 63, then ASSERT().
2877 @param Operand The 64-bit operand to rotate left.
2878 @param Count The number of bits to rotate left.
2880 @return Operand << Count
2892 Rotates a 64-bit integer right between 0 and 63 bits, filling the high bits
2893 with the high low bits that were rotated.
2895 This function rotates the 64-bit value Operand to the right by Count bits.
2896 The high Count bits are fill with the low Count bits of Operand. The rotated
2899 If Count is greater than 63, then ASSERT().
2901 @param Operand The 64-bit operand to rotate right.
2902 @param Count The number of bits to rotate right.
2904 @return Operand >> Count
2916 Returns the bit position of the lowest bit set in a 32-bit value.
2918 This function computes the bit position of the lowest bit set in the 32-bit
2919 value specified by Operand. If Operand is zero, then -1 is returned.
2920 Otherwise, a value between 0 and 31 is returned.
2922 @param Operand The 32-bit operand to evaluate.
2924 @retval 0..31 The lowest bit set in Operand was found.
2925 @retval -1 Operand is zero.
2936 Returns the bit position of the lowest bit set in a 64-bit value.
2938 This function computes the bit position of the lowest bit set in the 64-bit
2939 value specified by Operand. If Operand is zero, then -1 is returned.
2940 Otherwise, a value between 0 and 63 is returned.
2942 @param Operand The 64-bit operand to evaluate.
2944 @retval 0..63 The lowest bit set in Operand was found.
2945 @retval -1 Operand is zero.
2957 Returns the bit position of the highest bit set in a 32-bit value. Equivalent
2960 This function computes the bit position of the highest bit set in the 32-bit
2961 value specified by Operand. If Operand is zero, then -1 is returned.
2962 Otherwise, a value between 0 and 31 is returned.
2964 @param Operand The 32-bit operand to evaluate.
2966 @retval 0..31 Position of the highest bit set in Operand if found.
2967 @retval -1 Operand is zero.
2978 Returns the bit position of the highest bit set in a 64-bit value. Equivalent
2981 This function computes the bit position of the highest bit set in the 64-bit
2982 value specified by Operand. If Operand is zero, then -1 is returned.
2983 Otherwise, a value between 0 and 63 is returned.
2985 @param Operand The 64-bit operand to evaluate.
2987 @retval 0..63 Position of the highest bit set in Operand if found.
2988 @retval -1 Operand is zero.
2999 Returns the value of the highest bit set in a 32-bit value. Equivalent to
3002 This function computes the value of the highest bit set in the 32-bit value
3003 specified by Operand. If Operand is zero, then zero is returned.
3005 @param Operand The 32-bit operand to evaluate.
3007 @return 1 << HighBitSet32(Operand)
3008 @retval 0 Operand is zero.
3019 Returns the value of the highest bit set in a 64-bit value. Equivalent to
3022 This function computes the value of the highest bit set in the 64-bit value
3023 specified by Operand. If Operand is zero, then zero is returned.
3025 @param Operand The 64-bit operand to evaluate.
3027 @return 1 << HighBitSet64(Operand)
3028 @retval 0 Operand is zero.
3039 Switches the endianness of a 16-bit integer.
3041 This function swaps the bytes in a 16-bit unsigned value to switch the value
3042 from little endian to big endian or vice versa. The byte swapped value is
3045 @param Value A 16-bit unsigned value.
3047 @return The byte swapped Value.
3058 Switches the endianness of a 32-bit integer.
3060 This function swaps the bytes in a 32-bit unsigned value to switch the value
3061 from little endian to big endian or vice versa. The byte swapped value is
3064 @param Value A 32-bit unsigned value.
3066 @return The byte swapped Value.
3077 Switches the endianness of a 64-bit integer.
3079 This function swaps the bytes in a 64-bit unsigned value to switch the value
3080 from little endian to big endian or vice versa. The byte swapped value is
3083 @param Value A 64-bit unsigned value.
3085 @return The byte swapped Value.
3096 Multiples a 64-bit unsigned integer by a 32-bit unsigned integer and
3097 generates a 64-bit unsigned result.
3099 This function multiples the 64-bit unsigned value Multiplicand by the 32-bit
3100 unsigned value Multiplier and generates a 64-bit unsigned result. This 64-
3101 bit unsigned result is returned.
3103 @param Multiplicand A 64-bit unsigned value.
3104 @param Multiplier A 32-bit unsigned value.
3106 @return Multiplicand * Multiplier
3112 IN UINT64 Multiplicand
,
3113 IN UINT32 Multiplier
3118 Multiples a 64-bit unsigned integer by a 64-bit unsigned integer and
3119 generates a 64-bit unsigned result.
3121 This function multiples the 64-bit unsigned value Multiplicand by the 64-bit
3122 unsigned value Multiplier and generates a 64-bit unsigned result. This 64-
3123 bit unsigned result is returned.
3125 @param Multiplicand A 64-bit unsigned value.
3126 @param Multiplier A 64-bit unsigned value.
3128 @return Multiplicand * Multiplier.
3134 IN UINT64 Multiplicand
,
3135 IN UINT64 Multiplier
3140 Multiples a 64-bit signed integer by a 64-bit signed integer and generates a
3141 64-bit signed result.
3143 This function multiples the 64-bit signed value Multiplicand by the 64-bit
3144 signed value Multiplier and generates a 64-bit signed result. This 64-bit
3145 signed result is returned.
3147 @param Multiplicand A 64-bit signed value.
3148 @param Multiplier A 64-bit signed value.
3150 @return Multiplicand * Multiplier
3156 IN INT64 Multiplicand
,
3162 Divides a 64-bit unsigned integer by a 32-bit unsigned integer and generates
3163 a 64-bit unsigned result.
3165 This function divides the 64-bit unsigned value Dividend by the 32-bit
3166 unsigned value Divisor and generates a 64-bit unsigned quotient. This
3167 function returns the 64-bit unsigned quotient.
3169 If Divisor is 0, then ASSERT().
3171 @param Dividend A 64-bit unsigned value.
3172 @param Divisor A 32-bit unsigned value.
3174 @return Dividend / Divisor.
3186 Divides a 64-bit unsigned integer by a 32-bit unsigned integer and generates
3187 a 32-bit unsigned remainder.
3189 This function divides the 64-bit unsigned value Dividend by the 32-bit
3190 unsigned value Divisor and generates a 32-bit remainder. This function
3191 returns the 32-bit unsigned remainder.
3193 If Divisor is 0, then ASSERT().
3195 @param Dividend A 64-bit unsigned value.
3196 @param Divisor A 32-bit unsigned value.
3198 @return Dividend % Divisor.
3210 Divides a 64-bit unsigned integer by a 32-bit unsigned integer and generates
3211 a 64-bit unsigned result and an optional 32-bit unsigned remainder.
3213 This function divides the 64-bit unsigned value Dividend by the 32-bit
3214 unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder
3215 is not NULL, then the 32-bit unsigned remainder is returned in Remainder.
3216 This function returns the 64-bit unsigned quotient.
3218 If Divisor is 0, then ASSERT().
3220 @param Dividend A 64-bit unsigned value.
3221 @param Divisor A 32-bit unsigned value.
3222 @param Remainder A pointer to a 32-bit unsigned value. This parameter is
3223 optional and may be NULL.
3225 @return Dividend / Divisor.
3230 DivU64x32Remainder (
3233 OUT UINT32
*Remainder OPTIONAL
3238 Divides a 64-bit unsigned integer by a 64-bit unsigned integer and generates
3239 a 64-bit unsigned result and an optional 64-bit unsigned remainder.
3241 This function divides the 64-bit unsigned value Dividend by the 64-bit
3242 unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder
3243 is not NULL, then the 64-bit unsigned remainder is returned in Remainder.
3244 This function returns the 64-bit unsigned quotient.
3246 If Divisor is 0, then ASSERT().
3248 @param Dividend A 64-bit unsigned value.
3249 @param Divisor A 64-bit unsigned value.
3250 @param Remainder A pointer to a 64-bit unsigned value. This parameter is
3251 optional and may be NULL.
3253 @return Dividend / Divisor.
3258 DivU64x64Remainder (
3261 OUT UINT64
*Remainder OPTIONAL
3266 Divides a 64-bit signed integer by a 64-bit signed integer and generates a
3267 64-bit signed result and a optional 64-bit signed remainder.
3269 This function divides the 64-bit signed value Dividend by the 64-bit signed
3270 value Divisor and generates a 64-bit signed quotient. If Remainder is not
3271 NULL, then the 64-bit signed remainder is returned in Remainder. This
3272 function returns the 64-bit signed quotient.
3274 It is the caller's responsibility to not call this function with a Divisor of 0.
3275 If Divisor is 0, then the quotient and remainder should be assumed to be
3276 the largest negative integer.
3278 If Divisor is 0, then ASSERT().
3280 @param Dividend A 64-bit signed value.
3281 @param Divisor A 64-bit signed value.
3282 @param Remainder A pointer to a 64-bit signed value. This parameter is
3283 optional and may be NULL.
3285 @return Dividend / Divisor.
3290 DivS64x64Remainder (
3293 OUT INT64
*Remainder OPTIONAL
3298 Reads a 16-bit value from memory that may be unaligned.
3300 This function returns the 16-bit value pointed to by Buffer. The function
3301 guarantees that the read operation does not produce an alignment fault.
3303 If the Buffer is NULL, then ASSERT().
3305 @param Buffer The pointer to a 16-bit value that may be unaligned.
3307 @return The 16-bit value read from Buffer.
3313 IN CONST UINT16
*Buffer
3318 Writes a 16-bit value to memory that may be unaligned.
3320 This function writes the 16-bit value specified by Value to Buffer. Value is
3321 returned. The function guarantees that the write operation does not produce
3324 If the Buffer is NULL, then ASSERT().
3326 @param Buffer The pointer to a 16-bit value that may be unaligned.
3327 @param Value 16-bit value to write to Buffer.
3329 @return The 16-bit value to write to Buffer.
3341 Reads a 24-bit value from memory that may be unaligned.
3343 This function returns the 24-bit value pointed to by Buffer. The function
3344 guarantees that the read operation does not produce an alignment fault.
3346 If the Buffer is NULL, then ASSERT().
3348 @param Buffer The pointer to a 24-bit value that may be unaligned.
3350 @return The 24-bit value read from Buffer.
3356 IN CONST UINT32
*Buffer
3361 Writes a 24-bit value to memory that may be unaligned.
3363 This function writes the 24-bit value specified by Value to Buffer. Value is
3364 returned. The function guarantees that the write operation does not produce
3367 If the Buffer is NULL, then ASSERT().
3369 @param Buffer The pointer to a 24-bit value that may be unaligned.
3370 @param Value 24-bit value to write to Buffer.
3372 @return The 24-bit value to write to Buffer.
3384 Reads a 32-bit value from memory that may be unaligned.
3386 This function returns the 32-bit value pointed to by Buffer. The function
3387 guarantees that the read operation does not produce an alignment fault.
3389 If the Buffer is NULL, then ASSERT().
3391 @param Buffer The pointer to a 32-bit value that may be unaligned.
3393 @return The 32-bit value read from Buffer.
3399 IN CONST UINT32
*Buffer
3404 Writes a 32-bit value to memory that may be unaligned.
3406 This function writes the 32-bit value specified by Value to Buffer. Value is
3407 returned. The function guarantees that the write operation does not produce
3410 If the Buffer is NULL, then ASSERT().
3412 @param Buffer The pointer to a 32-bit value that may be unaligned.
3413 @param Value 32-bit value to write to Buffer.
3415 @return The 32-bit value to write to Buffer.
3427 Reads a 64-bit value from memory that may be unaligned.
3429 This function returns the 64-bit value pointed to by Buffer. The function
3430 guarantees that the read operation does not produce an alignment fault.
3432 If the Buffer is NULL, then ASSERT().
3434 @param Buffer The pointer to a 64-bit value that may be unaligned.
3436 @return The 64-bit value read from Buffer.
3442 IN CONST UINT64
*Buffer
3447 Writes a 64-bit value to memory that may be unaligned.
3449 This function writes the 64-bit value specified by Value to Buffer. Value is
3450 returned. The function guarantees that the write operation does not produce
3453 If the Buffer is NULL, then ASSERT().
3455 @param Buffer The pointer to a 64-bit value that may be unaligned.
3456 @param Value 64-bit value to write to Buffer.
3458 @return The 64-bit value to write to Buffer.
3470 // Bit Field Functions
3474 Returns a bit field from an 8-bit value.
3476 Returns the bitfield specified by the StartBit and the EndBit from Operand.
3478 If 8-bit operations are not supported, then ASSERT().
3479 If StartBit is greater than 7, then ASSERT().
3480 If EndBit is greater than 7, then ASSERT().
3481 If EndBit is less than StartBit, then ASSERT().
3483 @param Operand Operand on which to perform the bitfield operation.
3484 @param StartBit The ordinal of the least significant bit in the bit field.
3486 @param EndBit The ordinal of the most significant bit in the bit field.
3489 @return The bit field read.
3502 Writes a bit field to an 8-bit value, and returns the result.
3504 Writes Value to the bit field specified by the StartBit and the EndBit in
3505 Operand. All other bits in Operand are preserved. The new 8-bit value is
3508 If 8-bit operations are not supported, then ASSERT().
3509 If StartBit is greater than 7, then ASSERT().
3510 If EndBit is greater than 7, then ASSERT().
3511 If EndBit is less than StartBit, then ASSERT().
3512 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
3514 @param Operand Operand on which to perform the bitfield operation.
3515 @param StartBit The ordinal of the least significant bit in the bit field.
3517 @param EndBit The ordinal of the most significant bit in the bit field.
3519 @param Value New value of the bit field.
3521 @return The new 8-bit value.
3535 Reads a bit field from an 8-bit value, performs a bitwise OR, and returns the
3538 Performs a bitwise OR between the bit field specified by StartBit
3539 and EndBit in Operand and the value specified by OrData. All other bits in
3540 Operand are preserved. The new 8-bit value is returned.
3542 If 8-bit operations are not supported, then ASSERT().
3543 If StartBit is greater than 7, then ASSERT().
3544 If EndBit is greater than 7, then ASSERT().
3545 If EndBit is less than StartBit, then ASSERT().
3546 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
3548 @param Operand Operand on which to perform the bitfield operation.
3549 @param StartBit The ordinal of the least significant bit in the bit field.
3551 @param EndBit The ordinal of the most significant bit in the bit field.
3553 @param OrData The value to OR with the read value from the value
3555 @return The new 8-bit value.
3569 Reads a bit field from an 8-bit value, performs a bitwise AND, and returns
3572 Performs a bitwise AND between the bit field specified by StartBit and EndBit
3573 in Operand and the value specified by AndData. All other bits in Operand are
3574 preserved. The new 8-bit value is returned.
3576 If 8-bit operations are not supported, then ASSERT().
3577 If StartBit is greater than 7, then ASSERT().
3578 If EndBit is greater than 7, then ASSERT().
3579 If EndBit is less than StartBit, then ASSERT().
3580 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
3582 @param Operand Operand on which to perform the bitfield operation.
3583 @param StartBit The ordinal of the least significant bit in the bit field.
3585 @param EndBit The ordinal of the most significant bit in the bit field.
3587 @param AndData The value to AND with the read value from the value.
3589 @return The new 8-bit value.
3603 Reads a bit field from an 8-bit value, performs a bitwise AND followed by a
3604 bitwise OR, and returns the result.
3606 Performs a bitwise AND between the bit field specified by StartBit and EndBit
3607 in Operand and the value specified by AndData, followed by a bitwise
3608 OR with value specified by OrData. All other bits in Operand are
3609 preserved. The new 8-bit value is returned.
3611 If 8-bit operations are not supported, then ASSERT().
3612 If StartBit is greater than 7, then ASSERT().
3613 If EndBit is greater than 7, then ASSERT().
3614 If EndBit is less than StartBit, then ASSERT().
3615 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
3616 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
3618 @param Operand Operand on which to perform the bitfield operation.
3619 @param StartBit The ordinal of the least significant bit in the bit field.
3621 @param EndBit The ordinal of the most significant bit in the bit field.
3623 @param AndData The value to AND with the read value from the value.
3624 @param OrData The value to OR with the result of the AND operation.
3626 @return The new 8-bit value.
3631 BitFieldAndThenOr8 (
3641 Returns a bit field from a 16-bit value.
3643 Returns the bitfield specified by the StartBit and the EndBit from Operand.
3645 If 16-bit operations are not supported, then ASSERT().
3646 If StartBit is greater than 15, then ASSERT().
3647 If EndBit is greater than 15, then ASSERT().
3648 If EndBit is less than StartBit, then ASSERT().
3650 @param Operand Operand on which to perform the bitfield operation.
3651 @param StartBit The ordinal of the least significant bit in the bit field.
3653 @param EndBit The ordinal of the most significant bit in the bit field.
3656 @return The bit field read.
3669 Writes a bit field to a 16-bit value, and returns the result.
3671 Writes Value to the bit field specified by the StartBit and the EndBit in
3672 Operand. All other bits in Operand are preserved. The new 16-bit value is
3675 If 16-bit operations are not supported, then ASSERT().
3676 If StartBit is greater than 15, then ASSERT().
3677 If EndBit is greater than 15, then ASSERT().
3678 If EndBit is less than StartBit, then ASSERT().
3679 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
3681 @param Operand Operand on which to perform the bitfield operation.
3682 @param StartBit The ordinal of the least significant bit in the bit field.
3684 @param EndBit The ordinal of the most significant bit in the bit field.
3686 @param Value New value of the bit field.
3688 @return The new 16-bit value.
3702 Reads a bit field from a 16-bit value, performs a bitwise OR, and returns the
3705 Performs a bitwise OR between the bit field specified by StartBit
3706 and EndBit in Operand and the value specified by OrData. All other bits in
3707 Operand are preserved. The new 16-bit value is returned.
3709 If 16-bit operations are not supported, then ASSERT().
3710 If StartBit is greater than 15, then ASSERT().
3711 If EndBit is greater than 15, then ASSERT().
3712 If EndBit is less than StartBit, then ASSERT().
3713 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
3715 @param Operand Operand on which to perform the bitfield operation.
3716 @param StartBit The ordinal of the least significant bit in the bit field.
3718 @param EndBit The ordinal of the most significant bit in the bit field.
3720 @param OrData The value to OR with the read value from the value
3722 @return The new 16-bit value.
3736 Reads a bit field from a 16-bit value, performs a bitwise AND, and returns
3739 Performs a bitwise AND between the bit field specified by StartBit and EndBit
3740 in Operand and the value specified by AndData. All other bits in Operand are
3741 preserved. The new 16-bit value is returned.
3743 If 16-bit operations are not supported, then ASSERT().
3744 If StartBit is greater than 15, then ASSERT().
3745 If EndBit is greater than 15, then ASSERT().
3746 If EndBit is less than StartBit, then ASSERT().
3747 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
3749 @param Operand Operand on which to perform the bitfield operation.
3750 @param StartBit The ordinal of the least significant bit in the bit field.
3752 @param EndBit The ordinal of the most significant bit in the bit field.
3754 @param AndData The value to AND with the read value from the value
3756 @return The new 16-bit value.
3770 Reads a bit field from a 16-bit value, performs a bitwise AND followed by a
3771 bitwise OR, and returns the result.
3773 Performs a bitwise AND between the bit field specified by StartBit and EndBit
3774 in Operand and the value specified by AndData, followed by a bitwise
3775 OR with value specified by OrData. All other bits in Operand are
3776 preserved. The new 16-bit value is returned.
3778 If 16-bit operations are not supported, then ASSERT().
3779 If StartBit is greater than 15, then ASSERT().
3780 If EndBit is greater than 15, then ASSERT().
3781 If EndBit is less than StartBit, then ASSERT().
3782 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
3783 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
3785 @param Operand Operand on which to perform the bitfield operation.
3786 @param StartBit The ordinal of the least significant bit in the bit field.
3788 @param EndBit The ordinal of the most significant bit in the bit field.
3790 @param AndData The value to AND with the read value from the value.
3791 @param OrData The value to OR with the result of the AND operation.
3793 @return The new 16-bit value.
3798 BitFieldAndThenOr16 (
3808 Returns a bit field from a 32-bit value.
3810 Returns the bitfield specified by the StartBit and the EndBit from Operand.
3812 If 32-bit operations are not supported, then ASSERT().
3813 If StartBit is greater than 31, then ASSERT().
3814 If EndBit is greater than 31, then ASSERT().
3815 If EndBit is less than StartBit, then ASSERT().
3817 @param Operand Operand on which to perform the bitfield operation.
3818 @param StartBit The ordinal of the least significant bit in the bit field.
3820 @param EndBit The ordinal of the most significant bit in the bit field.
3823 @return The bit field read.
3836 Writes a bit field to a 32-bit value, and returns the result.
3838 Writes Value to the bit field specified by the StartBit and the EndBit in
3839 Operand. All other bits in Operand are preserved. The new 32-bit value is
3842 If 32-bit operations are not supported, then ASSERT().
3843 If StartBit is greater than 31, then ASSERT().
3844 If EndBit is greater than 31, then ASSERT().
3845 If EndBit is less than StartBit, then ASSERT().
3846 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
3848 @param Operand Operand on which to perform the bitfield operation.
3849 @param StartBit The ordinal of the least significant bit in the bit field.
3851 @param EndBit The ordinal of the most significant bit in the bit field.
3853 @param Value New value of the bit field.
3855 @return The new 32-bit value.
3869 Reads a bit field from a 32-bit value, performs a bitwise OR, and returns the
3872 Performs a bitwise OR between the bit field specified by StartBit
3873 and EndBit in Operand and the value specified by OrData. All other bits in
3874 Operand are preserved. The new 32-bit value is returned.
3876 If 32-bit operations are not supported, then ASSERT().
3877 If StartBit is greater than 31, then ASSERT().
3878 If EndBit is greater than 31, then ASSERT().
3879 If EndBit is less than StartBit, then ASSERT().
3880 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
3882 @param Operand Operand on which to perform the bitfield operation.
3883 @param StartBit The ordinal of the least significant bit in the bit field.
3885 @param EndBit The ordinal of the most significant bit in the bit field.
3887 @param OrData The value to OR with the read value from the value.
3889 @return The new 32-bit value.
3903 Reads a bit field from a 32-bit value, performs a bitwise AND, and returns
3906 Performs a bitwise AND between the bit field specified by StartBit and EndBit
3907 in Operand and the value specified by AndData. All other bits in Operand are
3908 preserved. The new 32-bit value is returned.
3910 If 32-bit operations are not supported, then ASSERT().
3911 If StartBit is greater than 31, then ASSERT().
3912 If EndBit is greater than 31, then ASSERT().
3913 If EndBit is less than StartBit, then ASSERT().
3914 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
3916 @param Operand Operand on which to perform the bitfield operation.
3917 @param StartBit The ordinal of the least significant bit in the bit field.
3919 @param EndBit The ordinal of the most significant bit in the bit field.
3921 @param AndData The value to AND with the read value from the value
3923 @return The new 32-bit value.
3937 Reads a bit field from a 32-bit value, performs a bitwise AND followed by a
3938 bitwise OR, and returns the result.
3940 Performs a bitwise AND between the bit field specified by StartBit and EndBit
3941 in Operand and the value specified by AndData, followed by a bitwise
3942 OR with value specified by OrData. All other bits in Operand are
3943 preserved. The new 32-bit value is returned.
3945 If 32-bit operations are not supported, then ASSERT().
3946 If StartBit is greater than 31, then ASSERT().
3947 If EndBit is greater than 31, then ASSERT().
3948 If EndBit is less than StartBit, then ASSERT().
3949 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
3950 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
3952 @param Operand Operand on which to perform the bitfield operation.
3953 @param StartBit The ordinal of the least significant bit in the bit field.
3955 @param EndBit The ordinal of the most significant bit in the bit field.
3957 @param AndData The value to AND with the read value from the value.
3958 @param OrData The value to OR with the result of the AND operation.
3960 @return The new 32-bit value.
3965 BitFieldAndThenOr32 (
3975 Returns a bit field from a 64-bit value.
3977 Returns the bitfield specified by the StartBit and the EndBit from Operand.
3979 If 64-bit operations are not supported, then ASSERT().
3980 If StartBit is greater than 63, then ASSERT().
3981 If EndBit is greater than 63, then ASSERT().
3982 If EndBit is less than StartBit, then ASSERT().
3984 @param Operand Operand on which to perform the bitfield operation.
3985 @param StartBit The ordinal of the least significant bit in the bit field.
3987 @param EndBit The ordinal of the most significant bit in the bit field.
3990 @return The bit field read.
4003 Writes a bit field to a 64-bit value, and returns the result.
4005 Writes Value to the bit field specified by the StartBit and the EndBit in
4006 Operand. All other bits in Operand are preserved. The new 64-bit value is
4009 If 64-bit operations are not supported, then ASSERT().
4010 If StartBit is greater than 63, then ASSERT().
4011 If EndBit is greater than 63, then ASSERT().
4012 If EndBit is less than StartBit, then ASSERT().
4013 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
4015 @param Operand Operand on which to perform the bitfield operation.
4016 @param StartBit The ordinal of the least significant bit in the bit field.
4018 @param EndBit The ordinal of the most significant bit in the bit field.
4020 @param Value New value of the bit field.
4022 @return The new 64-bit value.
4036 Reads a bit field from a 64-bit value, performs a bitwise OR, and returns the
4039 Performs a bitwise OR between the bit field specified by StartBit
4040 and EndBit in Operand and the value specified by OrData. All other bits in
4041 Operand are preserved. The new 64-bit value is returned.
4043 If 64-bit operations are not supported, then ASSERT().
4044 If StartBit is greater than 63, then ASSERT().
4045 If EndBit is greater than 63, then ASSERT().
4046 If EndBit is less than StartBit, then ASSERT().
4047 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
4049 @param Operand Operand on which to perform the bitfield operation.
4050 @param StartBit The ordinal of the least significant bit in the bit field.
4052 @param EndBit The ordinal of the most significant bit in the bit field.
4054 @param OrData The value to OR with the read value from the value
4056 @return The new 64-bit value.
4070 Reads a bit field from a 64-bit value, performs a bitwise AND, and returns
4073 Performs a bitwise AND between the bit field specified by StartBit and EndBit
4074 in Operand and the value specified by AndData. All other bits in Operand are
4075 preserved. The new 64-bit value is returned.
4077 If 64-bit operations are not supported, then ASSERT().
4078 If StartBit is greater than 63, then ASSERT().
4079 If EndBit is greater than 63, then ASSERT().
4080 If EndBit is less than StartBit, then ASSERT().
4081 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
4083 @param Operand Operand on which to perform the bitfield operation.
4084 @param StartBit The ordinal of the least significant bit in the bit field.
4086 @param EndBit The ordinal of the most significant bit in the bit field.
4088 @param AndData The value to AND with the read value from the value
4090 @return The new 64-bit value.
4104 Reads a bit field from a 64-bit value, performs a bitwise AND followed by a
4105 bitwise OR, and returns the result.
4107 Performs a bitwise AND between the bit field specified by StartBit and EndBit
4108 in Operand and the value specified by AndData, followed by a bitwise
4109 OR with value specified by OrData. All other bits in Operand are
4110 preserved. The new 64-bit value is returned.
4112 If 64-bit operations are not supported, then ASSERT().
4113 If StartBit is greater than 63, then ASSERT().
4114 If EndBit is greater than 63, then ASSERT().
4115 If EndBit is less than StartBit, then ASSERT().
4116 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
4117 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
4119 @param Operand Operand on which to perform the bitfield operation.
4120 @param StartBit The ordinal of the least significant bit in the bit field.
4122 @param EndBit The ordinal of the most significant bit in the bit field.
4124 @param AndData The value to AND with the read value from the value.
4125 @param OrData The value to OR with the result of the AND operation.
4127 @return The new 64-bit value.
4132 BitFieldAndThenOr64 (
4141 // Base Library Checksum Functions
4145 Returns the sum of all elements in a buffer in unit of UINT8.
4146 During calculation, the carry bits are dropped.
4148 This function calculates the sum of all elements in a buffer
4149 in unit of UINT8. The carry bits in result of addition are dropped.
4150 The result is returned as UINT8. If Length is Zero, then Zero is
4153 If Buffer is NULL, then ASSERT().
4154 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
4156 @param Buffer The pointer to the buffer to carry out the sum operation.
4157 @param Length The size, in bytes, of Buffer.
4159 @return Sum The sum of Buffer with carry bits dropped during additions.
4165 IN CONST UINT8
*Buffer
,
4171 Returns the two's complement checksum of all elements in a buffer
4174 This function first calculates the sum of the 8-bit values in the
4175 buffer specified by Buffer and Length. The carry bits in the result
4176 of addition are dropped. Then, the two's complement of the sum is
4177 returned. If Length is 0, then 0 is returned.
4179 If Buffer is NULL, then ASSERT().
4180 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
4182 @param Buffer The pointer to the buffer to carry out the checksum operation.
4183 @param Length The size, in bytes, of Buffer.
4185 @return Checksum The two's complement checksum of Buffer.
4190 CalculateCheckSum8 (
4191 IN CONST UINT8
*Buffer
,
4197 Returns the sum of all elements in a buffer of 16-bit values. During
4198 calculation, the carry bits are dropped.
4200 This function calculates the sum of the 16-bit values in the buffer
4201 specified by Buffer and Length. The carry bits in result of addition are dropped.
4202 The 16-bit result is returned. If Length is 0, then 0 is returned.
4204 If Buffer is NULL, then ASSERT().
4205 If Buffer is not aligned on a 16-bit boundary, then ASSERT().
4206 If Length is not aligned on a 16-bit boundary, then ASSERT().
4207 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
4209 @param Buffer The pointer to the buffer to carry out the sum operation.
4210 @param Length The size, in bytes, of Buffer.
4212 @return Sum The sum of Buffer with carry bits dropped during additions.
4218 IN CONST UINT16
*Buffer
,
4224 Returns the two's complement checksum of all elements in a buffer of
4227 This function first calculates the sum of the 16-bit values in the buffer
4228 specified by Buffer and Length. The carry bits in the result of addition
4229 are dropped. Then, the two's complement of the sum is returned. If Length
4230 is 0, then 0 is returned.
4232 If Buffer is NULL, then ASSERT().
4233 If Buffer is not aligned on a 16-bit boundary, then ASSERT().
4234 If Length is not aligned on a 16-bit boundary, then ASSERT().
4235 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
4237 @param Buffer The pointer to the buffer to carry out the checksum operation.
4238 @param Length The size, in bytes, of Buffer.
4240 @return Checksum The two's complement checksum of Buffer.
4245 CalculateCheckSum16 (
4246 IN CONST UINT16
*Buffer
,
4252 Returns the sum of all elements in a buffer of 32-bit values. During
4253 calculation, the carry bits are dropped.
4255 This function calculates the sum of the 32-bit values in the buffer
4256 specified by Buffer and Length. The carry bits in result of addition are dropped.
4257 The 32-bit result is returned. If Length is 0, then 0 is returned.
4259 If Buffer is NULL, then ASSERT().
4260 If Buffer is not aligned on a 32-bit boundary, then ASSERT().
4261 If Length is not aligned on a 32-bit boundary, then ASSERT().
4262 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
4264 @param Buffer The pointer to the buffer to carry out the sum operation.
4265 @param Length The size, in bytes, of Buffer.
4267 @return Sum The sum of Buffer with carry bits dropped during additions.
4273 IN CONST UINT32
*Buffer
,
4279 Returns the two's complement checksum of all elements in a buffer of
4282 This function first calculates the sum of the 32-bit values in the buffer
4283 specified by Buffer and Length. The carry bits in the result of addition
4284 are dropped. Then, the two's complement of the sum is returned. If Length
4285 is 0, then 0 is returned.
4287 If Buffer is NULL, then ASSERT().
4288 If Buffer is not aligned on a 32-bit boundary, then ASSERT().
4289 If Length is not aligned on a 32-bit boundary, then ASSERT().
4290 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
4292 @param Buffer The pointer to the buffer to carry out the checksum operation.
4293 @param Length The size, in bytes, of Buffer.
4295 @return Checksum The two's complement checksum of Buffer.
4300 CalculateCheckSum32 (
4301 IN CONST UINT32
*Buffer
,
4307 Returns the sum of all elements in a buffer of 64-bit values. During
4308 calculation, the carry bits are dropped.
4310 This function calculates the sum of the 64-bit values in the buffer
4311 specified by Buffer and Length. The carry bits in result of addition are dropped.
4312 The 64-bit result is returned. If Length is 0, then 0 is returned.
4314 If Buffer is NULL, then ASSERT().
4315 If Buffer is not aligned on a 64-bit boundary, then ASSERT().
4316 If Length is not aligned on a 64-bit boundary, then ASSERT().
4317 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
4319 @param Buffer The pointer to the buffer to carry out the sum operation.
4320 @param Length The size, in bytes, of Buffer.
4322 @return Sum The sum of Buffer with carry bits dropped during additions.
4328 IN CONST UINT64
*Buffer
,
4334 Returns the two's complement checksum of all elements in a buffer of
4337 This function first calculates the sum of the 64-bit values in the buffer
4338 specified by Buffer and Length. The carry bits in the result of addition
4339 are dropped. Then, the two's complement of the sum is returned. If Length
4340 is 0, then 0 is returned.
4342 If Buffer is NULL, then ASSERT().
4343 If Buffer is not aligned on a 64-bit boundary, then ASSERT().
4344 If Length is not aligned on a 64-bit boundary, then ASSERT().
4345 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
4347 @param Buffer The pointer to the buffer to carry out the checksum operation.
4348 @param Length The size, in bytes, of Buffer.
4350 @return Checksum The two's complement checksum of Buffer.
4355 CalculateCheckSum64 (
4356 IN CONST UINT64
*Buffer
,
4362 // Base Library CPU Functions
4366 Function entry point used when a stack switch is requested with SwitchStack()
4368 @param Context1 Context1 parameter passed into SwitchStack().
4369 @param Context2 Context2 parameter passed into SwitchStack().
4374 (EFIAPI
*SWITCH_STACK_ENTRY_POINT
)(
4375 IN VOID
*Context1
, OPTIONAL
4376 IN VOID
*Context2 OPTIONAL
4381 Used to serialize load and store operations.
4383 All loads and stores that proceed calls to this function are guaranteed to be
4384 globally visible when this function returns.
4395 Saves the current CPU context that can be restored with a call to LongJump()
4398 Saves the current CPU context in the buffer specified by JumpBuffer and
4399 returns 0. The initial call to SetJump() must always return 0. Subsequent
4400 calls to LongJump() cause a non-zero value to be returned by SetJump().
4402 If JumpBuffer is NULL, then ASSERT().
4403 For Itanium processors, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT().
4405 NOTE: The structure BASE_LIBRARY_JUMP_BUFFER is CPU architecture specific.
4406 The same structure must never be used for more than one CPU architecture context.
4407 For example, a BASE_LIBRARY_JUMP_BUFFER allocated by an IA-32 module must never be used from an x64 module.
4408 SetJump()/LongJump() is not currently supported for the EBC processor type.
4410 @param JumpBuffer A pointer to CPU context buffer.
4412 @retval 0 Indicates a return from SetJump().
4418 OUT BASE_LIBRARY_JUMP_BUFFER
*JumpBuffer
4423 Restores the CPU context that was saved with SetJump().
4425 Restores the CPU context from the buffer specified by JumpBuffer. This
4426 function never returns to the caller. Instead is resumes execution based on
4427 the state of JumpBuffer.
4429 If JumpBuffer is NULL, then ASSERT().
4430 For Itanium processors, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT().
4431 If Value is 0, then ASSERT().
4433 @param JumpBuffer A pointer to CPU context buffer.
4434 @param Value The value to return when the SetJump() context is
4435 restored and must be non-zero.
4441 IN BASE_LIBRARY_JUMP_BUFFER
*JumpBuffer
,
4447 Enables CPU interrupts.
4458 Disables CPU interrupts.
4469 Disables CPU interrupts and returns the interrupt state prior to the disable
4472 @retval TRUE CPU interrupts were enabled on entry to this call.
4473 @retval FALSE CPU interrupts were disabled on entry to this call.
4478 SaveAndDisableInterrupts (
4484 Enables CPU interrupts for the smallest window required to capture any
4490 EnableDisableInterrupts (
4496 Retrieves the current CPU interrupt state.
4498 Returns TRUE if interrupts are currently enabled. Otherwise
4501 @retval TRUE CPU interrupts are enabled.
4502 @retval FALSE CPU interrupts are disabled.
4513 Set the current CPU interrupt state.
4515 Sets the current CPU interrupt state to the state specified by
4516 InterruptState. If InterruptState is TRUE, then interrupts are enabled. If
4517 InterruptState is FALSE, then interrupts are disabled. InterruptState is
4520 @param InterruptState TRUE if interrupts should enabled. FALSE if
4521 interrupts should be disabled.
4523 @return InterruptState
4529 IN BOOLEAN InterruptState
4534 Requests CPU to pause for a short period of time.
4536 Requests CPU to pause for a short period of time. Typically used in MP
4537 systems to prevent memory starvation while waiting for a spin lock.
4548 Transfers control to a function starting with a new stack.
4550 Transfers control to the function specified by EntryPoint using the
4551 new stack specified by NewStack and passing in the parameters specified
4552 by Context1 and Context2. Context1 and Context2 are optional and may
4553 be NULL. The function EntryPoint must never return. This function
4554 supports a variable number of arguments following the NewStack parameter.
4555 These additional arguments are ignored on IA-32, x64, and EBC architectures.
4556 Itanium processors expect one additional parameter of type VOID * that specifies
4557 the new backing store pointer.
4559 If EntryPoint is NULL, then ASSERT().
4560 If NewStack is NULL, then ASSERT().
4562 @param EntryPoint A pointer to function to call with the new stack.
4563 @param Context1 A pointer to the context to pass into the EntryPoint
4565 @param Context2 A pointer to the context to pass into the EntryPoint
4567 @param NewStack A pointer to the new stack to use for the EntryPoint
4569 @param ... This variable argument list is ignored for IA-32, x64, and
4570 EBC architectures. For Itanium processors, this variable
4571 argument list is expected to contain a single parameter of
4572 type VOID * that specifies the new backing store pointer.
4579 IN SWITCH_STACK_ENTRY_POINT EntryPoint
,
4580 IN VOID
*Context1
, OPTIONAL
4581 IN VOID
*Context2
, OPTIONAL
4588 Generates a breakpoint on the CPU.
4590 Generates a breakpoint on the CPU. The breakpoint must be implemented such
4591 that code can resume normal execution after the breakpoint.
4602 Executes an infinite loop.
4604 Forces the CPU to execute an infinite loop. A debugger may be used to skip
4605 past the loop and the code that follows the loop must execute properly. This
4606 implies that the infinite loop must not cause the code that follow it to be
4616 #if defined (MDE_CPU_IPF)
4619 Flush a range of cache lines in the cache coherency domain of the calling
4622 Flushes the cache lines specified by Address and Length. If Address is not aligned
4623 on a cache line boundary, then entire cache line containing Address is flushed.
4624 If Address + Length is not aligned on a cache line boundary, then the entire cache
4625 line containing Address + Length - 1 is flushed. This function may choose to flush
4626 the entire cache if that is more efficient than flushing the specified range. If
4627 Length is 0, the no cache lines are flushed. Address is returned.
4628 This function is only available on Itanium processors.
4630 If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().
4632 @param Address The base address of the instruction lines to invalidate. If
4633 the CPU is in a physical addressing mode, then Address is a
4634 physical address. If the CPU is in a virtual addressing mode,
4635 then Address is a virtual address.
4637 @param Length The number of bytes to invalidate from the instruction cache.
4644 AsmFlushCacheRange (
4651 Executes an FC instruction.
4652 Executes an FC instruction on the cache line specified by Address.
4653 The cache line size affected is at least 32-bytes (aligned on a 32-byte boundary).
4654 An implementation may flush a larger region. This function is only available on Itanium processors.
4656 @param Address The Address of cache line to be flushed.
4658 @return The address of FC instruction executed.
4669 Executes an FC.I instruction.
4670 Executes an FC.I instruction on the cache line specified by Address.
4671 The cache line size affected is at least 32-bytes (aligned on a 32-byte boundary).
4672 An implementation may flush a larger region. This function is only available on Itanium processors.
4674 @param Address The Address of cache line to be flushed.
4676 @return The address of the FC.I instruction executed.
4687 Reads the current value of a Processor Identifier Register (CPUID).
4689 Reads and returns the current value of Processor Identifier Register specified by Index.
4690 The Index of largest implemented CPUID (One less than the number of implemented CPUID
4691 registers) is determined by CPUID [3] bits {7:0}.
4692 No parameter checking is performed on Index. If the Index value is beyond the
4693 implemented CPUID register range, a Reserved Register/Field fault may occur. The caller
4694 must either guarantee that Index is valid, or the caller must set up fault handlers to
4695 catch the faults. This function is only available on Itanium processors.
4697 @param Index The 8-bit Processor Identifier Register index to read.
4699 @return The current value of Processor Identifier Register specified by Index.
4710 Reads the current value of 64-bit Processor Status Register (PSR).
4711 This function is only available on Itanium processors.
4713 @return The current value of PSR.
4724 Writes the current value of 64-bit Processor Status Register (PSR).
4726 No parameter checking is performed on Value. All bits of Value corresponding to
4727 reserved fields of PSR must be 0 or a Reserved Register/Field fault may occur.
4728 The caller must either guarantee that Value is valid, or the caller must set up
4729 fault handlers to catch the faults. This function is only available on Itanium processors.
4731 @param Value The 64-bit value to write to PSR.
4733 @return The 64-bit value written to the PSR.
4744 Reads the current value of 64-bit Kernel Register #0 (KR0).
4746 Reads and returns the current value of KR0.
4747 This function is only available on Itanium processors.
4749 @return The current value of KR0.
4760 Reads the current value of 64-bit Kernel Register #1 (KR1).
4762 Reads and returns the current value of KR1.
4763 This function is only available on Itanium processors.
4765 @return The current value of KR1.
4776 Reads the current value of 64-bit Kernel Register #2 (KR2).
4778 Reads and returns the current value of KR2.
4779 This function is only available on Itanium processors.
4781 @return The current value of KR2.
4792 Reads the current value of 64-bit Kernel Register #3 (KR3).
4794 Reads and returns the current value of KR3.
4795 This function is only available on Itanium processors.
4797 @return The current value of KR3.
4808 Reads the current value of 64-bit Kernel Register #4 (KR4).
4810 Reads and returns the current value of KR4.
4811 This function is only available on Itanium processors.
4813 @return The current value of KR4.
4824 Reads the current value of 64-bit Kernel Register #5 (KR5).
4826 Reads and returns the current value of KR5.
4827 This function is only available on Itanium processors.
4829 @return The current value of KR5.
4840 Reads the current value of 64-bit Kernel Register #6 (KR6).
4842 Reads and returns the current value of KR6.
4843 This function is only available on Itanium processors.
4845 @return The current value of KR6.
4856 Reads the current value of 64-bit Kernel Register #7 (KR7).
4858 Reads and returns the current value of KR7.
4859 This function is only available on Itanium processors.
4861 @return The current value of KR7.
4872 Write the current value of 64-bit Kernel Register #0 (KR0).
4874 Writes the current value of KR0. The 64-bit value written to
4875 the KR0 is returned. This function is only available on Itanium processors.
4877 @param Value The 64-bit value to write to KR0.
4879 @return The 64-bit value written to the KR0.
4890 Write the current value of 64-bit Kernel Register #1 (KR1).
4892 Writes the current value of KR1. The 64-bit value written to
4893 the KR1 is returned. This function is only available on Itanium processors.
4895 @param Value The 64-bit value to write to KR1.
4897 @return The 64-bit value written to the KR1.
4908 Write the current value of 64-bit Kernel Register #2 (KR2).
4910 Writes the current value of KR2. The 64-bit value written to
4911 the KR2 is returned. This function is only available on Itanium processors.
4913 @param Value The 64-bit value to write to KR2.
4915 @return The 64-bit value written to the KR2.
4926 Write the current value of 64-bit Kernel Register #3 (KR3).
4928 Writes the current value of KR3. The 64-bit value written to
4929 the KR3 is returned. This function is only available on Itanium processors.
4931 @param Value The 64-bit value to write to KR3.
4933 @return The 64-bit value written to the KR3.
4944 Write the current value of 64-bit Kernel Register #4 (KR4).
4946 Writes the current value of KR4. The 64-bit value written to
4947 the KR4 is returned. This function is only available on Itanium processors.
4949 @param Value The 64-bit value to write to KR4.
4951 @return The 64-bit value written to the KR4.
4962 Write the current value of 64-bit Kernel Register #5 (KR5).
4964 Writes the current value of KR5. The 64-bit value written to
4965 the KR5 is returned. This function is only available on Itanium processors.
4967 @param Value The 64-bit value to write to KR5.
4969 @return The 64-bit value written to the KR5.
4980 Write the current value of 64-bit Kernel Register #6 (KR6).
4982 Writes the current value of KR6. The 64-bit value written to
4983 the KR6 is returned. This function is only available on Itanium processors.
4985 @param Value The 64-bit value to write to KR6.
4987 @return The 64-bit value written to the KR6.
4998 Write the current value of 64-bit Kernel Register #7 (KR7).
5000 Writes the current value of KR7. The 64-bit value written to
5001 the KR7 is returned. This function is only available on Itanium processors.
5003 @param Value The 64-bit value to write to KR7.
5005 @return The 64-bit value written to the KR7.
5016 Reads the current value of Interval Timer Counter Register (ITC).
5018 Reads and returns the current value of ITC.
5019 This function is only available on Itanium processors.
5021 @return The current value of ITC.
5032 Reads the current value of Interval Timer Vector Register (ITV).
5034 Reads and returns the current value of ITV.
5035 This function is only available on Itanium processors.
5037 @return The current value of ITV.
5048 Reads the current value of Interval Timer Match Register (ITM).
5050 Reads and returns the current value of ITM.
5051 This function is only available on Itanium processors.
5053 @return The current value of ITM.
5063 Writes the current value of 64-bit Interval Timer Counter Register (ITC).
5065 Writes the current value of ITC. The 64-bit value written to the ITC is returned.
5066 This function is only available on Itanium processors.
5068 @param Value The 64-bit value to write to ITC.
5070 @return The 64-bit value written to the ITC.
5081 Writes the current value of 64-bit Interval Timer Match Register (ITM).
5083 Writes the current value of ITM. The 64-bit value written to the ITM is returned.
5084 This function is only available on Itanium processors.
5086 @param Value The 64-bit value to write to ITM.
5088 @return The 64-bit value written to the ITM.
5099 Writes the current value of 64-bit Interval Timer Vector Register (ITV).
5101 Writes the current value of ITV. The 64-bit value written to the ITV is returned.
5102 No parameter checking is performed on Value. All bits of Value corresponding to
5103 reserved fields of ITV must be 0 or a Reserved Register/Field fault may occur.
5104 The caller must either guarantee that Value is valid, or the caller must set up
5105 fault handlers to catch the faults.
5106 This function is only available on Itanium processors.
5108 @param Value The 64-bit value to write to ITV.
5110 @return The 64-bit value written to the ITV.
5121 Reads the current value of Default Control Register (DCR).
5123 Reads and returns the current value of DCR. This function is only available on Itanium processors.
5125 @return The current value of DCR.
5136 Reads the current value of Interruption Vector Address Register (IVA).
5138 Reads and returns the current value of IVA. This function is only available on Itanium processors.
5140 @return The current value of IVA.
5150 Reads the current value of Page Table Address Register (PTA).
5152 Reads and returns the current value of PTA. This function is only available on Itanium processors.
5154 @return The current value of PTA.
5165 Writes the current value of 64-bit Default Control Register (DCR).
5167 Writes the current value of DCR. The 64-bit value written to the DCR is returned.
5168 No parameter checking is performed on Value. All bits of Value corresponding to
5169 reserved fields of DCR must be 0 or a Reserved Register/Field fault may occur.
5170 The caller must either guarantee that Value is valid, or the caller must set up
5171 fault handlers to catch the faults.
5172 This function is only available on Itanium processors.
5174 @param Value The 64-bit value to write to DCR.
5176 @return The 64-bit value written to the DCR.
5187 Writes the current value of 64-bit Interruption Vector Address Register (IVA).
5189 Writes the current value of IVA. The 64-bit value written to the IVA is returned.
5190 The size of vector table is 32 K bytes and is 32 K bytes aligned
5191 the low 15 bits of Value is ignored when written.
5192 This function is only available on Itanium processors.
5194 @param Value The 64-bit value to write to IVA.
5196 @return The 64-bit value written to the IVA.
5207 Writes the current value of 64-bit Page Table Address Register (PTA).
5209 Writes the current value of PTA. The 64-bit value written to the PTA is returned.
5210 No parameter checking is performed on Value. All bits of Value corresponding to
5211 reserved fields of DCR must be 0 or a Reserved Register/Field fault may occur.
5212 The caller must either guarantee that Value is valid, or the caller must set up
5213 fault handlers to catch the faults.
5214 This function is only available on Itanium processors.
5216 @param Value The 64-bit value to write to PTA.
5218 @return The 64-bit value written to the PTA.
5228 Reads the current value of Local Interrupt ID Register (LID).
5230 Reads and returns the current value of LID. This function is only available on Itanium processors.
5232 @return The current value of LID.
5243 Reads the current value of External Interrupt Vector Register (IVR).
5245 Reads and returns the current value of IVR. This function is only available on Itanium processors.
5247 @return The current value of IVR.
5258 Reads the current value of Task Priority Register (TPR).
5260 Reads and returns the current value of TPR. This function is only available on Itanium processors.
5262 @return The current value of TPR.
5273 Reads the current value of External Interrupt Request Register #0 (IRR0).
5275 Reads and returns the current value of IRR0. This function is only available on Itanium processors.
5277 @return The current value of IRR0.
5288 Reads the current value of External Interrupt Request Register #1 (IRR1).
5290 Reads and returns the current value of IRR1. This function is only available on Itanium processors.
5292 @return The current value of IRR1.
5303 Reads the current value of External Interrupt Request Register #2 (IRR2).
5305 Reads and returns the current value of IRR2. This function is only available on Itanium processors.
5307 @return The current value of IRR2.
5318 Reads the current value of External Interrupt Request Register #3 (IRR3).
5320 Reads and returns the current value of IRR3. This function is only available on Itanium processors.
5322 @return The current value of IRR3.
5333 Reads the current value of Performance Monitor Vector Register (PMV).
5335 Reads and returns the current value of PMV. This function is only available on Itanium processors.
5337 @return The current value of PMV.
5348 Reads the current value of Corrected Machine Check Vector Register (CMCV).
5350 Reads and returns the current value of CMCV. This function is only available on Itanium processors.
5352 @return The current value of CMCV.
5363 Reads the current value of Local Redirection Register #0 (LRR0).
5365 Reads and returns the current value of LRR0. This function is only available on Itanium processors.
5367 @return The current value of LRR0.
5378 Reads the current value of Local Redirection Register #1 (LRR1).
5380 Reads and returns the current value of LRR1. This function is only available on Itanium processors.
5382 @return The current value of LRR1.
5393 Writes the current value of 64-bit Page Local Interrupt ID Register (LID).
5395 Writes the current value of LID. The 64-bit value written to the LID is returned.
5396 No parameter checking is performed on Value. All bits of Value corresponding to
5397 reserved fields of LID must be 0 or a Reserved Register/Field fault may occur.
5398 The caller must either guarantee that Value is valid, or the caller must set up
5399 fault handlers to catch the faults.
5400 This function is only available on Itanium processors.
5402 @param Value The 64-bit value to write to LID.
5404 @return The 64-bit value written to the LID.
5415 Writes the current value of 64-bit Task Priority Register (TPR).
5417 Writes the current value of TPR. The 64-bit value written to the TPR is returned.
5418 No parameter checking is performed on Value. All bits of Value corresponding to
5419 reserved fields of TPR must be 0 or a Reserved Register/Field fault may occur.
5420 The caller must either guarantee that Value is valid, or the caller must set up
5421 fault handlers to catch the faults.
5422 This function is only available on Itanium processors.
5424 @param Value The 64-bit value to write to TPR.
5426 @return The 64-bit value written to the TPR.
5437 Performs a write operation on End OF External Interrupt Register (EOI).
5439 Writes a value of 0 to the EOI Register. This function is only available on Itanium processors.
5450 Writes the current value of 64-bit Performance Monitor Vector Register (PMV).
5452 Writes the current value of PMV. The 64-bit value written to the PMV is returned.
5453 No parameter checking is performed on Value. All bits of Value corresponding
5454 to reserved fields of PMV must be 0 or a Reserved Register/Field fault may occur.
5455 The caller must either guarantee that Value is valid, or the caller must set up
5456 fault handlers to catch the faults.
5457 This function is only available on Itanium processors.
5459 @param Value The 64-bit value to write to PMV.
5461 @return The 64-bit value written to the PMV.
5472 Writes the current value of 64-bit Corrected Machine Check Vector Register (CMCV).
5474 Writes the current value of CMCV. The 64-bit value written to the CMCV is returned.
5475 No parameter checking is performed on Value. All bits of Value corresponding
5476 to reserved fields of CMCV must be 0 or a Reserved Register/Field fault may occur.
5477 The caller must either guarantee that Value is valid, or the caller must set up
5478 fault handlers to catch the faults.
5479 This function is only available on Itanium processors.
5481 @param Value The 64-bit value to write to CMCV.
5483 @return The 64-bit value written to the CMCV.
5494 Writes the current value of 64-bit Local Redirection Register #0 (LRR0).
5496 Writes the current value of LRR0. The 64-bit value written to the LRR0 is returned.
5497 No parameter checking is performed on Value. All bits of Value corresponding
5498 to reserved fields of LRR0 must be 0 or a Reserved Register/Field fault may occur.
5499 The caller must either guarantee that Value is valid, or the caller must set up
5500 fault handlers to catch the faults.
5501 This function is only available on Itanium processors.
5503 @param Value The 64-bit value to write to LRR0.
5505 @return The 64-bit value written to the LRR0.
5516 Writes the current value of 64-bit Local Redirection Register #1 (LRR1).
5518 Writes the current value of LRR1. The 64-bit value written to the LRR1 is returned.
5519 No parameter checking is performed on Value. All bits of Value corresponding
5520 to reserved fields of LRR1 must be 0 or a Reserved Register/Field fault may occur.
5521 The caller must either guarantee that Value is valid, or the caller must
5522 set up fault handlers to catch the faults.
5523 This function is only available on Itanium processors.
5525 @param Value The 64-bit value to write to LRR1.
5527 @return The 64-bit value written to the LRR1.
5538 Reads the current value of Instruction Breakpoint Register (IBR).
5540 The Instruction Breakpoint Registers are used in pairs. The even numbered
5541 registers contain breakpoint addresses, and the odd numbered registers contain
5542 breakpoint mask conditions. At least four instruction registers pairs are implemented
5543 on all processor models. Implemented registers are contiguous starting with
5544 register 0. No parameter checking is performed on Index, and if the Index value
5545 is beyond the implemented IBR register range, a Reserved Register/Field fault may
5546 occur. The caller must either guarantee that Index is valid, or the caller must
5547 set up fault handlers to catch the faults.
5548 This function is only available on Itanium processors.
5550 @param Index The 8-bit Instruction Breakpoint Register index to read.
5552 @return The current value of Instruction Breakpoint Register specified by Index.
5563 Reads the current value of Data Breakpoint Register (DBR).
5565 The Data Breakpoint Registers are used in pairs. The even numbered registers
5566 contain breakpoint addresses, and odd numbered registers contain breakpoint
5567 mask conditions. At least four data registers pairs are implemented on all processor
5568 models. Implemented registers are contiguous starting with register 0.
5569 No parameter checking is performed on Index. If the Index value is beyond
5570 the implemented DBR register range, a Reserved Register/Field fault may occur.
5571 The caller must either guarantee that Index is valid, or the caller must set up
5572 fault handlers to catch the faults.
5573 This function is only available on Itanium processors.
5575 @param Index The 8-bit Data Breakpoint Register index to read.
5577 @return The current value of Data Breakpoint Register specified by Index.
5588 Reads the current value of Performance Monitor Configuration Register (PMC).
5590 All processor implementations provide at least four performance counters
5591 (PMC/PMD [4]...PMC/PMD [7] pairs), and four performance monitor counter overflow
5592 status registers (PMC [0]... PMC [3]). Processor implementations may provide
5593 additional implementation-dependent PMC and PMD to increase the number of
5594 'generic' performance counters (PMC/PMD pairs). The remainder of PMC and PMD
5595 register set is implementation dependent. No parameter checking is performed
5596 on Index. If the Index value is beyond the implemented PMC register range,
5597 zero value will be returned.
5598 This function is only available on Itanium processors.
5600 @param Index The 8-bit Performance Monitor Configuration Register index to read.
5602 @return The current value of Performance Monitor Configuration Register
5614 Reads the current value of Performance Monitor Data Register (PMD).
5616 All processor implementations provide at least 4 performance counters
5617 (PMC/PMD [4]...PMC/PMD [7] pairs), and 4 performance monitor counter
5618 overflow status registers (PMC [0]... PMC [3]). Processor implementations may
5619 provide additional implementation-dependent PMC and PMD to increase the number
5620 of 'generic' performance counters (PMC/PMD pairs). The remainder of PMC and PMD
5621 register set is implementation dependent. No parameter checking is performed
5622 on Index. If the Index value is beyond the implemented PMD register range,
5623 zero value will be returned.
5624 This function is only available on Itanium processors.
5626 @param Index The 8-bit Performance Monitor Data Register index to read.
5628 @return The current value of Performance Monitor Data Register specified by Index.
5639 Writes the current value of 64-bit Instruction Breakpoint Register (IBR).
5641 Writes current value of Instruction Breakpoint Register specified by Index.
5642 The Instruction Breakpoint Registers are used in pairs. The even numbered
5643 registers contain breakpoint addresses, and odd numbered registers contain
5644 breakpoint mask conditions. At least four instruction registers pairs are implemented
5645 on all processor models. Implemented registers are contiguous starting with
5646 register 0. No parameter checking is performed on Index. If the Index value
5647 is beyond the implemented IBR register range, a Reserved Register/Field fault may
5648 occur. The caller must either guarantee that Index is valid, or the caller must
5649 set up fault handlers to catch the faults.
5650 This function is only available on Itanium processors.
5652 @param Index The 8-bit Instruction Breakpoint Register index to write.
5653 @param Value The 64-bit value to write to IBR.
5655 @return The 64-bit value written to the IBR.
5667 Writes the current value of 64-bit Data Breakpoint Register (DBR).
5669 Writes current value of Data Breakpoint Register specified by Index.
5670 The Data Breakpoint Registers are used in pairs. The even numbered registers
5671 contain breakpoint addresses, and odd numbered registers contain breakpoint
5672 mask conditions. At least four data registers pairs are implemented on all processor
5673 models. Implemented registers are contiguous starting with register 0. No parameter
5674 checking is performed on Index. If the Index value is beyond the implemented
5675 DBR register range, a Reserved Register/Field fault may occur. The caller must
5676 either guarantee that Index is valid, or the caller must set up fault handlers to
5678 This function is only available on Itanium processors.
5680 @param Index The 8-bit Data Breakpoint Register index to write.
5681 @param Value The 64-bit value to write to DBR.
5683 @return The 64-bit value written to the DBR.
5695 Writes the current value of 64-bit Performance Monitor Configuration Register (PMC).
5697 Writes current value of Performance Monitor Configuration Register specified by Index.
5698 All processor implementations provide at least four performance counters
5699 (PMC/PMD [4]...PMC/PMD [7] pairs), and four performance monitor counter overflow status
5700 registers (PMC [0]... PMC [3]). Processor implementations may provide additional
5701 implementation-dependent PMC and PMD to increase the number of 'generic' performance
5702 counters (PMC/PMD pairs). The remainder of PMC and PMD register set is implementation
5703 dependent. No parameter checking is performed on Index. If the Index value is
5704 beyond the implemented PMC register range, the write is ignored.
5705 This function is only available on Itanium processors.
5707 @param Index The 8-bit Performance Monitor Configuration Register index to write.
5708 @param Value The 64-bit value to write to PMC.
5710 @return The 64-bit value written to the PMC.
5722 Writes the current value of 64-bit Performance Monitor Data Register (PMD).
5724 Writes current value of Performance Monitor Data Register specified by Index.
5725 All processor implementations provide at least four performance counters
5726 (PMC/PMD [4]...PMC/PMD [7] pairs), and four performance monitor counter overflow
5727 status registers (PMC [0]... PMC [3]). Processor implementations may provide
5728 additional implementation-dependent PMC and PMD to increase the number of 'generic'
5729 performance counters (PMC/PMD pairs). The remainder of PMC and PMD register set
5730 is implementation dependent. No parameter checking is performed on Index. If the
5731 Index value is beyond the implemented PMD register range, the write is ignored.
5732 This function is only available on Itanium processors.
5734 @param Index The 8-bit Performance Monitor Data Register index to write.
5735 @param Value The 64-bit value to write to PMD.
5737 @return The 64-bit value written to the PMD.
5749 Reads the current value of 64-bit Global Pointer (GP).
5751 Reads and returns the current value of GP.
5752 This function is only available on Itanium processors.
5754 @return The current value of GP.
5765 Write the current value of 64-bit Global Pointer (GP).
5767 Writes the current value of GP. The 64-bit value written to the GP is returned.
5768 No parameter checking is performed on Value.
5769 This function is only available on Itanium processors.
5771 @param Value The 64-bit value to write to GP.
5773 @return The 64-bit value written to the GP.
5784 Reads the current value of 64-bit Stack Pointer (SP).
5786 Reads and returns the current value of SP.
5787 This function is only available on Itanium processors.
5789 @return The current value of SP.
5800 /// Valid Index value for AsmReadControlRegister().
5802 #define IPF_CONTROL_REGISTER_DCR 0
5803 #define IPF_CONTROL_REGISTER_ITM 1
5804 #define IPF_CONTROL_REGISTER_IVA 2
5805 #define IPF_CONTROL_REGISTER_PTA 8
5806 #define IPF_CONTROL_REGISTER_IPSR 16
5807 #define IPF_CONTROL_REGISTER_ISR 17
5808 #define IPF_CONTROL_REGISTER_IIP 19
5809 #define IPF_CONTROL_REGISTER_IFA 20
5810 #define IPF_CONTROL_REGISTER_ITIR 21
5811 #define IPF_CONTROL_REGISTER_IIPA 22
5812 #define IPF_CONTROL_REGISTER_IFS 23
5813 #define IPF_CONTROL_REGISTER_IIM 24
5814 #define IPF_CONTROL_REGISTER_IHA 25
5815 #define IPF_CONTROL_REGISTER_LID 64
5816 #define IPF_CONTROL_REGISTER_IVR 65
5817 #define IPF_CONTROL_REGISTER_TPR 66
5818 #define IPF_CONTROL_REGISTER_EOI 67
5819 #define IPF_CONTROL_REGISTER_IRR0 68
5820 #define IPF_CONTROL_REGISTER_IRR1 69
5821 #define IPF_CONTROL_REGISTER_IRR2 70
5822 #define IPF_CONTROL_REGISTER_IRR3 71
5823 #define IPF_CONTROL_REGISTER_ITV 72
5824 #define IPF_CONTROL_REGISTER_PMV 73
5825 #define IPF_CONTROL_REGISTER_CMCV 74
5826 #define IPF_CONTROL_REGISTER_LRR0 80
5827 #define IPF_CONTROL_REGISTER_LRR1 81
5830 Reads a 64-bit control register.
5832 Reads and returns the control register specified by Index. The valid Index valued
5833 are defined above in "Related Definitions".
5834 If Index is invalid then 0xFFFFFFFFFFFFFFFF is returned. This function is only
5835 available on Itanium processors.
5837 @param Index The index of the control register to read.
5839 @return The control register specified by Index.
5844 AsmReadControlRegister (
5850 /// Valid Index value for AsmReadApplicationRegister().
5852 #define IPF_APPLICATION_REGISTER_K0 0
5853 #define IPF_APPLICATION_REGISTER_K1 1
5854 #define IPF_APPLICATION_REGISTER_K2 2
5855 #define IPF_APPLICATION_REGISTER_K3 3
5856 #define IPF_APPLICATION_REGISTER_K4 4
5857 #define IPF_APPLICATION_REGISTER_K5 5
5858 #define IPF_APPLICATION_REGISTER_K6 6
5859 #define IPF_APPLICATION_REGISTER_K7 7
5860 #define IPF_APPLICATION_REGISTER_RSC 16
5861 #define IPF_APPLICATION_REGISTER_BSP 17
5862 #define IPF_APPLICATION_REGISTER_BSPSTORE 18
5863 #define IPF_APPLICATION_REGISTER_RNAT 19
5864 #define IPF_APPLICATION_REGISTER_FCR 21
5865 #define IPF_APPLICATION_REGISTER_EFLAG 24
5866 #define IPF_APPLICATION_REGISTER_CSD 25
5867 #define IPF_APPLICATION_REGISTER_SSD 26
5868 #define IPF_APPLICATION_REGISTER_CFLG 27
5869 #define IPF_APPLICATION_REGISTER_FSR 28
5870 #define IPF_APPLICATION_REGISTER_FIR 29
5871 #define IPF_APPLICATION_REGISTER_FDR 30
5872 #define IPF_APPLICATION_REGISTER_CCV 32
5873 #define IPF_APPLICATION_REGISTER_UNAT 36
5874 #define IPF_APPLICATION_REGISTER_FPSR 40
5875 #define IPF_APPLICATION_REGISTER_ITC 44
5876 #define IPF_APPLICATION_REGISTER_PFS 64
5877 #define IPF_APPLICATION_REGISTER_LC 65
5878 #define IPF_APPLICATION_REGISTER_EC 66
5881 Reads a 64-bit application register.
5883 Reads and returns the application register specified by Index. The valid Index
5884 valued are defined above in "Related Definitions".
5885 If Index is invalid then 0xFFFFFFFFFFFFFFFF is returned. This function is only
5886 available on Itanium processors.
5888 @param Index The index of the application register to read.
5890 @return The application register specified by Index.
5895 AsmReadApplicationRegister (
5901 Reads the current value of a Machine Specific Register (MSR).
5903 Reads and returns the current value of the Machine Specific Register specified by Index. No
5904 parameter checking is performed on Index, and if the Index value is beyond the implemented MSR
5905 register range, a Reserved Register/Field fault may occur. The caller must either guarantee that
5906 Index is valid, or the caller must set up fault handlers to catch the faults. This function is
5907 only available on Itanium processors.
5909 @param Index The 8-bit Machine Specific Register index to read.
5911 @return The current value of the Machine Specific Register specified by Index.
5922 Writes the current value of a Machine Specific Register (MSR).
5924 Writes Value to the Machine Specific Register specified by Index. Value is returned. No
5925 parameter checking is performed on Index, and if the Index value is beyond the implemented MSR
5926 register range, a Reserved Register/Field fault may occur. The caller must either guarantee that
5927 Index is valid, or the caller must set up fault handlers to catch the faults. This function is
5928 only available on Itanium processors.
5930 @param Index The 8-bit Machine Specific Register index to write.
5931 @param Value The 64-bit value to write to the Machine Specific Register.
5933 @return The 64-bit value to write to the Machine Specific Register.
5945 Determines if the CPU is currently executing in virtual, physical, or mixed mode.
5947 Determines the current execution mode of the CPU.
5948 If the CPU is in virtual mode(PSR.RT=1, PSR.DT=1, PSR.IT=1), then 1 is returned.
5949 If the CPU is in physical mode(PSR.RT=0, PSR.DT=0, PSR.IT=0), then 0 is returned.
5950 If the CPU is not in physical mode or virtual mode, then it is in mixed mode,
5952 This function is only available on Itanium processors.
5954 @retval 1 The CPU is in virtual mode.
5955 @retval 0 The CPU is in physical mode.
5956 @retval -1 The CPU is in mixed mode.
5967 Makes a PAL procedure call.
5969 This is a wrapper function to make a PAL procedure call. Based on the Index
5970 value this API will make static or stacked PAL call. The following table
5971 describes the usage of PAL Procedure Index Assignment. Architected procedures
5972 may be designated as required or optional. If a PAL procedure is specified
5973 as optional, a unique return code of 0xFFFFFFFFFFFFFFFF is returned in the
5974 Status field of the PAL_CALL_RETURN structure.
5975 This indicates that the procedure is not present in this PAL implementation.
5976 It is the caller's responsibility to check for this return code after calling
5977 any optional PAL procedure.
5978 No parameter checking is performed on the 5 input parameters, but there are
5979 some common rules that the caller should follow when making a PAL call. Any
5980 address passed to PAL as buffers for return parameters must be 8-byte aligned.
5981 Unaligned addresses may cause undefined results. For those parameters defined
5982 as reserved or some fields defined as reserved must be zero filled or the invalid
5983 argument return value may be returned or undefined result may occur during the
5984 execution of the procedure. If the PalEntryPoint does not point to a valid
5985 PAL entry point then the system behavior is undefined. This function is only
5986 available on Itanium processors.
5988 @param PalEntryPoint The PAL procedure calls entry point.
5989 @param Index The PAL procedure Index number.
5990 @param Arg2 The 2nd parameter for PAL procedure calls.
5991 @param Arg3 The 3rd parameter for PAL procedure calls.
5992 @param Arg4 The 4th parameter for PAL procedure calls.
5994 @return structure returned from the PAL Call procedure, including the status and return value.
6000 IN UINT64 PalEntryPoint
,
6008 #if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
6010 /// IA32 and x64 Specific Functions.
6011 /// Byte packed structure for 16-bit Real Mode EFLAGS.
6015 UINT32 CF
:1; ///< Carry Flag.
6016 UINT32 Reserved_0
:1; ///< Reserved.
6017 UINT32 PF
:1; ///< Parity Flag.
6018 UINT32 Reserved_1
:1; ///< Reserved.
6019 UINT32 AF
:1; ///< Auxiliary Carry Flag.
6020 UINT32 Reserved_2
:1; ///< Reserved.
6021 UINT32 ZF
:1; ///< Zero Flag.
6022 UINT32 SF
:1; ///< Sign Flag.
6023 UINT32 TF
:1; ///< Trap Flag.
6024 UINT32 IF
:1; ///< Interrupt Enable Flag.
6025 UINT32 DF
:1; ///< Direction Flag.
6026 UINT32 OF
:1; ///< Overflow Flag.
6027 UINT32 IOPL
:2; ///< I/O Privilege Level.
6028 UINT32 NT
:1; ///< Nested Task.
6029 UINT32 Reserved_3
:1; ///< Reserved.
6035 /// Byte packed structure for EFLAGS/RFLAGS.
6036 /// 32-bits on IA-32.
6037 /// 64-bits on x64. The upper 32-bits on x64 are reserved.
6041 UINT32 CF
:1; ///< Carry Flag.
6042 UINT32 Reserved_0
:1; ///< Reserved.
6043 UINT32 PF
:1; ///< Parity Flag.
6044 UINT32 Reserved_1
:1; ///< Reserved.
6045 UINT32 AF
:1; ///< Auxiliary Carry Flag.
6046 UINT32 Reserved_2
:1; ///< Reserved.
6047 UINT32 ZF
:1; ///< Zero Flag.
6048 UINT32 SF
:1; ///< Sign Flag.
6049 UINT32 TF
:1; ///< Trap Flag.
6050 UINT32 IF
:1; ///< Interrupt Enable Flag.
6051 UINT32 DF
:1; ///< Direction Flag.
6052 UINT32 OF
:1; ///< Overflow Flag.
6053 UINT32 IOPL
:2; ///< I/O Privilege Level.
6054 UINT32 NT
:1; ///< Nested Task.
6055 UINT32 Reserved_3
:1; ///< Reserved.
6056 UINT32 RF
:1; ///< Resume Flag.
6057 UINT32 VM
:1; ///< Virtual 8086 Mode.
6058 UINT32 AC
:1; ///< Alignment Check.
6059 UINT32 VIF
:1; ///< Virtual Interrupt Flag.
6060 UINT32 VIP
:1; ///< Virtual Interrupt Pending.
6061 UINT32 ID
:1; ///< ID Flag.
6062 UINT32 Reserved_4
:10; ///< Reserved.
6068 /// Byte packed structure for Control Register 0 (CR0).
6069 /// 32-bits on IA-32.
6070 /// 64-bits on x64. The upper 32-bits on x64 are reserved.
6074 UINT32 PE
:1; ///< Protection Enable.
6075 UINT32 MP
:1; ///< Monitor Coprocessor.
6076 UINT32 EM
:1; ///< Emulation.
6077 UINT32 TS
:1; ///< Task Switched.
6078 UINT32 ET
:1; ///< Extension Type.
6079 UINT32 NE
:1; ///< Numeric Error.
6080 UINT32 Reserved_0
:10; ///< Reserved.
6081 UINT32 WP
:1; ///< Write Protect.
6082 UINT32 Reserved_1
:1; ///< Reserved.
6083 UINT32 AM
:1; ///< Alignment Mask.
6084 UINT32 Reserved_2
:10; ///< Reserved.
6085 UINT32 NW
:1; ///< Mot Write-through.
6086 UINT32 CD
:1; ///< Cache Disable.
6087 UINT32 PG
:1; ///< Paging.
6093 /// Byte packed structure for Control Register 4 (CR4).
6094 /// 32-bits on IA-32.
6095 /// 64-bits on x64. The upper 32-bits on x64 are reserved.
6099 UINT32 VME
:1; ///< Virtual-8086 Mode Extensions.
6100 UINT32 PVI
:1; ///< Protected-Mode Virtual Interrupts.
6101 UINT32 TSD
:1; ///< Time Stamp Disable.
6102 UINT32 DE
:1; ///< Debugging Extensions.
6103 UINT32 PSE
:1; ///< Page Size Extensions.
6104 UINT32 PAE
:1; ///< Physical Address Extension.
6105 UINT32 MCE
:1; ///< Machine Check Enable.
6106 UINT32 PGE
:1; ///< Page Global Enable.
6107 UINT32 PCE
:1; ///< Performance Monitoring Counter
6109 UINT32 OSFXSR
:1; ///< Operating System Support for
6110 ///< FXSAVE and FXRSTOR instructions
6111 UINT32 OSXMMEXCPT
:1; ///< Operating System Support for
6112 ///< Unmasked SIMD Floating Point
6114 UINT32 Reserved_0
:2; ///< Reserved.
6115 UINT32 VMXE
:1; ///< VMX Enable
6116 UINT32 Reserved_1
:18; ///< Reserved.
6122 /// Byte packed structure for a segment descriptor in a GDT/LDT.
6141 } IA32_SEGMENT_DESCRIPTOR
;
6144 /// Byte packed structure for an IDTR, GDTR, LDTR descriptor.
6153 #define IA32_IDT_GATE_TYPE_TASK 0x85
6154 #define IA32_IDT_GATE_TYPE_INTERRUPT_16 0x86
6155 #define IA32_IDT_GATE_TYPE_TRAP_16 0x87
6156 #define IA32_IDT_GATE_TYPE_INTERRUPT_32 0x8E
6157 #define IA32_IDT_GATE_TYPE_TRAP_32 0x8F
6160 #if defined (MDE_CPU_IA32)
6162 /// Byte packed structure for an IA-32 Interrupt Gate Descriptor.
6166 UINT32 OffsetLow
:16; ///< Offset bits 15..0.
6167 UINT32 Selector
:16; ///< Selector.
6168 UINT32 Reserved_0
:8; ///< Reserved.
6169 UINT32 GateType
:8; ///< Gate Type. See #defines above.
6170 UINT32 OffsetHigh
:16; ///< Offset bits 31..16.
6173 } IA32_IDT_GATE_DESCRIPTOR
;
6177 #if defined (MDE_CPU_X64)
6179 /// Byte packed structure for an x64 Interrupt Gate Descriptor.
6183 UINT32 OffsetLow
:16; ///< Offset bits 15..0.
6184 UINT32 Selector
:16; ///< Selector.
6185 UINT32 Reserved_0
:8; ///< Reserved.
6186 UINT32 GateType
:8; ///< Gate Type. See #defines above.
6187 UINT32 OffsetHigh
:16; ///< Offset bits 31..16.
6188 UINT32 OffsetUpper
:32; ///< Offset bits 63..32.
6189 UINT32 Reserved_1
:32; ///< Reserved.
6195 } IA32_IDT_GATE_DESCRIPTOR
;
6200 /// Byte packed structure for an FP/SSE/SSE2 context.
6207 /// Structures for the 16-bit real mode thunks.
6260 IA32_EFLAGS32 EFLAGS
;
6270 } IA32_REGISTER_SET
;
6273 /// Byte packed structure for an 16-bit real mode thunks.
6276 IA32_REGISTER_SET
*RealModeState
;
6277 VOID
*RealModeBuffer
;
6278 UINT32 RealModeBufferSize
;
6279 UINT32 ThunkAttributes
;
6282 #define THUNK_ATTRIBUTE_BIG_REAL_MODE 0x00000001
6283 #define THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 0x00000002
6284 #define THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL 0x00000004
6287 Retrieves CPUID information.
6289 Executes the CPUID instruction with EAX set to the value specified by Index.
6290 This function always returns Index.
6291 If Eax is not NULL, then the value of EAX after CPUID is returned in Eax.
6292 If Ebx is not NULL, then the value of EBX after CPUID is returned in Ebx.
6293 If Ecx is not NULL, then the value of ECX after CPUID is returned in Ecx.
6294 If Edx is not NULL, then the value of EDX after CPUID is returned in Edx.
6295 This function is only available on IA-32 and x64.
6297 @param Index The 32-bit value to load into EAX prior to invoking the CPUID
6299 @param Eax The pointer to the 32-bit EAX value returned by the CPUID
6300 instruction. This is an optional parameter that may be NULL.
6301 @param Ebx The pointer to the 32-bit EBX value returned by the CPUID
6302 instruction. This is an optional parameter that may be NULL.
6303 @param Ecx The pointer to the 32-bit ECX value returned by the CPUID
6304 instruction. This is an optional parameter that may be NULL.
6305 @param Edx The pointer to the 32-bit EDX value returned by the CPUID
6306 instruction. This is an optional parameter that may be NULL.
6315 OUT UINT32
*Eax
, OPTIONAL
6316 OUT UINT32
*Ebx
, OPTIONAL
6317 OUT UINT32
*Ecx
, OPTIONAL
6318 OUT UINT32
*Edx OPTIONAL
6323 Retrieves CPUID information using an extended leaf identifier.
6325 Executes the CPUID instruction with EAX set to the value specified by Index
6326 and ECX set to the value specified by SubIndex. This function always returns
6327 Index. This function is only available on IA-32 and x64.
6329 If Eax is not NULL, then the value of EAX after CPUID is returned in Eax.
6330 If Ebx is not NULL, then the value of EBX after CPUID is returned in Ebx.
6331 If Ecx is not NULL, then the value of ECX after CPUID is returned in Ecx.
6332 If Edx is not NULL, then the value of EDX after CPUID is returned in Edx.
6334 @param Index The 32-bit value to load into EAX prior to invoking the
6336 @param SubIndex The 32-bit value to load into ECX prior to invoking the
6338 @param Eax The pointer to the 32-bit EAX value returned by the CPUID
6339 instruction. This is an optional parameter that may be
6341 @param Ebx The pointer to the 32-bit EBX value returned by the CPUID
6342 instruction. This is an optional parameter that may be
6344 @param Ecx The pointer to the 32-bit ECX value returned by the CPUID
6345 instruction. This is an optional parameter that may be
6347 @param Edx The pointer to the 32-bit EDX value returned by the CPUID
6348 instruction. This is an optional parameter that may be
6359 OUT UINT32
*Eax
, OPTIONAL
6360 OUT UINT32
*Ebx
, OPTIONAL
6361 OUT UINT32
*Ecx
, OPTIONAL
6362 OUT UINT32
*Edx OPTIONAL
6367 Set CD bit and clear NW bit of CR0 followed by a WBINVD.
6369 Disables the caches by setting the CD bit of CR0 to 1, clearing the NW bit of CR0 to 0,
6370 and executing a WBINVD instruction. This function is only available on IA-32 and x64.
6381 Perform a WBINVD and clear both the CD and NW bits of CR0.
6383 Enables the caches by executing a WBINVD instruction and then clear both the CD and NW
6384 bits of CR0 to 0. This function is only available on IA-32 and x64.
6395 Returns the lower 32-bits of a Machine Specific Register(MSR).
6397 Reads and returns the lower 32-bits of the MSR specified by Index.
6398 No parameter checking is performed on Index, and some Index values may cause
6399 CPU exceptions. The caller must either guarantee that Index is valid, or the
6400 caller must set up exception handlers to catch the exceptions. This function
6401 is only available on IA-32 and x64.
6403 @param Index The 32-bit MSR index to read.
6405 @return The lower 32 bits of the MSR identified by Index.
6416 Writes a 32-bit value to a Machine Specific Register(MSR), and returns the value.
6417 The upper 32-bits of the MSR are set to zero.
6419 Writes the 32-bit value specified by Value to the MSR specified by Index. The
6420 upper 32-bits of the MSR write are set to zero. The 32-bit value written to
6421 the MSR is returned. No parameter checking is performed on Index or Value,
6422 and some of these may cause CPU exceptions. The caller must either guarantee
6423 that Index and Value are valid, or the caller must establish proper exception
6424 handlers. This function is only available on IA-32 and x64.
6426 @param Index The 32-bit MSR index to write.
6427 @param Value The 32-bit value to write to the MSR.
6441 Reads a 64-bit MSR, performs a bitwise OR on the lower 32-bits, and
6442 writes the result back to the 64-bit MSR.
6444 Reads the 64-bit MSR specified by Index, performs a bitwise OR
6445 between the lower 32-bits of the read result and the value specified by
6446 OrData, and writes the result to the 64-bit MSR specified by Index. The lower
6447 32-bits of the value written to the MSR is returned. No parameter checking is
6448 performed on Index or OrData, and some of these may cause CPU exceptions. The
6449 caller must either guarantee that Index and OrData are valid, or the caller
6450 must establish proper exception handlers. This function is only available on
6453 @param Index The 32-bit MSR index to write.
6454 @param OrData The value to OR with the read value from the MSR.
6456 @return The lower 32-bit value written to the MSR.
6468 Reads a 64-bit MSR, performs a bitwise AND on the lower 32-bits, and writes
6469 the result back to the 64-bit MSR.
6471 Reads the 64-bit MSR specified by Index, performs a bitwise AND between the
6472 lower 32-bits of the read result and the value specified by AndData, and
6473 writes the result to the 64-bit MSR specified by Index. The lower 32-bits of
6474 the value written to the MSR is returned. No parameter checking is performed
6475 on Index or AndData, and some of these may cause CPU exceptions. The caller
6476 must either guarantee that Index and AndData are valid, or the caller must
6477 establish proper exception handlers. This function is only available on IA-32
6480 @param Index The 32-bit MSR index to write.
6481 @param AndData The value to AND with the read value from the MSR.
6483 @return The lower 32-bit value written to the MSR.
6495 Reads a 64-bit MSR, performs a bitwise AND followed by a bitwise OR
6496 on the lower 32-bits, and writes the result back to the 64-bit MSR.
6498 Reads the 64-bit MSR specified by Index, performs a bitwise AND between the
6499 lower 32-bits of the read result and the value specified by AndData
6500 preserving the upper 32-bits, performs a bitwise OR between the
6501 result of the AND operation and the value specified by OrData, and writes the
6502 result to the 64-bit MSR specified by Address. The lower 32-bits of the value
6503 written to the MSR is returned. No parameter checking is performed on Index,
6504 AndData, or OrData, and some of these may cause CPU exceptions. The caller
6505 must either guarantee that Index, AndData, and OrData are valid, or the
6506 caller must establish proper exception handlers. This function is only
6507 available on IA-32 and x64.
6509 @param Index The 32-bit MSR index to write.
6510 @param AndData The value to AND with the read value from the MSR.
6511 @param OrData The value to OR with the result of the AND operation.
6513 @return The lower 32-bit value written to the MSR.
6526 Reads a bit field of an MSR.
6528 Reads the bit field in the lower 32-bits of a 64-bit MSR. The bit field is
6529 specified by the StartBit and the EndBit. The value of the bit field is
6530 returned. The caller must either guarantee that Index is valid, or the caller
6531 must set up exception handlers to catch the exceptions. This function is only
6532 available on IA-32 and x64.
6534 If StartBit is greater than 31, then ASSERT().
6535 If EndBit is greater than 31, then ASSERT().
6536 If EndBit is less than StartBit, then ASSERT().
6538 @param Index The 32-bit MSR index to read.
6539 @param StartBit The ordinal of the least significant bit in the bit field.
6541 @param EndBit The ordinal of the most significant bit in the bit field.
6544 @return The bit field read from the MSR.
6549 AsmMsrBitFieldRead32 (
6557 Writes a bit field to an MSR.
6559 Writes Value to a bit field in the lower 32-bits of a 64-bit MSR. The bit
6560 field is specified by the StartBit and the EndBit. All other bits in the
6561 destination MSR are preserved. The lower 32-bits of the MSR written is
6562 returned. The caller must either guarantee that Index and the data written
6563 is valid, or the caller must set up exception handlers to catch the exceptions.
6564 This function is only available on IA-32 and x64.
6566 If StartBit is greater than 31, then ASSERT().
6567 If EndBit is greater than 31, then ASSERT().
6568 If EndBit is less than StartBit, then ASSERT().
6569 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
6571 @param Index The 32-bit MSR index to write.
6572 @param StartBit The ordinal of the least significant bit in the bit field.
6574 @param EndBit The ordinal of the most significant bit in the bit field.
6576 @param Value New value of the bit field.
6578 @return The lower 32-bit of the value written to the MSR.
6583 AsmMsrBitFieldWrite32 (
6592 Reads a bit field in a 64-bit MSR, performs a bitwise OR, and writes the
6593 result back to the bit field in the 64-bit MSR.
6595 Reads the 64-bit MSR specified by Index, performs a bitwise OR
6596 between the read result and the value specified by OrData, and writes the
6597 result to the 64-bit MSR specified by Index. The lower 32-bits of the value
6598 written to the MSR are returned. Extra left bits in OrData are stripped. The
6599 caller must either guarantee that Index and the data written is valid, or
6600 the caller must set up exception handlers to catch the exceptions. This
6601 function is only available on IA-32 and x64.
6603 If StartBit is greater than 31, then ASSERT().
6604 If EndBit is greater than 31, then ASSERT().
6605 If EndBit is less than StartBit, then ASSERT().
6606 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
6608 @param Index The 32-bit MSR index to write.
6609 @param StartBit The ordinal of the least significant bit in the bit field.
6611 @param EndBit The ordinal of the most significant bit in the bit field.
6613 @param OrData The value to OR with the read value from the MSR.
6615 @return The lower 32-bit of the value written to the MSR.
6620 AsmMsrBitFieldOr32 (
6629 Reads a bit field in a 64-bit MSR, performs a bitwise AND, and writes the
6630 result back to the bit field in the 64-bit MSR.
6632 Reads the 64-bit MSR specified by Index, performs a bitwise AND between the
6633 read result and the value specified by AndData, and writes the result to the
6634 64-bit MSR specified by Index. The lower 32-bits of the value written to the
6635 MSR are returned. Extra left bits in AndData are stripped. The caller must
6636 either guarantee that Index and the data written is valid, or the caller must
6637 set up exception handlers to catch the exceptions. This function is only
6638 available on IA-32 and x64.
6640 If StartBit is greater than 31, then ASSERT().
6641 If EndBit is greater than 31, then ASSERT().
6642 If EndBit is less than StartBit, then ASSERT().
6643 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
6645 @param Index The 32-bit MSR index to write.
6646 @param StartBit The ordinal of the least significant bit in the bit field.
6648 @param EndBit The ordinal of the most significant bit in the bit field.
6650 @param AndData The value to AND with the read value from the MSR.
6652 @return The lower 32-bit of the value written to the MSR.
6657 AsmMsrBitFieldAnd32 (
6666 Reads a bit field in a 64-bit MSR, performs a bitwise AND followed by a
6667 bitwise OR, and writes the result back to the bit field in the
6670 Reads the 64-bit MSR specified by Index, performs a bitwise AND followed by a
6671 bitwise OR between the read result and the value specified by
6672 AndData, and writes the result to the 64-bit MSR specified by Index. The
6673 lower 32-bits of the value written to the MSR are returned. Extra left bits
6674 in both AndData and OrData are stripped. The caller must either guarantee
6675 that Index and the data written is valid, or the caller must set up exception
6676 handlers to catch the exceptions. This function is only available on IA-32
6679 If StartBit is greater than 31, then ASSERT().
6680 If EndBit is greater than 31, then ASSERT().
6681 If EndBit is less than StartBit, then ASSERT().
6682 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
6683 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
6685 @param Index The 32-bit MSR index to write.
6686 @param StartBit The ordinal of the least significant bit in the bit field.
6688 @param EndBit The ordinal of the most significant bit in the bit field.
6690 @param AndData The value to AND with the read value from the MSR.
6691 @param OrData The value to OR with the result of the AND operation.
6693 @return The lower 32-bit of the value written to the MSR.
6698 AsmMsrBitFieldAndThenOr32 (
6708 Returns a 64-bit Machine Specific Register(MSR).
6710 Reads and returns the 64-bit MSR specified by Index. No parameter checking is
6711 performed on Index, and some Index values may cause CPU exceptions. The
6712 caller must either guarantee that Index is valid, or the caller must set up
6713 exception handlers to catch the exceptions. This function is only available
6716 @param Index The 32-bit MSR index to read.
6718 @return The value of the MSR identified by Index.
6729 Writes a 64-bit value to a Machine Specific Register(MSR), and returns the
6732 Writes the 64-bit value specified by Value to the MSR specified by Index. The
6733 64-bit value written to the MSR is returned. No parameter checking is
6734 performed on Index or Value, and some of these may cause CPU exceptions. The
6735 caller must either guarantee that Index and Value are valid, or the caller
6736 must establish proper exception handlers. This function is only available on
6739 @param Index The 32-bit MSR index to write.
6740 @param Value The 64-bit value to write to the MSR.
6754 Reads a 64-bit MSR, performs a bitwise OR, and writes the result
6755 back to the 64-bit MSR.
6757 Reads the 64-bit MSR specified by Index, performs a bitwise OR
6758 between the read result and the value specified by OrData, and writes the
6759 result to the 64-bit MSR specified by Index. The value written to the MSR is
6760 returned. No parameter checking is performed on Index or OrData, and some of
6761 these may cause CPU exceptions. The caller must either guarantee that Index
6762 and OrData are valid, or the caller must establish proper exception handlers.
6763 This function is only available on IA-32 and x64.
6765 @param Index The 32-bit MSR index to write.
6766 @param OrData The value to OR with the read value from the MSR.
6768 @return The value written back to the MSR.
6780 Reads a 64-bit MSR, performs a bitwise AND, and writes the result back to the
6783 Reads the 64-bit MSR specified by Index, performs a bitwise AND between the
6784 read result and the value specified by OrData, and writes the result to the
6785 64-bit MSR specified by Index. The value written to the MSR is returned. No
6786 parameter checking is performed on Index or OrData, and some of these may
6787 cause CPU exceptions. The caller must either guarantee that Index and OrData
6788 are valid, or the caller must establish proper exception handlers. This
6789 function is only available on IA-32 and x64.
6791 @param Index The 32-bit MSR index to write.
6792 @param AndData The value to AND with the read value from the MSR.
6794 @return The value written back to the MSR.
6806 Reads a 64-bit MSR, performs a bitwise AND followed by a bitwise
6807 OR, and writes the result back to the 64-bit MSR.
6809 Reads the 64-bit MSR specified by Index, performs a bitwise AND between read
6810 result and the value specified by AndData, performs a bitwise OR
6811 between the result of the AND operation and the value specified by OrData,
6812 and writes the result to the 64-bit MSR specified by Index. The value written
6813 to the MSR is returned. No parameter checking is performed on Index, AndData,
6814 or OrData, and some of these may cause CPU exceptions. The caller must either
6815 guarantee that Index, AndData, and OrData are valid, or the caller must
6816 establish proper exception handlers. This function is only available on IA-32
6819 @param Index The 32-bit MSR index to write.
6820 @param AndData The value to AND with the read value from the MSR.
6821 @param OrData The value to OR with the result of the AND operation.
6823 @return The value written back to the MSR.
6836 Reads a bit field of an MSR.
6838 Reads the bit field in the 64-bit MSR. The bit field is specified by the
6839 StartBit and the EndBit. The value of the bit field is returned. The caller
6840 must either guarantee that Index is valid, or the caller must set up
6841 exception handlers to catch the exceptions. This function is only available
6844 If StartBit is greater than 63, then ASSERT().
6845 If EndBit is greater than 63, then ASSERT().
6846 If EndBit is less than StartBit, then ASSERT().
6848 @param Index The 32-bit MSR index to read.
6849 @param StartBit The ordinal of the least significant bit in the bit field.
6851 @param EndBit The ordinal of the most significant bit in the bit field.
6854 @return The value read from the MSR.
6859 AsmMsrBitFieldRead64 (
6867 Writes a bit field to an MSR.
6869 Writes Value to a bit field in a 64-bit MSR. The bit field is specified by
6870 the StartBit and the EndBit. All other bits in the destination MSR are
6871 preserved. The MSR written is returned. The caller must either guarantee
6872 that Index and the data written is valid, or the caller must set up exception
6873 handlers to catch the exceptions. This function is only available on IA-32 and x64.
6875 If StartBit is greater than 63, then ASSERT().
6876 If EndBit is greater than 63, then ASSERT().
6877 If EndBit is less than StartBit, then ASSERT().
6878 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
6880 @param Index The 32-bit MSR index to write.
6881 @param StartBit The ordinal of the least significant bit in the bit field.
6883 @param EndBit The ordinal of the most significant bit in the bit field.
6885 @param Value New value of the bit field.
6887 @return The value written back to the MSR.
6892 AsmMsrBitFieldWrite64 (
6901 Reads a bit field in a 64-bit MSR, performs a bitwise OR, and
6902 writes the result back to the bit field in the 64-bit MSR.
6904 Reads the 64-bit MSR specified by Index, performs a bitwise OR
6905 between the read result and the value specified by OrData, and writes the
6906 result to the 64-bit MSR specified by Index. The value written to the MSR is
6907 returned. Extra left bits in OrData are stripped. The caller must either
6908 guarantee that Index and the data written is valid, or the caller must set up
6909 exception handlers to catch the exceptions. This function is only available
6912 If StartBit is greater than 63, then ASSERT().
6913 If EndBit is greater than 63, then ASSERT().
6914 If EndBit is less than StartBit, then ASSERT().
6915 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
6917 @param Index The 32-bit MSR index to write.
6918 @param StartBit The ordinal of the least significant bit in the bit field.
6920 @param EndBit The ordinal of the most significant bit in the bit field.
6922 @param OrData The value to OR with the read value from the bit field.
6924 @return The value written back to the MSR.
6929 AsmMsrBitFieldOr64 (
6938 Reads a bit field in a 64-bit MSR, performs a bitwise AND, and writes the
6939 result back to the bit field in the 64-bit MSR.
6941 Reads the 64-bit MSR specified by Index, performs a bitwise AND between the
6942 read result and the value specified by AndData, and writes the result to the
6943 64-bit MSR specified by Index. The value written to the MSR is returned.
6944 Extra left bits in AndData are stripped. The caller must either guarantee
6945 that Index and the data written is valid, or the caller must set up exception
6946 handlers to catch the exceptions. This function is only available on IA-32
6949 If StartBit is greater than 63, then ASSERT().
6950 If EndBit is greater than 63, then ASSERT().
6951 If EndBit is less than StartBit, then ASSERT().
6952 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
6954 @param Index The 32-bit MSR index to write.
6955 @param StartBit The ordinal of the least significant bit in the bit field.
6957 @param EndBit The ordinal of the most significant bit in the bit field.
6959 @param AndData The value to AND with the read value from the bit field.
6961 @return The value written back to the MSR.
6966 AsmMsrBitFieldAnd64 (
6975 Reads a bit field in a 64-bit MSR, performs a bitwise AND followed by a
6976 bitwise OR, and writes the result back to the bit field in the
6979 Reads the 64-bit MSR specified by Index, performs a bitwise AND followed by
6980 a bitwise OR between the read result and the value specified by
6981 AndData, and writes the result to the 64-bit MSR specified by Index. The
6982 value written to the MSR is returned. Extra left bits in both AndData and
6983 OrData are stripped. The caller must either guarantee that Index and the data
6984 written is valid, or the caller must set up exception handlers to catch the
6985 exceptions. This function is only available on IA-32 and x64.
6987 If StartBit is greater than 63, then ASSERT().
6988 If EndBit is greater than 63, then ASSERT().
6989 If EndBit is less than StartBit, then ASSERT().
6990 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
6991 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
6993 @param Index The 32-bit MSR index to write.
6994 @param StartBit The ordinal of the least significant bit in the bit field.
6996 @param EndBit The ordinal of the most significant bit in the bit field.
6998 @param AndData The value to AND with the read value from the bit field.
6999 @param OrData The value to OR with the result of the AND operation.
7001 @return The value written back to the MSR.
7006 AsmMsrBitFieldAndThenOr64 (
7016 Reads the current value of the EFLAGS register.
7018 Reads and returns the current value of the EFLAGS register. This function is
7019 only available on IA-32 and x64. This returns a 32-bit value on IA-32 and a
7020 64-bit value on x64.
7022 @return EFLAGS on IA-32 or RFLAGS on x64.
7033 Reads the current value of the Control Register 0 (CR0).
7035 Reads and returns the current value of CR0. This function is only available
7036 on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on
7039 @return The value of the Control Register 0 (CR0).
7050 Reads the current value of the Control Register 2 (CR2).
7052 Reads and returns the current value of CR2. This function is only available
7053 on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on
7056 @return The value of the Control Register 2 (CR2).
7067 Reads the current value of the Control Register 3 (CR3).
7069 Reads and returns the current value of CR3. This function is only available
7070 on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on
7073 @return The value of the Control Register 3 (CR3).
7084 Reads the current value of the Control Register 4 (CR4).
7086 Reads and returns the current value of CR4. This function is only available
7087 on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on
7090 @return The value of the Control Register 4 (CR4).
7101 Writes a value to Control Register 0 (CR0).
7103 Writes and returns a new value to CR0. This function is only available on
7104 IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.
7106 @param Cr0 The value to write to CR0.
7108 @return The value written to CR0.
7119 Writes a value to Control Register 2 (CR2).
7121 Writes and returns a new value to CR2. This function is only available on
7122 IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.
7124 @param Cr2 The value to write to CR2.
7126 @return The value written to CR2.
7137 Writes a value to Control Register 3 (CR3).
7139 Writes and returns a new value to CR3. This function is only available on
7140 IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.
7142 @param Cr3 The value to write to CR3.
7144 @return The value written to CR3.
7155 Writes a value to Control Register 4 (CR4).
7157 Writes and returns a new value to CR4. This function is only available on
7158 IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.
7160 @param Cr4 The value to write to CR4.
7162 @return The value written to CR4.
7173 Reads the current value of Debug Register 0 (DR0).
7175 Reads and returns the current value of DR0. This function is only available
7176 on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on
7179 @return The value of Debug Register 0 (DR0).
7190 Reads the current value of Debug Register 1 (DR1).
7192 Reads and returns the current value of DR1. This function is only available
7193 on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on
7196 @return The value of Debug Register 1 (DR1).
7207 Reads the current value of Debug Register 2 (DR2).
7209 Reads and returns the current value of DR2. This function is only available
7210 on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on
7213 @return The value of Debug Register 2 (DR2).
7224 Reads the current value of Debug Register 3 (DR3).
7226 Reads and returns the current value of DR3. This function is only available
7227 on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on
7230 @return The value of Debug Register 3 (DR3).
7241 Reads the current value of Debug Register 4 (DR4).
7243 Reads and returns the current value of DR4. This function is only available
7244 on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on
7247 @return The value of Debug Register 4 (DR4).
7258 Reads the current value of Debug Register 5 (DR5).
7260 Reads and returns the current value of DR5. This function is only available
7261 on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on
7264 @return The value of Debug Register 5 (DR5).
7275 Reads the current value of Debug Register 6 (DR6).
7277 Reads and returns the current value of DR6. This function is only available
7278 on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on
7281 @return The value of Debug Register 6 (DR6).
7292 Reads the current value of Debug Register 7 (DR7).
7294 Reads and returns the current value of DR7. This function is only available
7295 on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on
7298 @return The value of Debug Register 7 (DR7).
7309 Writes a value to Debug Register 0 (DR0).
7311 Writes and returns a new value to DR0. This function is only available on
7312 IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.
7314 @param Dr0 The value to write to Dr0.
7316 @return The value written to Debug Register 0 (DR0).
7327 Writes a value to Debug Register 1 (DR1).
7329 Writes and returns a new value to DR1. This function is only available on
7330 IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.
7332 @param Dr1 The value to write to Dr1.
7334 @return The value written to Debug Register 1 (DR1).
7345 Writes a value to Debug Register 2 (DR2).
7347 Writes and returns a new value to DR2. This function is only available on
7348 IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.
7350 @param Dr2 The value to write to Dr2.
7352 @return The value written to Debug Register 2 (DR2).
7363 Writes a value to Debug Register 3 (DR3).
7365 Writes and returns a new value to DR3. This function is only available on
7366 IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.
7368 @param Dr3 The value to write to Dr3.
7370 @return The value written to Debug Register 3 (DR3).
7381 Writes a value to Debug Register 4 (DR4).
7383 Writes and returns a new value to DR4. This function is only available on
7384 IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.
7386 @param Dr4 The value to write to Dr4.
7388 @return The value written to Debug Register 4 (DR4).
7399 Writes a value to Debug Register 5 (DR5).
7401 Writes and returns a new value to DR5. This function is only available on
7402 IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.
7404 @param Dr5 The value to write to Dr5.
7406 @return The value written to Debug Register 5 (DR5).
7417 Writes a value to Debug Register 6 (DR6).
7419 Writes and returns a new value to DR6. This function is only available on
7420 IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.
7422 @param Dr6 The value to write to Dr6.
7424 @return The value written to Debug Register 6 (DR6).
7435 Writes a value to Debug Register 7 (DR7).
7437 Writes and returns a new value to DR7. This function is only available on
7438 IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.
7440 @param Dr7 The value to write to Dr7.
7442 @return The value written to Debug Register 7 (DR7).
7453 Reads the current value of Code Segment Register (CS).
7455 Reads and returns the current value of CS. This function is only available on
7458 @return The current value of CS.
7469 Reads the current value of Data Segment Register (DS).
7471 Reads and returns the current value of DS. This function is only available on
7474 @return The current value of DS.
7485 Reads the current value of Extra Segment Register (ES).
7487 Reads and returns the current value of ES. This function is only available on
7490 @return The current value of ES.
7501 Reads the current value of FS Data Segment Register (FS).
7503 Reads and returns the current value of FS. This function is only available on
7506 @return The current value of FS.
7517 Reads the current value of GS Data Segment Register (GS).
7519 Reads and returns the current value of GS. This function is only available on
7522 @return The current value of GS.
7533 Reads the current value of Stack Segment Register (SS).
7535 Reads and returns the current value of SS. This function is only available on
7538 @return The current value of SS.
7549 Reads the current value of Task Register (TR).
7551 Reads and returns the current value of TR. This function is only available on
7554 @return The current value of TR.
7565 Reads the current Global Descriptor Table Register(GDTR) descriptor.
7567 Reads and returns the current GDTR descriptor and returns it in Gdtr. This
7568 function is only available on IA-32 and x64.
7570 If Gdtr is NULL, then ASSERT().
7572 @param Gdtr The pointer to a GDTR descriptor.
7578 OUT IA32_DESCRIPTOR
*Gdtr
7583 Writes the current Global Descriptor Table Register (GDTR) descriptor.
7585 Writes and the current GDTR descriptor specified by Gdtr. This function is
7586 only available on IA-32 and x64.
7588 If Gdtr is NULL, then ASSERT().
7590 @param Gdtr The pointer to a GDTR descriptor.
7596 IN CONST IA32_DESCRIPTOR
*Gdtr
7601 Reads the current Interrupt Descriptor Table Register(IDTR) descriptor.
7603 Reads and returns the current IDTR descriptor and returns it in Idtr. This
7604 function is only available on IA-32 and x64.
7606 If Idtr is NULL, then ASSERT().
7608 @param Idtr The pointer to a IDTR descriptor.
7614 OUT IA32_DESCRIPTOR
*Idtr
7619 Writes the current Interrupt Descriptor Table Register(IDTR) descriptor.
7621 Writes the current IDTR descriptor and returns it in Idtr. This function is
7622 only available on IA-32 and x64.
7624 If Idtr is NULL, then ASSERT().
7626 @param Idtr The pointer to a IDTR descriptor.
7632 IN CONST IA32_DESCRIPTOR
*Idtr
7637 Reads the current Local Descriptor Table Register(LDTR) selector.
7639 Reads and returns the current 16-bit LDTR descriptor value. This function is
7640 only available on IA-32 and x64.
7642 @return The current selector of LDT.
7653 Writes the current Local Descriptor Table Register (LDTR) selector.
7655 Writes and the current LDTR descriptor specified by Ldtr. This function is
7656 only available on IA-32 and x64.
7658 @param Ldtr 16-bit LDTR selector value.
7669 Save the current floating point/SSE/SSE2 context to a buffer.
7671 Saves the current floating point/SSE/SSE2 state to the buffer specified by
7672 Buffer. Buffer must be aligned on a 16-byte boundary. This function is only
7673 available on IA-32 and x64.
7675 If Buffer is NULL, then ASSERT().
7676 If Buffer is not aligned on a 16-byte boundary, then ASSERT().
7678 @param Buffer The pointer to a buffer to save the floating point/SSE/SSE2 context.
7684 OUT IA32_FX_BUFFER
*Buffer
7689 Restores the current floating point/SSE/SSE2 context from a buffer.
7691 Restores the current floating point/SSE/SSE2 state from the buffer specified
7692 by Buffer. Buffer must be aligned on a 16-byte boundary. This function is
7693 only available on IA-32 and x64.
7695 If Buffer is NULL, then ASSERT().
7696 If Buffer is not aligned on a 16-byte boundary, then ASSERT().
7697 If Buffer was not saved with AsmFxSave(), then ASSERT().
7699 @param Buffer The pointer to a buffer to save the floating point/SSE/SSE2 context.
7705 IN CONST IA32_FX_BUFFER
*Buffer
7710 Reads the current value of 64-bit MMX Register #0 (MM0).
7712 Reads and returns the current value of MM0. This function is only available
7715 @return The current value of MM0.
7726 Reads the current value of 64-bit MMX Register #1 (MM1).
7728 Reads and returns the current value of MM1. This function is only available
7731 @return The current value of MM1.
7742 Reads the current value of 64-bit MMX Register #2 (MM2).
7744 Reads and returns the current value of MM2. This function is only available
7747 @return The current value of MM2.
7758 Reads the current value of 64-bit MMX Register #3 (MM3).
7760 Reads and returns the current value of MM3. This function is only available
7763 @return The current value of MM3.
7774 Reads the current value of 64-bit MMX Register #4 (MM4).
7776 Reads and returns the current value of MM4. This function is only available
7779 @return The current value of MM4.
7790 Reads the current value of 64-bit MMX Register #5 (MM5).
7792 Reads and returns the current value of MM5. This function is only available
7795 @return The current value of MM5.
7806 Reads the current value of 64-bit MMX Register #6 (MM6).
7808 Reads and returns the current value of MM6. This function is only available
7811 @return The current value of MM6.
7822 Reads the current value of 64-bit MMX Register #7 (MM7).
7824 Reads and returns the current value of MM7. This function is only available
7827 @return The current value of MM7.
7838 Writes the current value of 64-bit MMX Register #0 (MM0).
7840 Writes the current value of MM0. This function is only available on IA32 and
7843 @param Value The 64-bit value to write to MM0.
7854 Writes the current value of 64-bit MMX Register #1 (MM1).
7856 Writes the current value of MM1. This function is only available on IA32 and
7859 @param Value The 64-bit value to write to MM1.
7870 Writes the current value of 64-bit MMX Register #2 (MM2).
7872 Writes the current value of MM2. This function is only available on IA32 and
7875 @param Value The 64-bit value to write to MM2.
7886 Writes the current value of 64-bit MMX Register #3 (MM3).
7888 Writes the current value of MM3. This function is only available on IA32 and
7891 @param Value The 64-bit value to write to MM3.
7902 Writes the current value of 64-bit MMX Register #4 (MM4).
7904 Writes the current value of MM4. This function is only available on IA32 and
7907 @param Value The 64-bit value to write to MM4.
7918 Writes the current value of 64-bit MMX Register #5 (MM5).
7920 Writes the current value of MM5. This function is only available on IA32 and
7923 @param Value The 64-bit value to write to MM5.
7934 Writes the current value of 64-bit MMX Register #6 (MM6).
7936 Writes the current value of MM6. This function is only available on IA32 and
7939 @param Value The 64-bit value to write to MM6.
7950 Writes the current value of 64-bit MMX Register #7 (MM7).
7952 Writes the current value of MM7. This function is only available on IA32 and
7955 @param Value The 64-bit value to write to MM7.
7966 Reads the current value of Time Stamp Counter (TSC).
7968 Reads and returns the current value of TSC. This function is only available
7971 @return The current value of TSC
7982 Reads the current value of a Performance Counter (PMC).
7984 Reads and returns the current value of performance counter specified by
7985 Index. This function is only available on IA-32 and x64.
7987 @param Index The 32-bit Performance Counter index to read.
7989 @return The value of the PMC specified by Index.
8000 Sets up a monitor buffer that is used by AsmMwait().
8002 Executes a MONITOR instruction with the register state specified by Eax, Ecx
8003 and Edx. Returns Eax. This function is only available on IA-32 and x64.
8005 @param Eax The value to load into EAX or RAX before executing the MONITOR
8007 @param Ecx The value to load into ECX or RCX before executing the MONITOR
8009 @param Edx The value to load into EDX or RDX before executing the MONITOR
8025 Executes an MWAIT instruction.
8027 Executes an MWAIT instruction with the register state specified by Eax and
8028 Ecx. Returns Eax. This function is only available on IA-32 and x64.
8030 @param Eax The value to load into EAX or RAX before executing the MONITOR
8032 @param Ecx The value to load into ECX or RCX before executing the MONITOR
8047 Executes a WBINVD instruction.
8049 Executes a WBINVD instruction. This function is only available on IA-32 and
8061 Executes a INVD instruction.
8063 Executes a INVD instruction. This function is only available on IA-32 and
8075 Flushes a cache line from all the instruction and data caches within the
8076 coherency domain of the CPU.
8078 Flushed the cache line specified by LinearAddress, and returns LinearAddress.
8079 This function is only available on IA-32 and x64.
8081 @param LinearAddress The address of the cache line to flush. If the CPU is
8082 in a physical addressing mode, then LinearAddress is a
8083 physical address. If the CPU is in a virtual
8084 addressing mode, then LinearAddress is a virtual
8087 @return LinearAddress.
8092 IN VOID
*LinearAddress
8097 Enables the 32-bit paging mode on the CPU.
8099 Enables the 32-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables
8100 must be properly initialized prior to calling this service. This function
8101 assumes the current execution mode is 32-bit protected mode. This function is
8102 only available on IA-32. After the 32-bit paging mode is enabled, control is
8103 transferred to the function specified by EntryPoint using the new stack
8104 specified by NewStack and passing in the parameters specified by Context1 and
8105 Context2. Context1 and Context2 are optional and may be NULL. The function
8106 EntryPoint must never return.
8108 If the current execution mode is not 32-bit protected mode, then ASSERT().
8109 If EntryPoint is NULL, then ASSERT().
8110 If NewStack is NULL, then ASSERT().
8112 There are a number of constraints that must be followed before calling this
8114 1) Interrupts must be disabled.
8115 2) The caller must be in 32-bit protected mode with flat descriptors. This
8116 means all descriptors must have a base of 0 and a limit of 4GB.
8117 3) CR0 and CR4 must be compatible with 32-bit protected mode with flat
8119 4) CR3 must point to valid page tables that will be used once the transition
8120 is complete, and those page tables must guarantee that the pages for this
8121 function and the stack are identity mapped.
8123 @param EntryPoint A pointer to function to call with the new stack after
8125 @param Context1 A pointer to the context to pass into the EntryPoint
8126 function as the first parameter after paging is enabled.
8127 @param Context2 A pointer to the context to pass into the EntryPoint
8128 function as the second parameter after paging is enabled.
8129 @param NewStack A pointer to the new stack to use for the EntryPoint
8130 function after paging is enabled.
8136 IN SWITCH_STACK_ENTRY_POINT EntryPoint
,
8137 IN VOID
*Context1
, OPTIONAL
8138 IN VOID
*Context2
, OPTIONAL
8144 Disables the 32-bit paging mode on the CPU.
8146 Disables the 32-bit paging mode on the CPU and returns to 32-bit protected
8147 mode. This function assumes the current execution mode is 32-paged protected
8148 mode. This function is only available on IA-32. After the 32-bit paging mode
8149 is disabled, control is transferred to the function specified by EntryPoint
8150 using the new stack specified by NewStack and passing in the parameters
8151 specified by Context1 and Context2. Context1 and Context2 are optional and
8152 may be NULL. The function EntryPoint must never return.
8154 If the current execution mode is not 32-bit paged mode, then ASSERT().
8155 If EntryPoint is NULL, then ASSERT().
8156 If NewStack is NULL, then ASSERT().
8158 There are a number of constraints that must be followed before calling this
8160 1) Interrupts must be disabled.
8161 2) The caller must be in 32-bit paged mode.
8162 3) CR0, CR3, and CR4 must be compatible with 32-bit paged mode.
8163 4) CR3 must point to valid page tables that guarantee that the pages for
8164 this function and the stack are identity mapped.
8166 @param EntryPoint A pointer to function to call with the new stack after
8168 @param Context1 A pointer to the context to pass into the EntryPoint
8169 function as the first parameter after paging is disabled.
8170 @param Context2 A pointer to the context to pass into the EntryPoint
8171 function as the second parameter after paging is
8173 @param NewStack A pointer to the new stack to use for the EntryPoint
8174 function after paging is disabled.
8179 AsmDisablePaging32 (
8180 IN SWITCH_STACK_ENTRY_POINT EntryPoint
,
8181 IN VOID
*Context1
, OPTIONAL
8182 IN VOID
*Context2
, OPTIONAL
8188 Enables the 64-bit paging mode on the CPU.
8190 Enables the 64-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables
8191 must be properly initialized prior to calling this service. This function
8192 assumes the current execution mode is 32-bit protected mode with flat
8193 descriptors. This function is only available on IA-32. After the 64-bit
8194 paging mode is enabled, control is transferred to the function specified by
8195 EntryPoint using the new stack specified by NewStack and passing in the
8196 parameters specified by Context1 and Context2. Context1 and Context2 are
8197 optional and may be 0. The function EntryPoint must never return.
8199 If the current execution mode is not 32-bit protected mode with flat
8200 descriptors, then ASSERT().
8201 If EntryPoint is 0, then ASSERT().
8202 If NewStack is 0, then ASSERT().
8204 @param Cs The 16-bit selector to load in the CS before EntryPoint
8205 is called. The descriptor in the GDT that this selector
8206 references must be setup for long mode.
8207 @param EntryPoint The 64-bit virtual address of the function to call with
8208 the new stack after paging is enabled.
8209 @param Context1 The 64-bit virtual address of the context to pass into
8210 the EntryPoint function as the first parameter after
8212 @param Context2 The 64-bit virtual address of the context to pass into
8213 the EntryPoint function as the second parameter after
8215 @param NewStack The 64-bit virtual address of the new stack to use for
8216 the EntryPoint function after paging is enabled.
8223 IN UINT64 EntryPoint
,
8224 IN UINT64 Context1
, OPTIONAL
8225 IN UINT64 Context2
, OPTIONAL
8231 Disables the 64-bit paging mode on the CPU.
8233 Disables the 64-bit paging mode on the CPU and returns to 32-bit protected
8234 mode. This function assumes the current execution mode is 64-paging mode.
8235 This function is only available on x64. After the 64-bit paging mode is
8236 disabled, control is transferred to the function specified by EntryPoint
8237 using the new stack specified by NewStack and passing in the parameters
8238 specified by Context1 and Context2. Context1 and Context2 are optional and
8239 may be 0. The function EntryPoint must never return.
8241 If the current execution mode is not 64-bit paged mode, then ASSERT().
8242 If EntryPoint is 0, then ASSERT().
8243 If NewStack is 0, then ASSERT().
8245 @param Cs The 16-bit selector to load in the CS before EntryPoint
8246 is called. The descriptor in the GDT that this selector
8247 references must be setup for 32-bit protected mode.
8248 @param EntryPoint The 64-bit virtual address of the function to call with
8249 the new stack after paging is disabled.
8250 @param Context1 The 64-bit virtual address of the context to pass into
8251 the EntryPoint function as the first parameter after
8253 @param Context2 The 64-bit virtual address of the context to pass into
8254 the EntryPoint function as the second parameter after
8256 @param NewStack The 64-bit virtual address of the new stack to use for
8257 the EntryPoint function after paging is disabled.
8262 AsmDisablePaging64 (
8264 IN UINT32 EntryPoint
,
8265 IN UINT32 Context1
, OPTIONAL
8266 IN UINT32 Context2
, OPTIONAL
8272 // 16-bit thunking services
8276 Retrieves the properties for 16-bit thunk functions.
8278 Computes the size of the buffer and stack below 1MB required to use the
8279 AsmPrepareThunk16(), AsmThunk16() and AsmPrepareAndThunk16() functions. This
8280 buffer size is returned in RealModeBufferSize, and the stack size is returned
8281 in ExtraStackSize. If parameters are passed to the 16-bit real mode code,
8282 then the actual minimum stack size is ExtraStackSize plus the maximum number
8283 of bytes that need to be passed to the 16-bit real mode code.
8285 If RealModeBufferSize is NULL, then ASSERT().
8286 If ExtraStackSize is NULL, then ASSERT().
8288 @param RealModeBufferSize A pointer to the size of the buffer below 1MB
8289 required to use the 16-bit thunk functions.
8290 @param ExtraStackSize A pointer to the extra size of stack below 1MB
8291 that the 16-bit thunk functions require for
8292 temporary storage in the transition to and from
8298 AsmGetThunk16Properties (
8299 OUT UINT32
*RealModeBufferSize
,
8300 OUT UINT32
*ExtraStackSize
8305 Prepares all structures a code required to use AsmThunk16().
8307 Prepares all structures and code required to use AsmThunk16().
8309 This interface is limited to be used in either physical mode or virtual modes with paging enabled where the
8310 virtual to physical mappings for ThunkContext.RealModeBuffer is mapped 1:1.
8312 If ThunkContext is NULL, then ASSERT().
8314 @param ThunkContext A pointer to the context structure that describes the
8315 16-bit real mode code to call.
8321 IN OUT THUNK_CONTEXT
*ThunkContext
8326 Transfers control to a 16-bit real mode entry point and returns the results.
8328 Transfers control to a 16-bit real mode entry point and returns the results.
8329 AsmPrepareThunk16() must be called with ThunkContext before this function is used.
8330 This function must be called with interrupts disabled.
8332 The register state from the RealModeState field of ThunkContext is restored just prior
8333 to calling the 16-bit real mode entry point. This includes the EFLAGS field of RealModeState,
8334 which is used to set the interrupt state when a 16-bit real mode entry point is called.
8335 Control is transferred to the 16-bit real mode entry point specified by the CS and Eip fields of RealModeState.
8336 The stack is initialized to the SS and ESP fields of RealModeState. Any parameters passed to
8337 the 16-bit real mode code must be populated by the caller at SS:ESP prior to calling this function.
8338 The 16-bit real mode entry point is invoked with a 16-bit CALL FAR instruction,
8339 so when accessing stack contents, the 16-bit real mode code must account for the 16-bit segment
8340 and 16-bit offset of the return address that were pushed onto the stack. The 16-bit real mode entry
8341 point must exit with a RETF instruction. The register state is captured into RealModeState immediately
8342 after the RETF instruction is executed.
8344 If EFLAGS specifies interrupts enabled, or any of the 16-bit real mode code enables interrupts,
8345 or any of the 16-bit real mode code makes a SW interrupt, then the caller is responsible for making sure
8346 the IDT at address 0 is initialized to handle any HW or SW interrupts that may occur while in 16-bit real mode.
8348 If EFLAGS specifies interrupts enabled, or any of the 16-bit real mode code enables interrupts,
8349 then the caller is responsible for making sure the 8259 PIC is in a state compatible with 16-bit real mode.
8350 This includes the base vectors, the interrupt masks, and the edge/level trigger mode.
8352 If THUNK_ATTRIBUTE_BIG_REAL_MODE is set in the ThunkAttributes field of ThunkContext, then the user code
8353 is invoked in big real mode. Otherwise, the user code is invoked in 16-bit real mode with 64KB segment limits.
8355 If neither THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 nor THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL are set in
8356 ThunkAttributes, then it is assumed that the user code did not enable the A20 mask, and no attempt is made to
8357 disable the A20 mask.
8359 If THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 is set and THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL is clear in
8360 ThunkAttributes, then attempt to use the INT 15 service to disable the A20 mask. If this INT 15 call fails,
8361 then attempt to disable the A20 mask by directly accessing the 8042 keyboard controller I/O ports.
8363 If THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 is clear and THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL is set in
8364 ThunkAttributes, then attempt to disable the A20 mask by directly accessing the 8042 keyboard controller I/O ports.
8366 If ThunkContext is NULL, then ASSERT().
8367 If AsmPrepareThunk16() was not previously called with ThunkContext, then ASSERT().
8368 If both THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 and THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL are set in
8369 ThunkAttributes, then ASSERT().
8371 This interface is limited to be used in either physical mode or virtual modes with paging enabled where the
8372 virtual to physical mappings for ThunkContext.RealModeBuffer are mapped 1:1.
8374 @param ThunkContext A pointer to the context structure that describes the
8375 16-bit real mode code to call.
8381 IN OUT THUNK_CONTEXT
*ThunkContext
8386 Prepares all structures and code for a 16-bit real mode thunk, transfers
8387 control to a 16-bit real mode entry point, and returns the results.
8389 Prepares all structures and code for a 16-bit real mode thunk, transfers
8390 control to a 16-bit real mode entry point, and returns the results. If the
8391 caller only need to perform a single 16-bit real mode thunk, then this
8392 service should be used. If the caller intends to make more than one 16-bit
8393 real mode thunk, then it is more efficient if AsmPrepareThunk16() is called
8394 once and AsmThunk16() can be called for each 16-bit real mode thunk.
8396 This interface is limited to be used in either physical mode or virtual modes with paging enabled where the
8397 virtual to physical mappings for ThunkContext.RealModeBuffer is mapped 1:1.
8399 See AsmPrepareThunk16() and AsmThunk16() for the detailed description and ASSERT() conditions.
8401 @param ThunkContext A pointer to the context structure that describes the
8402 16-bit real mode code to call.
8407 AsmPrepareAndThunk16 (
8408 IN OUT THUNK_CONTEXT
*ThunkContext
8412 Generates a 16-bit random number through RDRAND instruction.
8414 if Rand is NULL, then ASSERT().
8416 @param[out] Rand Buffer pointer to store the random result.
8418 @retval TRUE RDRAND call was successful.
8419 @retval FALSE Failed attempts to call RDRAND.
8429 Generates a 32-bit random number through RDRAND instruction.
8431 if Rand is NULL, then ASSERT().
8433 @param[out] Rand Buffer pointer to store the random result.
8435 @retval TRUE RDRAND call was successful.
8436 @retval FALSE Failed attempts to call RDRAND.
8446 Generates a 64-bit random number through RDRAND instruction.
8448 if Rand is NULL, then ASSERT().
8450 @param[out] Rand Buffer pointer to store the random result.
8452 @retval TRUE RDRAND call was successful.
8453 @retval FALSE Failed attempts to call RDRAND.