2 Declaration of internal functions in BaseLib.
4 Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #ifndef __BASE_LIB_INTERNALS__
16 #define __BASE_LIB_INTERNALS__
19 #include <Library/BaseLib.h>
20 #include <Library/BaseMemoryLib.h>
21 #include <Library/DebugLib.h>
22 #include <Library/PcdLib.h>
29 Shifts a 64-bit integer left between 0 and 63 bits. The low bits
30 are filled with zeros. The shifted value is returned.
32 This function shifts the 64-bit value Operand to the left by Count bits. The
33 low Count bits are set to zero. The shifted value is returned.
35 @param Operand The 64-bit operand to shift left.
36 @param Count The number of bits to shift left.
38 @return Operand << Count
43 InternalMathLShiftU64 (
49 Shifts a 64-bit integer right between 0 and 63 bits. The high bits
50 are filled with zeros. The shifted value is returned.
52 This function shifts the 64-bit value Operand to the right by Count bits. The
53 high Count bits are set to zero. The shifted value is returned.
55 @param Operand The 64-bit operand to shift right.
56 @param Count The number of bits to shift right.
58 @return Operand >> Count
63 InternalMathRShiftU64 (
69 Shifts a 64-bit integer right between 0 and 63 bits. The high bits
70 are filled with original integer's bit 63. The shifted value is returned.
72 This function shifts the 64-bit value Operand to the right by Count bits. The
73 high Count bits are set to bit 63 of Operand. The shifted value is returned.
75 @param Operand The 64-bit operand to shift right.
76 @param Count The number of bits to shift right.
78 @return Operand arithmetically shifted right by Count
83 InternalMathARShiftU64 (
89 Rotates a 64-bit integer left between 0 and 63 bits, filling
90 the low bits with the high bits that were rotated.
92 This function rotates the 64-bit value Operand to the left by Count bits. The
93 low Count bits are filled with the high Count bits of Operand. The rotated
96 @param Operand The 64-bit operand to rotate left.
97 @param Count The number of bits to rotate left.
99 @return Operand <<< Count
104 InternalMathLRotU64 (
110 Rotates a 64-bit integer right between 0 and 63 bits, filling
111 the high bits with the high low bits that were rotated.
113 This function rotates the 64-bit value Operand to the right by Count bits.
114 The high Count bits are filled with the low Count bits of Operand. The rotated
117 @param Operand The 64-bit operand to rotate right.
118 @param Count The number of bits to rotate right.
120 @return Operand >>> Count
125 InternalMathRRotU64 (
131 Switches the endianess of a 64-bit integer.
133 This function swaps the bytes in a 64-bit unsigned value to switch the value
134 from little endian to big endian or vice versa. The byte swapped value is
137 @param Operand A 64-bit unsigned value.
139 @return The byte swapped Operand.
144 InternalMathSwapBytes64 (
149 Multiplies a 64-bit unsigned integer by a 32-bit unsigned integer
150 and generates a 64-bit unsigned result.
152 This function multiplies the 64-bit unsigned value Multiplicand by the 32-bit
153 unsigned value Multiplier and generates a 64-bit unsigned result. This 64-
154 bit unsigned result is returned.
156 @param Multiplicand A 64-bit unsigned value.
157 @param Multiplier A 32-bit unsigned value.
159 @return Multiplicand * Multiplier
164 InternalMathMultU64x32 (
165 IN UINT64 Multiplicand
,
170 Multiplies a 64-bit unsigned integer by a 64-bit unsigned integer
171 and generates a 64-bit unsigned result.
173 This function multiples the 64-bit unsigned value Multiplicand by the 64-bit
174 unsigned value Multiplier and generates a 64-bit unsigned result. This 64-
175 bit unsigned result is returned.
177 @param Multiplicand A 64-bit unsigned value.
178 @param Multiplier A 64-bit unsigned value.
180 @return Multiplicand * Multiplier
185 InternalMathMultU64x64 (
186 IN UINT64 Multiplicand
,
191 Divides a 64-bit unsigned integer by a 32-bit unsigned integer and
192 generates a 64-bit unsigned result.
194 This function divides the 64-bit unsigned value Dividend by the 32-bit
195 unsigned value Divisor and generates a 64-bit unsigned quotient. This
196 function returns the 64-bit unsigned quotient.
198 @param Dividend A 64-bit unsigned value.
199 @param Divisor A 32-bit unsigned value.
201 @return Dividend / Divisor
206 InternalMathDivU64x32 (
212 Divides a 64-bit unsigned integer by a 32-bit unsigned integer and
213 generates a 32-bit unsigned remainder.
215 This function divides the 64-bit unsigned value Dividend by the 32-bit
216 unsigned value Divisor and generates a 32-bit remainder. This function
217 returns the 32-bit unsigned remainder.
219 @param Dividend A 64-bit unsigned value.
220 @param Divisor A 32-bit unsigned value.
222 @return Dividend % Divisor
227 InternalMathModU64x32 (
233 Divides a 64-bit unsigned integer by a 32-bit unsigned integer and
234 generates a 64-bit unsigned result and an optional 32-bit unsigned remainder.
236 This function divides the 64-bit unsigned value Dividend by the 32-bit
237 unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder
238 is not NULL, then the 32-bit unsigned remainder is returned in Remainder.
239 This function returns the 64-bit unsigned quotient.
241 @param Dividend A 64-bit unsigned value.
242 @param Divisor A 32-bit unsigned value.
243 @param Remainder A pointer to a 32-bit unsigned value. This parameter is
244 optional and may be NULL.
246 @return Dividend / Divisor
251 InternalMathDivRemU64x32 (
254 OUT UINT32
*Remainder OPTIONAL
258 Divides a 64-bit unsigned integer by a 64-bit unsigned integer and
259 generates a 64-bit unsigned result and an optional 64-bit unsigned remainder.
261 This function divides the 64-bit unsigned value Dividend by the 64-bit
262 unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder
263 is not NULL, then the 64-bit unsigned remainder is returned in Remainder.
264 This function returns the 64-bit unsigned quotient.
266 @param Dividend A 64-bit unsigned value.
267 @param Divisor A 64-bit unsigned value.
268 @param Remainder A pointer to a 64-bit unsigned value. This parameter is
269 optional and may be NULL.
271 @return Dividend / Divisor
276 InternalMathDivRemU64x64 (
279 OUT UINT64
*Remainder OPTIONAL
283 Divides a 64-bit signed integer by a 64-bit signed integer and
284 generates a 64-bit signed result and an optional 64-bit signed remainder.
286 This function divides the 64-bit signed value Dividend by the 64-bit
287 signed value Divisor and generates a 64-bit signed quotient. If Remainder
288 is not NULL, then the 64-bit signed remainder is returned in Remainder.
289 This function returns the 64-bit signed quotient.
291 @param Dividend A 64-bit signed value.
292 @param Divisor A 64-bit signed value.
293 @param Remainder A pointer to a 64-bit signed value. This parameter is
294 optional and may be NULL.
296 @return Dividend / Divisor
301 InternalMathDivRemS64x64 (
304 OUT INT64
*Remainder OPTIONAL
308 Transfers control to a function starting with a new stack.
310 Transfers control to the function specified by EntryPoint using the
311 new stack specified by NewStack and passing in the parameters specified
312 by Context1 and Context2. Context1 and Context2 are optional and may
313 be NULL. The function EntryPoint must never return.
314 Marker will be ignored on IA-32, x64, and EBC.
315 IPF CPUs expect one additional parameter of type VOID * that specifies
316 the new backing store pointer.
318 If EntryPoint is NULL, then ASSERT().
319 If NewStack is NULL, then ASSERT().
321 @param EntryPoint A pointer to function to call with the new stack.
322 @param Context1 A pointer to the context to pass into the EntryPoint
324 @param Context2 A pointer to the context to pass into the EntryPoint
326 @param NewStack A pointer to the new stack to use for the EntryPoint
328 @param Marker VA_LIST marker for the variable argument list.
333 InternalSwitchStack (
334 IN SWITCH_STACK_ENTRY_POINT EntryPoint
,
335 IN VOID
*Context1
, OPTIONAL
336 IN VOID
*Context2
, OPTIONAL
343 Worker function that locates the Node in the List.
345 By searching the List, finds the location of the Node in List. At the same time,
346 verifies the validity of this list.
348 If List is NULL, then ASSERT().
349 If List->ForwardLink is NULL, then ASSERT().
350 If List->backLink is NULL, then ASSERT().
351 If Node is NULL, then ASSERT();
352 If PcdMaximumLinkedListLength is not zero, and prior to insertion the number
353 of nodes in ListHead, including the ListHead node, is greater than or
354 equal to PcdMaximumLinkedListLength, then ASSERT().
356 @param List A pointer to a node in a linked list.
357 @param Node A pointer to one nod.
359 @retval TRUE Node is in List.
360 @retval FALSE Node isn't in List, or List is invalid.
366 IN CONST LIST_ENTRY
*List
,
367 IN CONST LIST_ENTRY
*Node
371 Worker function that returns a bit field from Operand.
373 Returns the bitfield specified by the StartBit and the EndBit from Operand.
375 @param Operand Operand on which to perform the bitfield operation.
376 @param StartBit The ordinal of the least significant bit in the bit field.
377 @param EndBit The ordinal of the most significant bit in the bit field.
379 @return The bit field read.
392 Worker function that reads a bit field from Operand, performs a bitwise OR,
393 and returns the result.
395 Performs a bitwise OR between the bit field specified by StartBit and EndBit
396 in Operand and the value specified by AndData. All other bits in Operand are
397 preserved. The new value is returned.
399 @param Operand Operand on which to perform the bitfield operation.
400 @param StartBit The ordinal of the least significant bit in the bit field.
401 @param EndBit The ordinal of the most significant bit in the bit field.
402 @param OrData The value to OR with the read value from the value
404 @return The new value.
418 Worker function that reads a bit field from Operand, performs a bitwise AND,
419 and returns the result.
421 Performs a bitwise AND between the bit field specified by StartBit and EndBit
422 in Operand and the value specified by AndData. All other bits in Operand are
423 preserved. The new value is returned.
425 @param Operand Operand on which to perform the bitfield operation.
426 @param StartBit The ordinal of the least significant bit in the bit field.
427 @param EndBit The ordinal of the most significant bit in the bit field.
428 @param AndData The value to And with the read value from the value
430 @return The new value.
444 Worker function that checks ASSERT condition for JumpBuffer
446 Checks ASSERT condition for JumpBuffer.
448 If JumpBuffer is NULL, then ASSERT().
449 For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT().
451 @param JumpBuffer A pointer to CPU context buffer.
456 InternalAssertJumpBuffer (
457 IN BASE_LIBRARY_JUMP_BUFFER
*JumpBuffer
462 Restores the CPU context that was saved with SetJump().
464 Restores the CPU context from the buffer specified by JumpBuffer.
465 This function never returns to the caller.
466 Instead is resumes execution based on the state of JumpBuffer.
468 @param JumpBuffer A pointer to CPU context buffer.
469 @param Value The value to return when the SetJump() context is restored.
475 IN BASE_LIBRARY_JUMP_BUFFER
*JumpBuffer
,
481 Check if a Unicode character is a decimal character.
483 This internal function checks if a Unicode character is a
484 decimal character. The valid decimal character is from
487 @param Char The character to check against.
489 @retval TRUE If the Char is a decmial character.
490 @retval FALSE If the Char is not a decmial character.
495 InternalIsDecimalDigitCharacter (
501 Convert a Unicode character to upper case only if
502 it maps to a valid small-case ASCII character.
504 This internal function only deal with Unicode character
505 which maps to a valid small-case ASCII character, i.e.
506 L'a' to L'z'. For other Unicode character, the input character
507 is returned directly.
509 @param Char The character to convert.
511 @retval LowerCharacter If the Char is with range L'a' to L'z'.
512 @retval Unchanged Otherwise.
517 InternalCharToUpper (
523 Convert a Unicode character to numerical value.
525 This internal function only deal with Unicode character
526 which maps to a valid hexadecimal ASII character, i.e.
527 L'0' to L'9', L'a' to L'f' or L'A' to L'F'. For other
528 Unicode character, the value returned does not make sense.
530 @param Char The character to convert.
532 @return The numerical value converted.
537 InternalHexCharToUintn (
543 Check if a Unicode character is a hexadecimal character.
545 This internal function checks if a Unicode character is a
546 decimal character. The valid hexadecimal character is
547 L'0' to L'9', L'a' to L'f', or L'A' to L'F'.
550 @param Char The character to check against.
552 @retval TRUE If the Char is a hexadecmial character.
553 @retval FALSE If the Char is not a hexadecmial character.
558 InternalIsHexaDecimalDigitCharacter (
564 Check if a ASCII character is a decimal character.
566 This internal function checks if a Unicode character is a
567 decimal character. The valid decimal character is from
570 @param Char The character to check against.
572 @retval TRUE If the Char is a decmial character.
573 @retval FALSE If the Char is not a decmial character.
578 InternalAsciiIsDecimalDigitCharacter (
584 Converts a lowercase Ascii character to upper one.
586 If Chr is lowercase Ascii character, then converts it to upper one.
588 If Value >= 0xA0, then ASSERT().
589 If (Value & 0x0F) >= 0x0A, then ASSERT().
591 @param Chr one Ascii character
593 @return The uppercase value of Ascii character
598 InternalBaseLibAsciiToUpper (
604 Check if a ASCII character is a hexadecimal character.
606 This internal function checks if a ASCII character is a
607 decimal character. The valid hexadecimal character is
608 L'0' to L'9', L'a' to L'f', or L'A' to L'F'.
611 @param Char The character to check against.
613 @retval TRUE If the Char is a hexadecmial character.
614 @retval FALSE If the Char is not a hexadecmial character.
619 InternalAsciiIsHexaDecimalDigitCharacter (
625 Convert a ASCII character to numerical value.
627 This internal function only deal with Unicode character
628 which maps to a valid hexadecimal ASII character, i.e.
629 '0' to '9', 'a' to 'f' or 'A' to 'F'. For other
630 ASCII character, the value returned does not make sense.
632 @param Char The character to convert.
634 @return The numerical value converted.
639 InternalAsciiHexCharToUintn (
645 // Ia32 and x64 specific functions
647 #if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
650 Reads the current Global Descriptor Table Register(GDTR) descriptor.
652 Reads and returns the current GDTR descriptor and returns it in Gdtr. This
653 function is only available on IA-32 and x64.
655 @param Gdtr The pointer to a GDTR descriptor.
660 InternalX86ReadGdtr (
661 OUT IA32_DESCRIPTOR
*Gdtr
665 Writes the current Global Descriptor Table Register (GDTR) descriptor.
667 Writes and the current GDTR descriptor specified by Gdtr. This function is
668 only available on IA-32 and x64.
670 @param Gdtr The pointer to a GDTR descriptor.
675 InternalX86WriteGdtr (
676 IN CONST IA32_DESCRIPTOR
*Gdtr
680 Reads the current Interrupt Descriptor Table Register(GDTR) descriptor.
682 Reads and returns the current IDTR descriptor and returns it in Idtr. This
683 function is only available on IA-32 and x64.
685 @param Idtr The pointer to an IDTR descriptor.
690 InternalX86ReadIdtr (
691 OUT IA32_DESCRIPTOR
*Idtr
695 Writes the current Interrupt Descriptor Table Register(GDTR) descriptor.
697 Writes the current IDTR descriptor and returns it in Idtr. This function is
698 only available on IA-32 and x64.
700 @param Idtr The pointer to an IDTR descriptor.
705 InternalX86WriteIdtr (
706 IN CONST IA32_DESCRIPTOR
*Idtr
710 Save the current floating point/SSE/SSE2 context to a buffer.
712 Saves the current floating point/SSE/SSE2 state to the buffer specified by
713 Buffer. Buffer must be aligned on a 16-byte boundary. This function is only
714 available on IA-32 and x64.
716 @param Buffer The pointer to a buffer to save the floating point/SSE/SSE2 context.
722 OUT IA32_FX_BUFFER
*Buffer
726 Restores the current floating point/SSE/SSE2 context from a buffer.
728 Restores the current floating point/SSE/SSE2 state from the buffer specified
729 by Buffer. Buffer must be aligned on a 16-byte boundary. This function is
730 only available on IA-32 and x64.
732 @param Buffer The pointer to a buffer to save the floating point/SSE/SSE2 context.
737 InternalX86FxRestore (
738 IN CONST IA32_FX_BUFFER
*Buffer
742 Enables the 32-bit paging mode on the CPU.
744 Enables the 32-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables
745 must be properly initialized prior to calling this service. This function
746 assumes the current execution mode is 32-bit protected mode. This function is
747 only available on IA-32. After the 32-bit paging mode is enabled, control is
748 transferred to the function specified by EntryPoint using the new stack
749 specified by NewStack and passing in the parameters specified by Context1 and
750 Context2. Context1 and Context2 are optional and may be NULL. The function
751 EntryPoint must never return.
753 There are a number of constraints that must be followed before calling this
755 1) Interrupts must be disabled.
756 2) The caller must be in 32-bit protected mode with flat descriptors. This
757 means all descriptors must have a base of 0 and a limit of 4GB.
758 3) CR0 and CR4 must be compatible with 32-bit protected mode with flat
760 4) CR3 must point to valid page tables that will be used once the transition
761 is complete, and those page tables must guarantee that the pages for this
762 function and the stack are identity mapped.
764 @param EntryPoint A pointer to function to call with the new stack after
766 @param Context1 A pointer to the context to pass into the EntryPoint
767 function as the first parameter after paging is enabled.
768 @param Context2 A pointer to the context to pass into the EntryPoint
769 function as the second parameter after paging is enabled.
770 @param NewStack A pointer to the new stack to use for the EntryPoint
771 function after paging is enabled.
776 InternalX86EnablePaging32 (
777 IN SWITCH_STACK_ENTRY_POINT EntryPoint
,
778 IN VOID
*Context1
, OPTIONAL
779 IN VOID
*Context2
, OPTIONAL
784 Disables the 32-bit paging mode on the CPU.
786 Disables the 32-bit paging mode on the CPU and returns to 32-bit protected
787 mode. This function assumes the current execution mode is 32-paged protected
788 mode. This function is only available on IA-32. After the 32-bit paging mode
789 is disabled, control is transferred to the function specified by EntryPoint
790 using the new stack specified by NewStack and passing in the parameters
791 specified by Context1 and Context2. Context1 and Context2 are optional and
792 may be NULL. The function EntryPoint must never return.
794 There are a number of constraints that must be followed before calling this
796 1) Interrupts must be disabled.
797 2) The caller must be in 32-bit paged mode.
798 3) CR0, CR3, and CR4 must be compatible with 32-bit paged mode.
799 4) CR3 must point to valid page tables that guarantee that the pages for
800 this function and the stack are identity mapped.
802 @param EntryPoint A pointer to function to call with the new stack after
804 @param Context1 A pointer to the context to pass into the EntryPoint
805 function as the first parameter after paging is disabled.
806 @param Context2 A pointer to the context to pass into the EntryPoint
807 function as the second parameter after paging is
809 @param NewStack A pointer to the new stack to use for the EntryPoint
810 function after paging is disabled.
815 InternalX86DisablePaging32 (
816 IN SWITCH_STACK_ENTRY_POINT EntryPoint
,
817 IN VOID
*Context1
, OPTIONAL
818 IN VOID
*Context2
, OPTIONAL
823 Enables the 64-bit paging mode on the CPU.
825 Enables the 64-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables
826 must be properly initialized prior to calling this service. This function
827 assumes the current execution mode is 32-bit protected mode with flat
828 descriptors. This function is only available on IA-32. After the 64-bit
829 paging mode is enabled, control is transferred to the function specified by
830 EntryPoint using the new stack specified by NewStack and passing in the
831 parameters specified by Context1 and Context2. Context1 and Context2 are
832 optional and may be 0. The function EntryPoint must never return.
834 @param Cs The 16-bit selector to load in the CS before EntryPoint
835 is called. The descriptor in the GDT that this selector
836 references must be setup for long mode.
837 @param EntryPoint The 64-bit virtual address of the function to call with
838 the new stack after paging is enabled.
839 @param Context1 The 64-bit virtual address of the context to pass into
840 the EntryPoint function as the first parameter after
842 @param Context2 The 64-bit virtual address of the context to pass into
843 the EntryPoint function as the second parameter after
845 @param NewStack The 64-bit virtual address of the new stack to use for
846 the EntryPoint function after paging is enabled.
851 InternalX86EnablePaging64 (
853 IN UINT64 EntryPoint
,
854 IN UINT64 Context1
, OPTIONAL
855 IN UINT64 Context2
, OPTIONAL
860 Disables the 64-bit paging mode on the CPU.
862 Disables the 64-bit paging mode on the CPU and returns to 32-bit protected
863 mode. This function assumes the current execution mode is 64-paging mode.
864 This function is only available on x64. After the 64-bit paging mode is
865 disabled, control is transferred to the function specified by EntryPoint
866 using the new stack specified by NewStack and passing in the parameters
867 specified by Context1 and Context2. Context1 and Context2 are optional and
868 may be 0. The function EntryPoint must never return.
870 @param Cs The 16-bit selector to load in the CS before EntryPoint
871 is called. The descriptor in the GDT that this selector
872 references must be setup for 32-bit protected mode.
873 @param EntryPoint The 64-bit virtual address of the function to call with
874 the new stack after paging is disabled.
875 @param Context1 The 64-bit virtual address of the context to pass into
876 the EntryPoint function as the first parameter after
878 @param Context2 The 64-bit virtual address of the context to pass into
879 the EntryPoint function as the second parameter after
881 @param NewStack The 64-bit virtual address of the new stack to use for
882 the EntryPoint function after paging is disabled.
887 InternalX86DisablePaging64 (
889 IN UINT32 EntryPoint
,
890 IN UINT32 Context1
, OPTIONAL
891 IN UINT32 Context2
, OPTIONAL
896 Generates a 16-bit random number through RDRAND instruction.
898 @param[out] Rand Buffer pointer to store the random result.
900 @retval TRUE RDRAND call was successful.
901 @retval FALSE Failed attempts to call RDRAND.
906 InternalX86RdRand16 (
911 Generates a 32-bit random number through RDRAND instruction.
913 @param[out] Rand Buffer pointer to store the random result.
915 @retval TRUE RDRAND call was successful.
916 @retval FALSE Failed attempts to call RDRAND.
921 InternalX86RdRand32 (
926 Generates a 64-bit random number through RDRAND instruction.
929 @param[out] Rand Buffer pointer to store the random result.
931 @retval TRUE RDRAND call was successful.
932 @retval FALSE Failed attempts to call RDRAND.
937 InternalX86RdRand64 (
942 #elif defined (MDE_CPU_IPF)
945 // IPF specific functions
949 Reads control register DCR.
951 This is a worker function for AsmReadControlRegister()
952 when its parameter Index is IPF_CONTROL_REGISTER_DCR.
954 @return The 64-bit control register DCR.
959 AsmReadControlRegisterDcr (
965 Reads control register ITM.
967 This is a worker function for AsmReadControlRegister()
968 when its parameter Index is IPF_CONTROL_REGISTER_ITM.
970 @return The 64-bit control register ITM.
975 AsmReadControlRegisterItm (
981 Reads control register IVA.
983 This is a worker function for AsmReadControlRegister()
984 when its parameter Index is IPF_CONTROL_REGISTER_IVA.
986 @return The 64-bit control register IVA.
991 AsmReadControlRegisterIva (
997 Reads control register PTA.
999 This is a worker function for AsmReadControlRegister()
1000 when its parameter Index is IPF_CONTROL_REGISTER_PTA.
1002 @return The 64-bit control register PTA.
1007 AsmReadControlRegisterPta (
1013 Reads control register IPSR.
1015 This is a worker function for AsmReadControlRegister()
1016 when its parameter Index is IPF_CONTROL_REGISTER_IPSR.
1018 @return The 64-bit control register IPSR.
1023 AsmReadControlRegisterIpsr (
1029 Reads control register ISR.
1031 This is a worker function for AsmReadControlRegister()
1032 when its parameter Index is IPF_CONTROL_REGISTER_ISR.
1034 @return The 64-bit control register ISR.
1039 AsmReadControlRegisterIsr (
1045 Reads control register IIP.
1047 This is a worker function for AsmReadControlRegister()
1048 when its parameter Index is IPF_CONTROL_REGISTER_IIP.
1050 @return The 64-bit control register IIP.
1055 AsmReadControlRegisterIip (
1061 Reads control register IFA.
1063 This is a worker function for AsmReadControlRegister()
1064 when its parameter Index is IPF_CONTROL_REGISTER_IFA.
1066 @return The 64-bit control register IFA.
1071 AsmReadControlRegisterIfa (
1077 Reads control register ITIR.
1079 This is a worker function for AsmReadControlRegister()
1080 when its parameter Index is IPF_CONTROL_REGISTER_ITIR.
1082 @return The 64-bit control register ITIR.
1087 AsmReadControlRegisterItir (
1093 Reads control register IIPA.
1095 This is a worker function for AsmReadControlRegister()
1096 when its parameter Index is IPF_CONTROL_REGISTER_IIPA.
1098 @return The 64-bit control register IIPA.
1103 AsmReadControlRegisterIipa (
1109 Reads control register IFS.
1111 This is a worker function for AsmReadControlRegister()
1112 when its parameter Index is IPF_CONTROL_REGISTER_IFS.
1114 @return The 64-bit control register IFS.
1119 AsmReadControlRegisterIfs (
1125 Reads control register IIM.
1127 This is a worker function for AsmReadControlRegister()
1128 when its parameter Index is IPF_CONTROL_REGISTER_IIM.
1130 @return The 64-bit control register IIM.
1135 AsmReadControlRegisterIim (
1141 Reads control register IHA.
1143 This is a worker function for AsmReadControlRegister()
1144 when its parameter Index is IPF_CONTROL_REGISTER_IHA.
1146 @return The 64-bit control register IHA.
1151 AsmReadControlRegisterIha (
1157 Reads control register LID.
1159 This is a worker function for AsmReadControlRegister()
1160 when its parameter Index is IPF_CONTROL_REGISTER_LID.
1162 @return The 64-bit control register LID.
1167 AsmReadControlRegisterLid (
1173 Reads control register IVR.
1175 This is a worker function for AsmReadControlRegister()
1176 when its parameter Index is IPF_CONTROL_REGISTER_IVR.
1178 @return The 64-bit control register IVR.
1183 AsmReadControlRegisterIvr (
1189 Reads control register TPR.
1191 This is a worker function for AsmReadControlRegister()
1192 when its parameter Index is IPF_CONTROL_REGISTER_TPR.
1194 @return The 64-bit control register TPR.
1199 AsmReadControlRegisterTpr (
1205 Reads control register EOI.
1207 This is a worker function for AsmReadControlRegister()
1208 when its parameter Index is IPF_CONTROL_REGISTER_EOI.
1210 @return The 64-bit control register EOI.
1215 AsmReadControlRegisterEoi (
1221 Reads control register IRR0.
1223 This is a worker function for AsmReadControlRegister()
1224 when its parameter Index is IPF_CONTROL_REGISTER_IRR0.
1226 @return The 64-bit control register IRR0.
1231 AsmReadControlRegisterIrr0 (
1237 Reads control register IRR1.
1239 This is a worker function for AsmReadControlRegister()
1240 when its parameter Index is IPF_CONTROL_REGISTER_IRR1.
1242 @return The 64-bit control register IRR1.
1247 AsmReadControlRegisterIrr1 (
1253 Reads control register IRR2.
1255 This is a worker function for AsmReadControlRegister()
1256 when its parameter Index is IPF_CONTROL_REGISTER_IRR2.
1258 @return The 64-bit control register IRR2.
1263 AsmReadControlRegisterIrr2 (
1269 Reads control register IRR3.
1271 This is a worker function for AsmReadControlRegister()
1272 when its parameter Index is IPF_CONTROL_REGISTER_IRR3.
1274 @return The 64-bit control register IRR3.
1279 AsmReadControlRegisterIrr3 (
1285 Reads control register ITV.
1287 This is a worker function for AsmReadControlRegister()
1288 when its parameter Index is IPF_CONTROL_REGISTER_ITV.
1290 @return The 64-bit control register ITV.
1295 AsmReadControlRegisterItv (
1301 Reads control register PMV.
1303 This is a worker function for AsmReadControlRegister()
1304 when its parameter Index is IPF_CONTROL_REGISTER_PMV.
1306 @return The 64-bit control register PMV.
1311 AsmReadControlRegisterPmv (
1317 Reads control register CMCV.
1319 This is a worker function for AsmReadControlRegister()
1320 when its parameter Index is IPF_CONTROL_REGISTER_CMCV.
1322 @return The 64-bit control register CMCV.
1327 AsmReadControlRegisterCmcv (
1333 Reads control register LRR0.
1335 This is a worker function for AsmReadControlRegister()
1336 when its parameter Index is IPF_CONTROL_REGISTER_LRR0.
1338 @return The 64-bit control register LRR0.
1343 AsmReadControlRegisterLrr0 (
1349 Reads control register LRR1.
1351 This is a worker function for AsmReadControlRegister()
1352 when its parameter Index is IPF_CONTROL_REGISTER_LRR1.
1354 @return The 64-bit control register LRR1.
1359 AsmReadControlRegisterLrr1 (
1365 Reads application register K0.
1367 This is a worker function for AsmReadApplicationRegister()
1368 when its parameter Index is IPF_APPLICATION_REGISTER_K0.
1370 @return The 64-bit application register K0.
1375 AsmReadApplicationRegisterK0 (
1382 Reads application register K1.
1384 This is a worker function for AsmReadApplicationRegister()
1385 when its parameter Index is IPF_APPLICATION_REGISTER_K1.
1387 @return The 64-bit application register K1.
1392 AsmReadApplicationRegisterK1 (
1398 Reads application register K2.
1400 This is a worker function for AsmReadApplicationRegister()
1401 when its parameter Index is IPF_APPLICATION_REGISTER_K2.
1403 @return The 64-bit application register K2.
1408 AsmReadApplicationRegisterK2 (
1414 Reads application register K3.
1416 This is a worker function for AsmReadApplicationRegister()
1417 when its parameter Index is IPF_APPLICATION_REGISTER_K3.
1419 @return The 64-bit application register K3.
1424 AsmReadApplicationRegisterK3 (
1430 Reads application register K4.
1432 This is a worker function for AsmReadApplicationRegister()
1433 when its parameter Index is IPF_APPLICATION_REGISTER_K4.
1435 @return The 64-bit application register K4.
1440 AsmReadApplicationRegisterK4 (
1446 Reads application register K5.
1448 This is a worker function for AsmReadApplicationRegister()
1449 when its parameter Index is IPF_APPLICATION_REGISTER_K5.
1451 @return The 64-bit application register K5.
1456 AsmReadApplicationRegisterK5 (
1462 Reads application register K6.
1464 This is a worker function for AsmReadApplicationRegister()
1465 when its parameter Index is IPF_APPLICATION_REGISTER_K6.
1467 @return The 64-bit application register K6.
1472 AsmReadApplicationRegisterK6 (
1478 Reads application register K7.
1480 This is a worker function for AsmReadApplicationRegister()
1481 when its parameter Index is IPF_APPLICATION_REGISTER_K7.
1483 @return The 64-bit application register K7.
1488 AsmReadApplicationRegisterK7 (
1494 Reads application register RSC.
1496 This is a worker function for AsmReadApplicationRegister()
1497 when its parameter Index is IPF_APPLICATION_REGISTER_RSC.
1499 @return The 64-bit application register RSC.
1504 AsmReadApplicationRegisterRsc (
1510 Reads application register BSP.
1512 This is a worker function for AsmReadApplicationRegister()
1513 when its parameter Index is IPF_APPLICATION_REGISTER_BSP.
1515 @return The 64-bit application register BSP.
1520 AsmReadApplicationRegisterBsp (
1526 Reads application register BSPSTORE.
1528 This is a worker function for AsmReadApplicationRegister()
1529 when its parameter Index is IPF_APPLICATION_REGISTER_BSPSTORE.
1531 @return The 64-bit application register BSPSTORE.
1536 AsmReadApplicationRegisterBspstore (
1542 Reads application register RNAT.
1544 This is a worker function for AsmReadApplicationRegister()
1545 when its parameter Index is IPF_APPLICATION_REGISTER_RNAT.
1547 @return The 64-bit application register RNAT.
1552 AsmReadApplicationRegisterRnat (
1558 Reads application register FCR.
1560 This is a worker function for AsmReadApplicationRegister()
1561 when its parameter Index is IPF_APPLICATION_REGISTER_FCR.
1563 @return The 64-bit application register FCR.
1568 AsmReadApplicationRegisterFcr (
1574 Reads application register EFLAG.
1576 This is a worker function for AsmReadApplicationRegister()
1577 when its parameter Index is IPF_APPLICATION_REGISTER_EFLAG.
1579 @return The 64-bit application register EFLAG.
1584 AsmReadApplicationRegisterEflag (
1590 Reads application register CSD.
1592 This is a worker function for AsmReadApplicationRegister()
1593 when its parameter Index is IPF_APPLICATION_REGISTER_CSD.
1595 @return The 64-bit application register CSD.
1600 AsmReadApplicationRegisterCsd (
1606 Reads application register SSD.
1608 This is a worker function for AsmReadApplicationRegister()
1609 when its parameter Index is IPF_APPLICATION_REGISTER_SSD.
1611 @return The 64-bit application register SSD.
1616 AsmReadApplicationRegisterSsd (
1622 Reads application register CFLG.
1624 This is a worker function for AsmReadApplicationRegister()
1625 when its parameter Index is IPF_APPLICATION_REGISTER_CFLG.
1627 @return The 64-bit application register CFLG.
1632 AsmReadApplicationRegisterCflg (
1638 Reads application register FSR.
1640 This is a worker function for AsmReadApplicationRegister()
1641 when its parameter Index is IPF_APPLICATION_REGISTER_FSR.
1643 @return The 64-bit application register FSR.
1648 AsmReadApplicationRegisterFsr (
1654 Reads application register FIR.
1656 This is a worker function for AsmReadApplicationRegister()
1657 when its parameter Index is IPF_APPLICATION_REGISTER_FIR.
1659 @return The 64-bit application register FIR.
1664 AsmReadApplicationRegisterFir (
1670 Reads application register FDR.
1672 This is a worker function for AsmReadApplicationRegister()
1673 when its parameter Index is IPF_APPLICATION_REGISTER_FDR.
1675 @return The 64-bit application register FDR.
1680 AsmReadApplicationRegisterFdr (
1686 Reads application register CCV.
1688 This is a worker function for AsmReadApplicationRegister()
1689 when its parameter Index is IPF_APPLICATION_REGISTER_CCV.
1691 @return The 64-bit application register CCV.
1696 AsmReadApplicationRegisterCcv (
1702 Reads application register UNAT.
1704 This is a worker function for AsmReadApplicationRegister()
1705 when its parameter Index is IPF_APPLICATION_REGISTER_UNAT.
1707 @return The 64-bit application register UNAT.
1712 AsmReadApplicationRegisterUnat (
1718 Reads application register FPSR.
1720 This is a worker function for AsmReadApplicationRegister()
1721 when its parameter Index is IPF_APPLICATION_REGISTER_FPSR.
1723 @return The 64-bit application register FPSR.
1728 AsmReadApplicationRegisterFpsr (
1734 Reads application register ITC.
1736 This is a worker function for AsmReadApplicationRegister()
1737 when its parameter Index is IPF_APPLICATION_REGISTER_ITC.
1739 @return The 64-bit application register ITC.
1744 AsmReadApplicationRegisterItc (
1750 Reads application register PFS.
1752 This is a worker function for AsmReadApplicationRegister()
1753 when its parameter Index is IPF_APPLICATION_REGISTER_PFS.
1755 @return The 64-bit application register PFS.
1760 AsmReadApplicationRegisterPfs (
1766 Reads application register LC.
1768 This is a worker function for AsmReadApplicationRegister()
1769 when its parameter Index is IPF_APPLICATION_REGISTER_LC.
1771 @return The 64-bit application register LC.
1776 AsmReadApplicationRegisterLc (
1782 Reads application register EC.
1784 This is a worker function for AsmReadApplicationRegister()
1785 when its parameter Index is IPF_APPLICATION_REGISTER_EC.
1787 @return The 64-bit application register EC.
1792 AsmReadApplicationRegisterEc (
1799 Transfers control to a function starting with a new stack.
1801 Transfers control to the function specified by EntryPoint using the new stack
1802 specified by NewStack and passing in the parameters specified by Context1 and
1803 Context2. Context1 and Context2 are optional and may be NULL. The function
1804 EntryPoint must never return.
1806 If EntryPoint is NULL, then ASSERT().
1807 If NewStack is NULL, then ASSERT().
1809 @param EntryPoint A pointer to function to call with the new stack.
1810 @param Context1 A pointer to the context to pass into the EntryPoint
1812 @param Context2 A pointer to the context to pass into the EntryPoint
1814 @param NewStack A pointer to the new stack to use for the EntryPoint
1816 @param NewBsp A pointer to the new memory location for RSE backing
1822 AsmSwitchStackAndBackingStore (
1823 IN SWITCH_STACK_ENTRY_POINT EntryPoint
,
1824 IN VOID
*Context1
, OPTIONAL
1825 IN VOID
*Context2
, OPTIONAL
1831 Internal worker function to invalidate a range of instruction cache lines
1832 in the cache coherency domain of the calling CPU.
1834 Internal worker function to invalidate the instruction cache lines specified
1835 by Address and Length. If Address is not aligned on a cache line boundary,
1836 then entire instruction cache line containing Address is invalidated. If
1837 Address + Length is not aligned on a cache line boundary, then the entire
1838 instruction cache line containing Address + Length -1 is invalidated. This
1839 function may choose to invalidate the entire instruction cache if that is more
1840 efficient than invalidating the specified range. If Length is 0, the no instruction
1841 cache lines are invalidated. Address is returned.
1842 This function is only available on IPF.
1844 @param Address The base address of the instruction cache lines to
1845 invalidate. If the CPU is in a physical addressing mode, then
1846 Address is a physical address. If the CPU is in a virtual
1847 addressing mode, then Address is a virtual address.
1849 @param Length The number of bytes to invalidate from the instruction cache.
1856 InternalFlushCacheRange (