]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/BaseLibInternals.h
MdePkg/BasePrintLib: Refine the SPrint functions
[mirror_edk2.git] / MdePkg / Library / BaseLib / BaseLibInternals.h
1 /** @file
2 Declaration of internal functions in BaseLib.
3
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.
9
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.
12
13 **/
14
15 #ifndef __BASE_LIB_INTERNALS__
16 #define __BASE_LIB_INTERNALS__
17
18 #include <Base.h>
19 #include <Library/BaseLib.h>
20 #include <Library/BaseMemoryLib.h>
21 #include <Library/DebugLib.h>
22 #include <Library/PcdLib.h>
23
24 //
25 // Math functions
26 //
27
28 /**
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.
31
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.
34
35 @param Operand The 64-bit operand to shift left.
36 @param Count The number of bits to shift left.
37
38 @return Operand << Count
39
40 **/
41 UINT64
42 EFIAPI
43 InternalMathLShiftU64 (
44 IN UINT64 Operand,
45 IN UINTN Count
46 );
47
48 /**
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.
51
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.
54
55 @param Operand The 64-bit operand to shift right.
56 @param Count The number of bits to shift right.
57
58 @return Operand >> Count
59
60 **/
61 UINT64
62 EFIAPI
63 InternalMathRShiftU64 (
64 IN UINT64 Operand,
65 IN UINTN Count
66 );
67
68 /**
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.
71
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.
74
75 @param Operand The 64-bit operand to shift right.
76 @param Count The number of bits to shift right.
77
78 @return Operand arithmetically shifted right by Count
79
80 **/
81 UINT64
82 EFIAPI
83 InternalMathARShiftU64 (
84 IN UINT64 Operand,
85 IN UINTN Count
86 );
87
88 /**
89 Rotates a 64-bit integer left between 0 and 63 bits, filling
90 the low bits with the high bits that were rotated.
91
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
94 value is returned.
95
96 @param Operand The 64-bit operand to rotate left.
97 @param Count The number of bits to rotate left.
98
99 @return Operand <<< Count
100
101 **/
102 UINT64
103 EFIAPI
104 InternalMathLRotU64 (
105 IN UINT64 Operand,
106 IN UINTN Count
107 );
108
109 /**
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.
112
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
115 value is returned.
116
117 @param Operand The 64-bit operand to rotate right.
118 @param Count The number of bits to rotate right.
119
120 @return Operand >>> Count
121
122 **/
123 UINT64
124 EFIAPI
125 InternalMathRRotU64 (
126 IN UINT64 Operand,
127 IN UINTN Count
128 );
129
130 /**
131 Switches the endianess of a 64-bit integer.
132
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
135 returned.
136
137 @param Operand A 64-bit unsigned value.
138
139 @return The byte swapped Operand.
140
141 **/
142 UINT64
143 EFIAPI
144 InternalMathSwapBytes64 (
145 IN UINT64 Operand
146 );
147
148 /**
149 Multiplies a 64-bit unsigned integer by a 32-bit unsigned integer
150 and generates a 64-bit unsigned result.
151
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.
155
156 @param Multiplicand A 64-bit unsigned value.
157 @param Multiplier A 32-bit unsigned value.
158
159 @return Multiplicand * Multiplier
160
161 **/
162 UINT64
163 EFIAPI
164 InternalMathMultU64x32 (
165 IN UINT64 Multiplicand,
166 IN UINT32 Multiplier
167 );
168
169 /**
170 Multiplies a 64-bit unsigned integer by a 64-bit unsigned integer
171 and generates a 64-bit unsigned result.
172
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.
176
177 @param Multiplicand A 64-bit unsigned value.
178 @param Multiplier A 64-bit unsigned value.
179
180 @return Multiplicand * Multiplier
181
182 **/
183 UINT64
184 EFIAPI
185 InternalMathMultU64x64 (
186 IN UINT64 Multiplicand,
187 IN UINT64 Multiplier
188 );
189
190 /**
191 Divides a 64-bit unsigned integer by a 32-bit unsigned integer and
192 generates a 64-bit unsigned result.
193
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.
197
198 @param Dividend A 64-bit unsigned value.
199 @param Divisor A 32-bit unsigned value.
200
201 @return Dividend / Divisor
202
203 **/
204 UINT64
205 EFIAPI
206 InternalMathDivU64x32 (
207 IN UINT64 Dividend,
208 IN UINT32 Divisor
209 );
210
211 /**
212 Divides a 64-bit unsigned integer by a 32-bit unsigned integer and
213 generates a 32-bit unsigned remainder.
214
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.
218
219 @param Dividend A 64-bit unsigned value.
220 @param Divisor A 32-bit unsigned value.
221
222 @return Dividend % Divisor
223
224 **/
225 UINT32
226 EFIAPI
227 InternalMathModU64x32 (
228 IN UINT64 Dividend,
229 IN UINT32 Divisor
230 );
231
232 /**
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.
235
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.
240
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.
245
246 @return Dividend / Divisor
247
248 **/
249 UINT64
250 EFIAPI
251 InternalMathDivRemU64x32 (
252 IN UINT64 Dividend,
253 IN UINT32 Divisor,
254 OUT UINT32 *Remainder OPTIONAL
255 );
256
257 /**
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.
260
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.
265
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.
270
271 @return Dividend / Divisor
272
273 **/
274 UINT64
275 EFIAPI
276 InternalMathDivRemU64x64 (
277 IN UINT64 Dividend,
278 IN UINT64 Divisor,
279 OUT UINT64 *Remainder OPTIONAL
280 );
281
282 /**
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.
285
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.
290
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.
295
296 @return Dividend / Divisor
297
298 **/
299 INT64
300 EFIAPI
301 InternalMathDivRemS64x64 (
302 IN INT64 Dividend,
303 IN INT64 Divisor,
304 OUT INT64 *Remainder OPTIONAL
305 );
306
307 /**
308 Transfers control to a function starting with a new stack.
309
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.
317
318 If EntryPoint is NULL, then ASSERT().
319 If NewStack is NULL, then ASSERT().
320
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
323 function.
324 @param Context2 A pointer to the context to pass into the EntryPoint
325 function.
326 @param NewStack A pointer to the new stack to use for the EntryPoint
327 function.
328 @param Marker VA_LIST marker for the variable argument list.
329
330 **/
331 VOID
332 EFIAPI
333 InternalSwitchStack (
334 IN SWITCH_STACK_ENTRY_POINT EntryPoint,
335 IN VOID *Context1, OPTIONAL
336 IN VOID *Context2, OPTIONAL
337 IN VOID *NewStack,
338 IN VA_LIST Marker
339 );
340
341
342 /**
343 Worker function that locates the Node in the List.
344
345 By searching the List, finds the location of the Node in List. At the same time,
346 verifies the validity of this list.
347
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().
355
356 @param List A pointer to a node in a linked list.
357 @param Node A pointer to one nod.
358
359 @retval TRUE Node is in List.
360 @retval FALSE Node isn't in List, or List is invalid.
361
362 **/
363 BOOLEAN
364 EFIAPI
365 IsNodeInList (
366 IN CONST LIST_ENTRY *List,
367 IN CONST LIST_ENTRY *Node
368 );
369
370 /**
371 Worker function that returns a bit field from Operand.
372
373 Returns the bitfield specified by the StartBit and the EndBit from Operand.
374
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.
378
379 @return The bit field read.
380
381 **/
382 UINTN
383 EFIAPI
384 BitFieldReadUint (
385 IN UINTN Operand,
386 IN UINTN StartBit,
387 IN UINTN EndBit
388 );
389
390
391 /**
392 Worker function that reads a bit field from Operand, performs a bitwise OR,
393 and returns the result.
394
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.
398
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
403
404 @return The new value.
405
406 **/
407 UINTN
408 EFIAPI
409 BitFieldOrUint (
410 IN UINTN Operand,
411 IN UINTN StartBit,
412 IN UINTN EndBit,
413 IN UINTN OrData
414 );
415
416
417 /**
418 Worker function that reads a bit field from Operand, performs a bitwise AND,
419 and returns the result.
420
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.
424
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
429
430 @return The new value.
431
432 **/
433 UINTN
434 EFIAPI
435 BitFieldAndUint (
436 IN UINTN Operand,
437 IN UINTN StartBit,
438 IN UINTN EndBit,
439 IN UINTN AndData
440 );
441
442
443 /**
444 Worker function that checks ASSERT condition for JumpBuffer
445
446 Checks ASSERT condition for JumpBuffer.
447
448 If JumpBuffer is NULL, then ASSERT().
449 For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT().
450
451 @param JumpBuffer A pointer to CPU context buffer.
452
453 **/
454 VOID
455 EFIAPI
456 InternalAssertJumpBuffer (
457 IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer
458 );
459
460
461 /**
462 Restores the CPU context that was saved with SetJump().
463
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.
467
468 @param JumpBuffer A pointer to CPU context buffer.
469 @param Value The value to return when the SetJump() context is restored.
470
471 **/
472 VOID
473 EFIAPI
474 InternalLongJump (
475 IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer,
476 IN UINTN Value
477 );
478
479
480 /**
481 Check if a Unicode character is a decimal character.
482
483 This internal function checks if a Unicode character is a
484 decimal character. The valid decimal character is from
485 L'0' to L'9'.
486
487 @param Char The character to check against.
488
489 @retval TRUE If the Char is a decmial character.
490 @retval FALSE If the Char is not a decmial character.
491
492 **/
493 BOOLEAN
494 EFIAPI
495 InternalIsDecimalDigitCharacter (
496 IN CHAR16 Char
497 );
498
499
500 /**
501 Convert a Unicode character to upper case only if
502 it maps to a valid small-case ASCII character.
503
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.
508
509 @param Char The character to convert.
510
511 @retval LowerCharacter If the Char is with range L'a' to L'z'.
512 @retval Unchanged Otherwise.
513
514 **/
515 CHAR16
516 EFIAPI
517 InternalCharToUpper (
518 IN CHAR16 Char
519 );
520
521
522 /**
523 Convert a Unicode character to numerical value.
524
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.
529
530 @param Char The character to convert.
531
532 @return The numerical value converted.
533
534 **/
535 UINTN
536 EFIAPI
537 InternalHexCharToUintn (
538 IN CHAR16 Char
539 );
540
541
542 /**
543 Check if a Unicode character is a hexadecimal character.
544
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'.
548
549
550 @param Char The character to check against.
551
552 @retval TRUE If the Char is a hexadecmial character.
553 @retval FALSE If the Char is not a hexadecmial character.
554
555 **/
556 BOOLEAN
557 EFIAPI
558 InternalIsHexaDecimalDigitCharacter (
559 IN CHAR16 Char
560 );
561
562
563 /**
564 Check if a ASCII character is a decimal character.
565
566 This internal function checks if a Unicode character is a
567 decimal character. The valid decimal character is from
568 '0' to '9'.
569
570 @param Char The character to check against.
571
572 @retval TRUE If the Char is a decmial character.
573 @retval FALSE If the Char is not a decmial character.
574
575 **/
576 BOOLEAN
577 EFIAPI
578 InternalAsciiIsDecimalDigitCharacter (
579 IN CHAR8 Char
580 );
581
582
583 /**
584 Converts a lowercase Ascii character to upper one.
585
586 If Chr is lowercase Ascii character, then converts it to upper one.
587
588 If Value >= 0xA0, then ASSERT().
589 If (Value & 0x0F) >= 0x0A, then ASSERT().
590
591 @param Chr one Ascii character
592
593 @return The uppercase value of Ascii character
594
595 **/
596 CHAR8
597 EFIAPI
598 InternalBaseLibAsciiToUpper (
599 IN CHAR8 Chr
600 );
601
602
603 /**
604 Check if a ASCII character is a hexadecimal character.
605
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'.
609
610
611 @param Char The character to check against.
612
613 @retval TRUE If the Char is a hexadecmial character.
614 @retval FALSE If the Char is not a hexadecmial character.
615
616 **/
617 BOOLEAN
618 EFIAPI
619 InternalAsciiIsHexaDecimalDigitCharacter (
620 IN CHAR8 Char
621 );
622
623
624 /**
625 Convert a ASCII character to numerical value.
626
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.
631
632 @param Char The character to convert.
633
634 @return The numerical value converted.
635
636 **/
637 UINTN
638 EFIAPI
639 InternalAsciiHexCharToUintn (
640 IN CHAR8 Char
641 );
642
643
644 //
645 // Ia32 and x64 specific functions
646 //
647 #if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
648
649 /**
650 Reads the current Global Descriptor Table Register(GDTR) descriptor.
651
652 Reads and returns the current GDTR descriptor and returns it in Gdtr. This
653 function is only available on IA-32 and x64.
654
655 @param Gdtr The pointer to a GDTR descriptor.
656
657 **/
658 VOID
659 EFIAPI
660 InternalX86ReadGdtr (
661 OUT IA32_DESCRIPTOR *Gdtr
662 );
663
664 /**
665 Writes the current Global Descriptor Table Register (GDTR) descriptor.
666
667 Writes and the current GDTR descriptor specified by Gdtr. This function is
668 only available on IA-32 and x64.
669
670 @param Gdtr The pointer to a GDTR descriptor.
671
672 **/
673 VOID
674 EFIAPI
675 InternalX86WriteGdtr (
676 IN CONST IA32_DESCRIPTOR *Gdtr
677 );
678
679 /**
680 Reads the current Interrupt Descriptor Table Register(GDTR) descriptor.
681
682 Reads and returns the current IDTR descriptor and returns it in Idtr. This
683 function is only available on IA-32 and x64.
684
685 @param Idtr The pointer to an IDTR descriptor.
686
687 **/
688 VOID
689 EFIAPI
690 InternalX86ReadIdtr (
691 OUT IA32_DESCRIPTOR *Idtr
692 );
693
694 /**
695 Writes the current Interrupt Descriptor Table Register(GDTR) descriptor.
696
697 Writes the current IDTR descriptor and returns it in Idtr. This function is
698 only available on IA-32 and x64.
699
700 @param Idtr The pointer to an IDTR descriptor.
701
702 **/
703 VOID
704 EFIAPI
705 InternalX86WriteIdtr (
706 IN CONST IA32_DESCRIPTOR *Idtr
707 );
708
709 /**
710 Save the current floating point/SSE/SSE2 context to a buffer.
711
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.
715
716 @param Buffer The pointer to a buffer to save the floating point/SSE/SSE2 context.
717
718 **/
719 VOID
720 EFIAPI
721 InternalX86FxSave (
722 OUT IA32_FX_BUFFER *Buffer
723 );
724
725 /**
726 Restores the current floating point/SSE/SSE2 context from a buffer.
727
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.
731
732 @param Buffer The pointer to a buffer to save the floating point/SSE/SSE2 context.
733
734 **/
735 VOID
736 EFIAPI
737 InternalX86FxRestore (
738 IN CONST IA32_FX_BUFFER *Buffer
739 );
740
741 /**
742 Enables the 32-bit paging mode on the CPU.
743
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.
752
753 There are a number of constraints that must be followed before calling this
754 function:
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
759 descriptors.
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.
763
764 @param EntryPoint A pointer to function to call with the new stack after
765 paging is enabled.
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.
772
773 **/
774 VOID
775 EFIAPI
776 InternalX86EnablePaging32 (
777 IN SWITCH_STACK_ENTRY_POINT EntryPoint,
778 IN VOID *Context1, OPTIONAL
779 IN VOID *Context2, OPTIONAL
780 IN VOID *NewStack
781 );
782
783 /**
784 Disables the 32-bit paging mode on the CPU.
785
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.
793
794 There are a number of constraints that must be followed before calling this
795 function:
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.
801
802 @param EntryPoint A pointer to function to call with the new stack after
803 paging is disabled.
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
808 disabled.
809 @param NewStack A pointer to the new stack to use for the EntryPoint
810 function after paging is disabled.
811
812 **/
813 VOID
814 EFIAPI
815 InternalX86DisablePaging32 (
816 IN SWITCH_STACK_ENTRY_POINT EntryPoint,
817 IN VOID *Context1, OPTIONAL
818 IN VOID *Context2, OPTIONAL
819 IN VOID *NewStack
820 );
821
822 /**
823 Enables the 64-bit paging mode on the CPU.
824
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.
833
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
841 paging is enabled.
842 @param Context2 The 64-bit virtual address of the context to pass into
843 the EntryPoint function as the second parameter after
844 paging is enabled.
845 @param NewStack The 64-bit virtual address of the new stack to use for
846 the EntryPoint function after paging is enabled.
847
848 **/
849 VOID
850 EFIAPI
851 InternalX86EnablePaging64 (
852 IN UINT16 Cs,
853 IN UINT64 EntryPoint,
854 IN UINT64 Context1, OPTIONAL
855 IN UINT64 Context2, OPTIONAL
856 IN UINT64 NewStack
857 );
858
859 /**
860 Disables the 64-bit paging mode on the CPU.
861
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.
869
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
877 paging is disabled.
878 @param Context2 The 64-bit virtual address of the context to pass into
879 the EntryPoint function as the second parameter after
880 paging is disabled.
881 @param NewStack The 64-bit virtual address of the new stack to use for
882 the EntryPoint function after paging is disabled.
883
884 **/
885 VOID
886 EFIAPI
887 InternalX86DisablePaging64 (
888 IN UINT16 Cs,
889 IN UINT32 EntryPoint,
890 IN UINT32 Context1, OPTIONAL
891 IN UINT32 Context2, OPTIONAL
892 IN UINT32 NewStack
893 );
894
895 /**
896 Generates a 16-bit random number through RDRAND instruction.
897
898 @param[out] Rand Buffer pointer to store the random result.
899
900 @retval TRUE RDRAND call was successful.
901 @retval FALSE Failed attempts to call RDRAND.
902
903 **/
904 BOOLEAN
905 EFIAPI
906 InternalX86RdRand16 (
907 OUT UINT16 *Rand
908 );
909
910 /**
911 Generates a 32-bit random number through RDRAND instruction.
912
913 @param[out] Rand Buffer pointer to store the random result.
914
915 @retval TRUE RDRAND call was successful.
916 @retval FALSE Failed attempts to call RDRAND.
917
918 **/
919 BOOLEAN
920 EFIAPI
921 InternalX86RdRand32 (
922 OUT UINT32 *Rand
923 );
924
925 /**
926 Generates a 64-bit random number through RDRAND instruction.
927
928
929 @param[out] Rand Buffer pointer to store the random result.
930
931 @retval TRUE RDRAND call was successful.
932 @retval FALSE Failed attempts to call RDRAND.
933
934 **/
935 BOOLEAN
936 EFIAPI
937 InternalX86RdRand64 (
938 OUT UINT64 *Rand
939 );
940
941
942 #elif defined (MDE_CPU_IPF)
943 //
944 //
945 // IPF specific functions
946 //
947
948 /**
949 Reads control register DCR.
950
951 This is a worker function for AsmReadControlRegister()
952 when its parameter Index is IPF_CONTROL_REGISTER_DCR.
953
954 @return The 64-bit control register DCR.
955
956 **/
957 UINT64
958 EFIAPI
959 AsmReadControlRegisterDcr (
960 VOID
961 );
962
963
964 /**
965 Reads control register ITM.
966
967 This is a worker function for AsmReadControlRegister()
968 when its parameter Index is IPF_CONTROL_REGISTER_ITM.
969
970 @return The 64-bit control register ITM.
971
972 **/
973 UINT64
974 EFIAPI
975 AsmReadControlRegisterItm (
976 VOID
977 );
978
979
980 /**
981 Reads control register IVA.
982
983 This is a worker function for AsmReadControlRegister()
984 when its parameter Index is IPF_CONTROL_REGISTER_IVA.
985
986 @return The 64-bit control register IVA.
987
988 **/
989 UINT64
990 EFIAPI
991 AsmReadControlRegisterIva (
992 VOID
993 );
994
995
996 /**
997 Reads control register PTA.
998
999 This is a worker function for AsmReadControlRegister()
1000 when its parameter Index is IPF_CONTROL_REGISTER_PTA.
1001
1002 @return The 64-bit control register PTA.
1003
1004 **/
1005 UINT64
1006 EFIAPI
1007 AsmReadControlRegisterPta (
1008 VOID
1009 );
1010
1011
1012 /**
1013 Reads control register IPSR.
1014
1015 This is a worker function for AsmReadControlRegister()
1016 when its parameter Index is IPF_CONTROL_REGISTER_IPSR.
1017
1018 @return The 64-bit control register IPSR.
1019
1020 **/
1021 UINT64
1022 EFIAPI
1023 AsmReadControlRegisterIpsr (
1024 VOID
1025 );
1026
1027
1028 /**
1029 Reads control register ISR.
1030
1031 This is a worker function for AsmReadControlRegister()
1032 when its parameter Index is IPF_CONTROL_REGISTER_ISR.
1033
1034 @return The 64-bit control register ISR.
1035
1036 **/
1037 UINT64
1038 EFIAPI
1039 AsmReadControlRegisterIsr (
1040 VOID
1041 );
1042
1043
1044 /**
1045 Reads control register IIP.
1046
1047 This is a worker function for AsmReadControlRegister()
1048 when its parameter Index is IPF_CONTROL_REGISTER_IIP.
1049
1050 @return The 64-bit control register IIP.
1051
1052 **/
1053 UINT64
1054 EFIAPI
1055 AsmReadControlRegisterIip (
1056 VOID
1057 );
1058
1059
1060 /**
1061 Reads control register IFA.
1062
1063 This is a worker function for AsmReadControlRegister()
1064 when its parameter Index is IPF_CONTROL_REGISTER_IFA.
1065
1066 @return The 64-bit control register IFA.
1067
1068 **/
1069 UINT64
1070 EFIAPI
1071 AsmReadControlRegisterIfa (
1072 VOID
1073 );
1074
1075
1076 /**
1077 Reads control register ITIR.
1078
1079 This is a worker function for AsmReadControlRegister()
1080 when its parameter Index is IPF_CONTROL_REGISTER_ITIR.
1081
1082 @return The 64-bit control register ITIR.
1083
1084 **/
1085 UINT64
1086 EFIAPI
1087 AsmReadControlRegisterItir (
1088 VOID
1089 );
1090
1091
1092 /**
1093 Reads control register IIPA.
1094
1095 This is a worker function for AsmReadControlRegister()
1096 when its parameter Index is IPF_CONTROL_REGISTER_IIPA.
1097
1098 @return The 64-bit control register IIPA.
1099
1100 **/
1101 UINT64
1102 EFIAPI
1103 AsmReadControlRegisterIipa (
1104 VOID
1105 );
1106
1107
1108 /**
1109 Reads control register IFS.
1110
1111 This is a worker function for AsmReadControlRegister()
1112 when its parameter Index is IPF_CONTROL_REGISTER_IFS.
1113
1114 @return The 64-bit control register IFS.
1115
1116 **/
1117 UINT64
1118 EFIAPI
1119 AsmReadControlRegisterIfs (
1120 VOID
1121 );
1122
1123
1124 /**
1125 Reads control register IIM.
1126
1127 This is a worker function for AsmReadControlRegister()
1128 when its parameter Index is IPF_CONTROL_REGISTER_IIM.
1129
1130 @return The 64-bit control register IIM.
1131
1132 **/
1133 UINT64
1134 EFIAPI
1135 AsmReadControlRegisterIim (
1136 VOID
1137 );
1138
1139
1140 /**
1141 Reads control register IHA.
1142
1143 This is a worker function for AsmReadControlRegister()
1144 when its parameter Index is IPF_CONTROL_REGISTER_IHA.
1145
1146 @return The 64-bit control register IHA.
1147
1148 **/
1149 UINT64
1150 EFIAPI
1151 AsmReadControlRegisterIha (
1152 VOID
1153 );
1154
1155
1156 /**
1157 Reads control register LID.
1158
1159 This is a worker function for AsmReadControlRegister()
1160 when its parameter Index is IPF_CONTROL_REGISTER_LID.
1161
1162 @return The 64-bit control register LID.
1163
1164 **/
1165 UINT64
1166 EFIAPI
1167 AsmReadControlRegisterLid (
1168 VOID
1169 );
1170
1171
1172 /**
1173 Reads control register IVR.
1174
1175 This is a worker function for AsmReadControlRegister()
1176 when its parameter Index is IPF_CONTROL_REGISTER_IVR.
1177
1178 @return The 64-bit control register IVR.
1179
1180 **/
1181 UINT64
1182 EFIAPI
1183 AsmReadControlRegisterIvr (
1184 VOID
1185 );
1186
1187
1188 /**
1189 Reads control register TPR.
1190
1191 This is a worker function for AsmReadControlRegister()
1192 when its parameter Index is IPF_CONTROL_REGISTER_TPR.
1193
1194 @return The 64-bit control register TPR.
1195
1196 **/
1197 UINT64
1198 EFIAPI
1199 AsmReadControlRegisterTpr (
1200 VOID
1201 );
1202
1203
1204 /**
1205 Reads control register EOI.
1206
1207 This is a worker function for AsmReadControlRegister()
1208 when its parameter Index is IPF_CONTROL_REGISTER_EOI.
1209
1210 @return The 64-bit control register EOI.
1211
1212 **/
1213 UINT64
1214 EFIAPI
1215 AsmReadControlRegisterEoi (
1216 VOID
1217 );
1218
1219
1220 /**
1221 Reads control register IRR0.
1222
1223 This is a worker function for AsmReadControlRegister()
1224 when its parameter Index is IPF_CONTROL_REGISTER_IRR0.
1225
1226 @return The 64-bit control register IRR0.
1227
1228 **/
1229 UINT64
1230 EFIAPI
1231 AsmReadControlRegisterIrr0 (
1232 VOID
1233 );
1234
1235
1236 /**
1237 Reads control register IRR1.
1238
1239 This is a worker function for AsmReadControlRegister()
1240 when its parameter Index is IPF_CONTROL_REGISTER_IRR1.
1241
1242 @return The 64-bit control register IRR1.
1243
1244 **/
1245 UINT64
1246 EFIAPI
1247 AsmReadControlRegisterIrr1 (
1248 VOID
1249 );
1250
1251
1252 /**
1253 Reads control register IRR2.
1254
1255 This is a worker function for AsmReadControlRegister()
1256 when its parameter Index is IPF_CONTROL_REGISTER_IRR2.
1257
1258 @return The 64-bit control register IRR2.
1259
1260 **/
1261 UINT64
1262 EFIAPI
1263 AsmReadControlRegisterIrr2 (
1264 VOID
1265 );
1266
1267
1268 /**
1269 Reads control register IRR3.
1270
1271 This is a worker function for AsmReadControlRegister()
1272 when its parameter Index is IPF_CONTROL_REGISTER_IRR3.
1273
1274 @return The 64-bit control register IRR3.
1275
1276 **/
1277 UINT64
1278 EFIAPI
1279 AsmReadControlRegisterIrr3 (
1280 VOID
1281 );
1282
1283
1284 /**
1285 Reads control register ITV.
1286
1287 This is a worker function for AsmReadControlRegister()
1288 when its parameter Index is IPF_CONTROL_REGISTER_ITV.
1289
1290 @return The 64-bit control register ITV.
1291
1292 **/
1293 UINT64
1294 EFIAPI
1295 AsmReadControlRegisterItv (
1296 VOID
1297 );
1298
1299
1300 /**
1301 Reads control register PMV.
1302
1303 This is a worker function for AsmReadControlRegister()
1304 when its parameter Index is IPF_CONTROL_REGISTER_PMV.
1305
1306 @return The 64-bit control register PMV.
1307
1308 **/
1309 UINT64
1310 EFIAPI
1311 AsmReadControlRegisterPmv (
1312 VOID
1313 );
1314
1315
1316 /**
1317 Reads control register CMCV.
1318
1319 This is a worker function for AsmReadControlRegister()
1320 when its parameter Index is IPF_CONTROL_REGISTER_CMCV.
1321
1322 @return The 64-bit control register CMCV.
1323
1324 **/
1325 UINT64
1326 EFIAPI
1327 AsmReadControlRegisterCmcv (
1328 VOID
1329 );
1330
1331
1332 /**
1333 Reads control register LRR0.
1334
1335 This is a worker function for AsmReadControlRegister()
1336 when its parameter Index is IPF_CONTROL_REGISTER_LRR0.
1337
1338 @return The 64-bit control register LRR0.
1339
1340 **/
1341 UINT64
1342 EFIAPI
1343 AsmReadControlRegisterLrr0 (
1344 VOID
1345 );
1346
1347
1348 /**
1349 Reads control register LRR1.
1350
1351 This is a worker function for AsmReadControlRegister()
1352 when its parameter Index is IPF_CONTROL_REGISTER_LRR1.
1353
1354 @return The 64-bit control register LRR1.
1355
1356 **/
1357 UINT64
1358 EFIAPI
1359 AsmReadControlRegisterLrr1 (
1360 VOID
1361 );
1362
1363
1364 /**
1365 Reads application register K0.
1366
1367 This is a worker function for AsmReadApplicationRegister()
1368 when its parameter Index is IPF_APPLICATION_REGISTER_K0.
1369
1370 @return The 64-bit application register K0.
1371
1372 **/
1373 UINT64
1374 EFIAPI
1375 AsmReadApplicationRegisterK0 (
1376 VOID
1377 );
1378
1379
1380
1381 /**
1382 Reads application register K1.
1383
1384 This is a worker function for AsmReadApplicationRegister()
1385 when its parameter Index is IPF_APPLICATION_REGISTER_K1.
1386
1387 @return The 64-bit application register K1.
1388
1389 **/
1390 UINT64
1391 EFIAPI
1392 AsmReadApplicationRegisterK1 (
1393 VOID
1394 );
1395
1396
1397 /**
1398 Reads application register K2.
1399
1400 This is a worker function for AsmReadApplicationRegister()
1401 when its parameter Index is IPF_APPLICATION_REGISTER_K2.
1402
1403 @return The 64-bit application register K2.
1404
1405 **/
1406 UINT64
1407 EFIAPI
1408 AsmReadApplicationRegisterK2 (
1409 VOID
1410 );
1411
1412
1413 /**
1414 Reads application register K3.
1415
1416 This is a worker function for AsmReadApplicationRegister()
1417 when its parameter Index is IPF_APPLICATION_REGISTER_K3.
1418
1419 @return The 64-bit application register K3.
1420
1421 **/
1422 UINT64
1423 EFIAPI
1424 AsmReadApplicationRegisterK3 (
1425 VOID
1426 );
1427
1428
1429 /**
1430 Reads application register K4.
1431
1432 This is a worker function for AsmReadApplicationRegister()
1433 when its parameter Index is IPF_APPLICATION_REGISTER_K4.
1434
1435 @return The 64-bit application register K4.
1436
1437 **/
1438 UINT64
1439 EFIAPI
1440 AsmReadApplicationRegisterK4 (
1441 VOID
1442 );
1443
1444
1445 /**
1446 Reads application register K5.
1447
1448 This is a worker function for AsmReadApplicationRegister()
1449 when its parameter Index is IPF_APPLICATION_REGISTER_K5.
1450
1451 @return The 64-bit application register K5.
1452
1453 **/
1454 UINT64
1455 EFIAPI
1456 AsmReadApplicationRegisterK5 (
1457 VOID
1458 );
1459
1460
1461 /**
1462 Reads application register K6.
1463
1464 This is a worker function for AsmReadApplicationRegister()
1465 when its parameter Index is IPF_APPLICATION_REGISTER_K6.
1466
1467 @return The 64-bit application register K6.
1468
1469 **/
1470 UINT64
1471 EFIAPI
1472 AsmReadApplicationRegisterK6 (
1473 VOID
1474 );
1475
1476
1477 /**
1478 Reads application register K7.
1479
1480 This is a worker function for AsmReadApplicationRegister()
1481 when its parameter Index is IPF_APPLICATION_REGISTER_K7.
1482
1483 @return The 64-bit application register K7.
1484
1485 **/
1486 UINT64
1487 EFIAPI
1488 AsmReadApplicationRegisterK7 (
1489 VOID
1490 );
1491
1492
1493 /**
1494 Reads application register RSC.
1495
1496 This is a worker function for AsmReadApplicationRegister()
1497 when its parameter Index is IPF_APPLICATION_REGISTER_RSC.
1498
1499 @return The 64-bit application register RSC.
1500
1501 **/
1502 UINT64
1503 EFIAPI
1504 AsmReadApplicationRegisterRsc (
1505 VOID
1506 );
1507
1508
1509 /**
1510 Reads application register BSP.
1511
1512 This is a worker function for AsmReadApplicationRegister()
1513 when its parameter Index is IPF_APPLICATION_REGISTER_BSP.
1514
1515 @return The 64-bit application register BSP.
1516
1517 **/
1518 UINT64
1519 EFIAPI
1520 AsmReadApplicationRegisterBsp (
1521 VOID
1522 );
1523
1524
1525 /**
1526 Reads application register BSPSTORE.
1527
1528 This is a worker function for AsmReadApplicationRegister()
1529 when its parameter Index is IPF_APPLICATION_REGISTER_BSPSTORE.
1530
1531 @return The 64-bit application register BSPSTORE.
1532
1533 **/
1534 UINT64
1535 EFIAPI
1536 AsmReadApplicationRegisterBspstore (
1537 VOID
1538 );
1539
1540
1541 /**
1542 Reads application register RNAT.
1543
1544 This is a worker function for AsmReadApplicationRegister()
1545 when its parameter Index is IPF_APPLICATION_REGISTER_RNAT.
1546
1547 @return The 64-bit application register RNAT.
1548
1549 **/
1550 UINT64
1551 EFIAPI
1552 AsmReadApplicationRegisterRnat (
1553 VOID
1554 );
1555
1556
1557 /**
1558 Reads application register FCR.
1559
1560 This is a worker function for AsmReadApplicationRegister()
1561 when its parameter Index is IPF_APPLICATION_REGISTER_FCR.
1562
1563 @return The 64-bit application register FCR.
1564
1565 **/
1566 UINT64
1567 EFIAPI
1568 AsmReadApplicationRegisterFcr (
1569 VOID
1570 );
1571
1572
1573 /**
1574 Reads application register EFLAG.
1575
1576 This is a worker function for AsmReadApplicationRegister()
1577 when its parameter Index is IPF_APPLICATION_REGISTER_EFLAG.
1578
1579 @return The 64-bit application register EFLAG.
1580
1581 **/
1582 UINT64
1583 EFIAPI
1584 AsmReadApplicationRegisterEflag (
1585 VOID
1586 );
1587
1588
1589 /**
1590 Reads application register CSD.
1591
1592 This is a worker function for AsmReadApplicationRegister()
1593 when its parameter Index is IPF_APPLICATION_REGISTER_CSD.
1594
1595 @return The 64-bit application register CSD.
1596
1597 **/
1598 UINT64
1599 EFIAPI
1600 AsmReadApplicationRegisterCsd (
1601 VOID
1602 );
1603
1604
1605 /**
1606 Reads application register SSD.
1607
1608 This is a worker function for AsmReadApplicationRegister()
1609 when its parameter Index is IPF_APPLICATION_REGISTER_SSD.
1610
1611 @return The 64-bit application register SSD.
1612
1613 **/
1614 UINT64
1615 EFIAPI
1616 AsmReadApplicationRegisterSsd (
1617 VOID
1618 );
1619
1620
1621 /**
1622 Reads application register CFLG.
1623
1624 This is a worker function for AsmReadApplicationRegister()
1625 when its parameter Index is IPF_APPLICATION_REGISTER_CFLG.
1626
1627 @return The 64-bit application register CFLG.
1628
1629 **/
1630 UINT64
1631 EFIAPI
1632 AsmReadApplicationRegisterCflg (
1633 VOID
1634 );
1635
1636
1637 /**
1638 Reads application register FSR.
1639
1640 This is a worker function for AsmReadApplicationRegister()
1641 when its parameter Index is IPF_APPLICATION_REGISTER_FSR.
1642
1643 @return The 64-bit application register FSR.
1644
1645 **/
1646 UINT64
1647 EFIAPI
1648 AsmReadApplicationRegisterFsr (
1649 VOID
1650 );
1651
1652
1653 /**
1654 Reads application register FIR.
1655
1656 This is a worker function for AsmReadApplicationRegister()
1657 when its parameter Index is IPF_APPLICATION_REGISTER_FIR.
1658
1659 @return The 64-bit application register FIR.
1660
1661 **/
1662 UINT64
1663 EFIAPI
1664 AsmReadApplicationRegisterFir (
1665 VOID
1666 );
1667
1668
1669 /**
1670 Reads application register FDR.
1671
1672 This is a worker function for AsmReadApplicationRegister()
1673 when its parameter Index is IPF_APPLICATION_REGISTER_FDR.
1674
1675 @return The 64-bit application register FDR.
1676
1677 **/
1678 UINT64
1679 EFIAPI
1680 AsmReadApplicationRegisterFdr (
1681 VOID
1682 );
1683
1684
1685 /**
1686 Reads application register CCV.
1687
1688 This is a worker function for AsmReadApplicationRegister()
1689 when its parameter Index is IPF_APPLICATION_REGISTER_CCV.
1690
1691 @return The 64-bit application register CCV.
1692
1693 **/
1694 UINT64
1695 EFIAPI
1696 AsmReadApplicationRegisterCcv (
1697 VOID
1698 );
1699
1700
1701 /**
1702 Reads application register UNAT.
1703
1704 This is a worker function for AsmReadApplicationRegister()
1705 when its parameter Index is IPF_APPLICATION_REGISTER_UNAT.
1706
1707 @return The 64-bit application register UNAT.
1708
1709 **/
1710 UINT64
1711 EFIAPI
1712 AsmReadApplicationRegisterUnat (
1713 VOID
1714 );
1715
1716
1717 /**
1718 Reads application register FPSR.
1719
1720 This is a worker function for AsmReadApplicationRegister()
1721 when its parameter Index is IPF_APPLICATION_REGISTER_FPSR.
1722
1723 @return The 64-bit application register FPSR.
1724
1725 **/
1726 UINT64
1727 EFIAPI
1728 AsmReadApplicationRegisterFpsr (
1729 VOID
1730 );
1731
1732
1733 /**
1734 Reads application register ITC.
1735
1736 This is a worker function for AsmReadApplicationRegister()
1737 when its parameter Index is IPF_APPLICATION_REGISTER_ITC.
1738
1739 @return The 64-bit application register ITC.
1740
1741 **/
1742 UINT64
1743 EFIAPI
1744 AsmReadApplicationRegisterItc (
1745 VOID
1746 );
1747
1748
1749 /**
1750 Reads application register PFS.
1751
1752 This is a worker function for AsmReadApplicationRegister()
1753 when its parameter Index is IPF_APPLICATION_REGISTER_PFS.
1754
1755 @return The 64-bit application register PFS.
1756
1757 **/
1758 UINT64
1759 EFIAPI
1760 AsmReadApplicationRegisterPfs (
1761 VOID
1762 );
1763
1764
1765 /**
1766 Reads application register LC.
1767
1768 This is a worker function for AsmReadApplicationRegister()
1769 when its parameter Index is IPF_APPLICATION_REGISTER_LC.
1770
1771 @return The 64-bit application register LC.
1772
1773 **/
1774 UINT64
1775 EFIAPI
1776 AsmReadApplicationRegisterLc (
1777 VOID
1778 );
1779
1780
1781 /**
1782 Reads application register EC.
1783
1784 This is a worker function for AsmReadApplicationRegister()
1785 when its parameter Index is IPF_APPLICATION_REGISTER_EC.
1786
1787 @return The 64-bit application register EC.
1788
1789 **/
1790 UINT64
1791 EFIAPI
1792 AsmReadApplicationRegisterEc (
1793 VOID
1794 );
1795
1796
1797
1798 /**
1799 Transfers control to a function starting with a new stack.
1800
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.
1805
1806 If EntryPoint is NULL, then ASSERT().
1807 If NewStack is NULL, then ASSERT().
1808
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
1811 function.
1812 @param Context2 A pointer to the context to pass into the EntryPoint
1813 function.
1814 @param NewStack A pointer to the new stack to use for the EntryPoint
1815 function.
1816 @param NewBsp A pointer to the new memory location for RSE backing
1817 store.
1818
1819 **/
1820 VOID
1821 EFIAPI
1822 AsmSwitchStackAndBackingStore (
1823 IN SWITCH_STACK_ENTRY_POINT EntryPoint,
1824 IN VOID *Context1, OPTIONAL
1825 IN VOID *Context2, OPTIONAL
1826 IN VOID *NewStack,
1827 IN VOID *NewBsp
1828 );
1829
1830 /**
1831 Internal worker function to invalidate a range of instruction cache lines
1832 in the cache coherency domain of the calling CPU.
1833
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.
1843
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.
1848
1849 @param Length The number of bytes to invalidate from the instruction cache.
1850
1851 @return Address
1852
1853 **/
1854 VOID *
1855 EFIAPI
1856 InternalFlushCacheRange (
1857 IN VOID *Address,
1858 IN UINTN Length
1859 );
1860
1861 #else
1862
1863 #endif
1864
1865 #endif