]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/BaseLibInternals.h
MdePkg/BaseLib.h: state preprocessing conditions in comments after #endifs
[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 returns a bit field from Operand.
344
345 Returns the bitfield specified by the StartBit and the EndBit from Operand.
346
347 @param Operand Operand on which to perform the bitfield operation.
348 @param StartBit The ordinal of the least significant bit in the bit field.
349 @param EndBit The ordinal of the most significant bit in the bit field.
350
351 @return The bit field read.
352
353 **/
354 UINTN
355 EFIAPI
356 BitFieldReadUint (
357 IN UINTN Operand,
358 IN UINTN StartBit,
359 IN UINTN EndBit
360 );
361
362
363 /**
364 Worker function that reads a bit field from Operand, performs a bitwise OR,
365 and returns the result.
366
367 Performs a bitwise OR between the bit field specified by StartBit and EndBit
368 in Operand and the value specified by AndData. All other bits in Operand are
369 preserved. The new value is returned.
370
371 @param Operand Operand on which to perform the bitfield operation.
372 @param StartBit The ordinal of the least significant bit in the bit field.
373 @param EndBit The ordinal of the most significant bit in the bit field.
374 @param OrData The value to OR with the read value from the value
375
376 @return The new value.
377
378 **/
379 UINTN
380 EFIAPI
381 BitFieldOrUint (
382 IN UINTN Operand,
383 IN UINTN StartBit,
384 IN UINTN EndBit,
385 IN UINTN OrData
386 );
387
388
389 /**
390 Worker function that reads a bit field from Operand, performs a bitwise AND,
391 and returns the result.
392
393 Performs a bitwise AND between the bit field specified by StartBit and EndBit
394 in Operand and the value specified by AndData. All other bits in Operand are
395 preserved. The new value is returned.
396
397 @param Operand Operand on which to perform the bitfield operation.
398 @param StartBit The ordinal of the least significant bit in the bit field.
399 @param EndBit The ordinal of the most significant bit in the bit field.
400 @param AndData The value to And with the read value from the value
401
402 @return The new value.
403
404 **/
405 UINTN
406 EFIAPI
407 BitFieldAndUint (
408 IN UINTN Operand,
409 IN UINTN StartBit,
410 IN UINTN EndBit,
411 IN UINTN AndData
412 );
413
414
415 /**
416 Worker function that checks ASSERT condition for JumpBuffer
417
418 Checks ASSERT condition for JumpBuffer.
419
420 If JumpBuffer is NULL, then ASSERT().
421 For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT().
422
423 @param JumpBuffer A pointer to CPU context buffer.
424
425 **/
426 VOID
427 EFIAPI
428 InternalAssertJumpBuffer (
429 IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer
430 );
431
432
433 /**
434 Restores the CPU context that was saved with SetJump().
435
436 Restores the CPU context from the buffer specified by JumpBuffer.
437 This function never returns to the caller.
438 Instead is resumes execution based on the state of JumpBuffer.
439
440 @param JumpBuffer A pointer to CPU context buffer.
441 @param Value The value to return when the SetJump() context is restored.
442
443 **/
444 VOID
445 EFIAPI
446 InternalLongJump (
447 IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer,
448 IN UINTN Value
449 );
450
451
452 /**
453 Check if a Unicode character is a decimal character.
454
455 This internal function checks if a Unicode character is a
456 decimal character. The valid decimal character is from
457 L'0' to L'9'.
458
459 @param Char The character to check against.
460
461 @retval TRUE If the Char is a decmial character.
462 @retval FALSE If the Char is not a decmial character.
463
464 **/
465 BOOLEAN
466 EFIAPI
467 InternalIsDecimalDigitCharacter (
468 IN CHAR16 Char
469 );
470
471
472 /**
473 Convert a Unicode character to upper case only if
474 it maps to a valid small-case ASCII character.
475
476 This internal function only deal with Unicode character
477 which maps to a valid small-case ASCII character, i.e.
478 L'a' to L'z'. For other Unicode character, the input character
479 is returned directly.
480
481 @param Char The character to convert.
482
483 @retval LowerCharacter If the Char is with range L'a' to L'z'.
484 @retval Unchanged Otherwise.
485
486 **/
487 CHAR16
488 EFIAPI
489 InternalCharToUpper (
490 IN CHAR16 Char
491 );
492
493
494 /**
495 Convert a Unicode character to numerical value.
496
497 This internal function only deal with Unicode character
498 which maps to a valid hexadecimal ASII character, i.e.
499 L'0' to L'9', L'a' to L'f' or L'A' to L'F'. For other
500 Unicode character, the value returned does not make sense.
501
502 @param Char The character to convert.
503
504 @return The numerical value converted.
505
506 **/
507 UINTN
508 EFIAPI
509 InternalHexCharToUintn (
510 IN CHAR16 Char
511 );
512
513
514 /**
515 Check if a Unicode character is a hexadecimal character.
516
517 This internal function checks if a Unicode character is a
518 decimal character. The valid hexadecimal character is
519 L'0' to L'9', L'a' to L'f', or L'A' to L'F'.
520
521
522 @param Char The character to check against.
523
524 @retval TRUE If the Char is a hexadecmial character.
525 @retval FALSE If the Char is not a hexadecmial character.
526
527 **/
528 BOOLEAN
529 EFIAPI
530 InternalIsHexaDecimalDigitCharacter (
531 IN CHAR16 Char
532 );
533
534
535 /**
536 Check if a ASCII character is a decimal character.
537
538 This internal function checks if a Unicode character is a
539 decimal character. The valid decimal character is from
540 '0' to '9'.
541
542 @param Char The character to check against.
543
544 @retval TRUE If the Char is a decmial character.
545 @retval FALSE If the Char is not a decmial character.
546
547 **/
548 BOOLEAN
549 EFIAPI
550 InternalAsciiIsDecimalDigitCharacter (
551 IN CHAR8 Char
552 );
553
554
555 /**
556 Converts a lowercase Ascii character to upper one.
557
558 If Chr is lowercase Ascii character, then converts it to upper one.
559
560 If Value >= 0xA0, then ASSERT().
561 If (Value & 0x0F) >= 0x0A, then ASSERT().
562
563 @param Chr one Ascii character
564
565 @return The uppercase value of Ascii character
566
567 **/
568 CHAR8
569 EFIAPI
570 InternalBaseLibAsciiToUpper (
571 IN CHAR8 Chr
572 );
573
574
575 /**
576 Check if a ASCII character is a hexadecimal character.
577
578 This internal function checks if a ASCII character is a
579 decimal character. The valid hexadecimal character is
580 L'0' to L'9', L'a' to L'f', or L'A' to L'F'.
581
582
583 @param Char The character to check against.
584
585 @retval TRUE If the Char is a hexadecmial character.
586 @retval FALSE If the Char is not a hexadecmial character.
587
588 **/
589 BOOLEAN
590 EFIAPI
591 InternalAsciiIsHexaDecimalDigitCharacter (
592 IN CHAR8 Char
593 );
594
595
596 /**
597 Convert a ASCII character to numerical value.
598
599 This internal function only deal with Unicode character
600 which maps to a valid hexadecimal ASII character, i.e.
601 '0' to '9', 'a' to 'f' or 'A' to 'F'. For other
602 ASCII character, the value returned does not make sense.
603
604 @param Char The character to convert.
605
606 @return The numerical value converted.
607
608 **/
609 UINTN
610 EFIAPI
611 InternalAsciiHexCharToUintn (
612 IN CHAR8 Char
613 );
614
615
616 //
617 // Ia32 and x64 specific functions
618 //
619 #if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
620
621 /**
622 Reads the current Global Descriptor Table Register(GDTR) descriptor.
623
624 Reads and returns the current GDTR descriptor and returns it in Gdtr. This
625 function is only available on IA-32 and x64.
626
627 @param Gdtr The pointer to a GDTR descriptor.
628
629 **/
630 VOID
631 EFIAPI
632 InternalX86ReadGdtr (
633 OUT IA32_DESCRIPTOR *Gdtr
634 );
635
636 /**
637 Writes the current Global Descriptor Table Register (GDTR) descriptor.
638
639 Writes and the current GDTR descriptor specified by Gdtr. This function is
640 only available on IA-32 and x64.
641
642 @param Gdtr The pointer to a GDTR descriptor.
643
644 **/
645 VOID
646 EFIAPI
647 InternalX86WriteGdtr (
648 IN CONST IA32_DESCRIPTOR *Gdtr
649 );
650
651 /**
652 Reads the current Interrupt Descriptor Table Register(GDTR) descriptor.
653
654 Reads and returns the current IDTR descriptor and returns it in Idtr. This
655 function is only available on IA-32 and x64.
656
657 @param Idtr The pointer to an IDTR descriptor.
658
659 **/
660 VOID
661 EFIAPI
662 InternalX86ReadIdtr (
663 OUT IA32_DESCRIPTOR *Idtr
664 );
665
666 /**
667 Writes the current Interrupt Descriptor Table Register(GDTR) descriptor.
668
669 Writes the current IDTR descriptor and returns it in Idtr. This function is
670 only available on IA-32 and x64.
671
672 @param Idtr The pointer to an IDTR descriptor.
673
674 **/
675 VOID
676 EFIAPI
677 InternalX86WriteIdtr (
678 IN CONST IA32_DESCRIPTOR *Idtr
679 );
680
681 /**
682 Save the current floating point/SSE/SSE2 context to a buffer.
683
684 Saves the current floating point/SSE/SSE2 state to the buffer specified by
685 Buffer. Buffer must be aligned on a 16-byte boundary. This function is only
686 available on IA-32 and x64.
687
688 @param Buffer The pointer to a buffer to save the floating point/SSE/SSE2 context.
689
690 **/
691 VOID
692 EFIAPI
693 InternalX86FxSave (
694 OUT IA32_FX_BUFFER *Buffer
695 );
696
697 /**
698 Restores the current floating point/SSE/SSE2 context from a buffer.
699
700 Restores the current floating point/SSE/SSE2 state from the buffer specified
701 by Buffer. Buffer must be aligned on a 16-byte boundary. This function is
702 only available on IA-32 and x64.
703
704 @param Buffer The pointer to a buffer to save the floating point/SSE/SSE2 context.
705
706 **/
707 VOID
708 EFIAPI
709 InternalX86FxRestore (
710 IN CONST IA32_FX_BUFFER *Buffer
711 );
712
713 /**
714 Enables the 32-bit paging mode on the CPU.
715
716 Enables the 32-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables
717 must be properly initialized prior to calling this service. This function
718 assumes the current execution mode is 32-bit protected mode. This function is
719 only available on IA-32. After the 32-bit paging mode is enabled, control is
720 transferred to the function specified by EntryPoint using the new stack
721 specified by NewStack and passing in the parameters specified by Context1 and
722 Context2. Context1 and Context2 are optional and may be NULL. The function
723 EntryPoint must never return.
724
725 There are a number of constraints that must be followed before calling this
726 function:
727 1) Interrupts must be disabled.
728 2) The caller must be in 32-bit protected mode with flat descriptors. This
729 means all descriptors must have a base of 0 and a limit of 4GB.
730 3) CR0 and CR4 must be compatible with 32-bit protected mode with flat
731 descriptors.
732 4) CR3 must point to valid page tables that will be used once the transition
733 is complete, and those page tables must guarantee that the pages for this
734 function and the stack are identity mapped.
735
736 @param EntryPoint A pointer to function to call with the new stack after
737 paging is enabled.
738 @param Context1 A pointer to the context to pass into the EntryPoint
739 function as the first parameter after paging is enabled.
740 @param Context2 A pointer to the context to pass into the EntryPoint
741 function as the second parameter after paging is enabled.
742 @param NewStack A pointer to the new stack to use for the EntryPoint
743 function after paging is enabled.
744
745 **/
746 VOID
747 EFIAPI
748 InternalX86EnablePaging32 (
749 IN SWITCH_STACK_ENTRY_POINT EntryPoint,
750 IN VOID *Context1, OPTIONAL
751 IN VOID *Context2, OPTIONAL
752 IN VOID *NewStack
753 );
754
755 /**
756 Disables the 32-bit paging mode on the CPU.
757
758 Disables the 32-bit paging mode on the CPU and returns to 32-bit protected
759 mode. This function assumes the current execution mode is 32-paged protected
760 mode. This function is only available on IA-32. After the 32-bit paging mode
761 is disabled, control is transferred to the function specified by EntryPoint
762 using the new stack specified by NewStack and passing in the parameters
763 specified by Context1 and Context2. Context1 and Context2 are optional and
764 may be NULL. The function EntryPoint must never return.
765
766 There are a number of constraints that must be followed before calling this
767 function:
768 1) Interrupts must be disabled.
769 2) The caller must be in 32-bit paged mode.
770 3) CR0, CR3, and CR4 must be compatible with 32-bit paged mode.
771 4) CR3 must point to valid page tables that guarantee that the pages for
772 this function and the stack are identity mapped.
773
774 @param EntryPoint A pointer to function to call with the new stack after
775 paging is disabled.
776 @param Context1 A pointer to the context to pass into the EntryPoint
777 function as the first parameter after paging is disabled.
778 @param Context2 A pointer to the context to pass into the EntryPoint
779 function as the second parameter after paging is
780 disabled.
781 @param NewStack A pointer to the new stack to use for the EntryPoint
782 function after paging is disabled.
783
784 **/
785 VOID
786 EFIAPI
787 InternalX86DisablePaging32 (
788 IN SWITCH_STACK_ENTRY_POINT EntryPoint,
789 IN VOID *Context1, OPTIONAL
790 IN VOID *Context2, OPTIONAL
791 IN VOID *NewStack
792 );
793
794 /**
795 Enables the 64-bit paging mode on the CPU.
796
797 Enables the 64-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables
798 must be properly initialized prior to calling this service. This function
799 assumes the current execution mode is 32-bit protected mode with flat
800 descriptors. This function is only available on IA-32. After the 64-bit
801 paging mode is enabled, control is transferred to the function specified by
802 EntryPoint using the new stack specified by NewStack and passing in the
803 parameters specified by Context1 and Context2. Context1 and Context2 are
804 optional and may be 0. The function EntryPoint must never return.
805
806 @param Cs The 16-bit selector to load in the CS before EntryPoint
807 is called. The descriptor in the GDT that this selector
808 references must be setup for long mode.
809 @param EntryPoint The 64-bit virtual address of the function to call with
810 the new stack after paging is enabled.
811 @param Context1 The 64-bit virtual address of the context to pass into
812 the EntryPoint function as the first parameter after
813 paging is enabled.
814 @param Context2 The 64-bit virtual address of the context to pass into
815 the EntryPoint function as the second parameter after
816 paging is enabled.
817 @param NewStack The 64-bit virtual address of the new stack to use for
818 the EntryPoint function after paging is enabled.
819
820 **/
821 VOID
822 EFIAPI
823 InternalX86EnablePaging64 (
824 IN UINT16 Cs,
825 IN UINT64 EntryPoint,
826 IN UINT64 Context1, OPTIONAL
827 IN UINT64 Context2, OPTIONAL
828 IN UINT64 NewStack
829 );
830
831 /**
832 Disables the 64-bit paging mode on the CPU.
833
834 Disables the 64-bit paging mode on the CPU and returns to 32-bit protected
835 mode. This function assumes the current execution mode is 64-paging mode.
836 This function is only available on x64. After the 64-bit paging mode is
837 disabled, control is transferred to the function specified by EntryPoint
838 using the new stack specified by NewStack and passing in the parameters
839 specified by Context1 and Context2. Context1 and Context2 are optional and
840 may be 0. The function EntryPoint must never return.
841
842 @param Cs The 16-bit selector to load in the CS before EntryPoint
843 is called. The descriptor in the GDT that this selector
844 references must be setup for 32-bit protected mode.
845 @param EntryPoint The 64-bit virtual address of the function to call with
846 the new stack after paging is disabled.
847 @param Context1 The 64-bit virtual address of the context to pass into
848 the EntryPoint function as the first parameter after
849 paging is disabled.
850 @param Context2 The 64-bit virtual address of the context to pass into
851 the EntryPoint function as the second parameter after
852 paging is disabled.
853 @param NewStack The 64-bit virtual address of the new stack to use for
854 the EntryPoint function after paging is disabled.
855
856 **/
857 VOID
858 EFIAPI
859 InternalX86DisablePaging64 (
860 IN UINT16 Cs,
861 IN UINT32 EntryPoint,
862 IN UINT32 Context1, OPTIONAL
863 IN UINT32 Context2, OPTIONAL
864 IN UINT32 NewStack
865 );
866
867 /**
868 Generates a 16-bit random number through RDRAND instruction.
869
870 @param[out] Rand Buffer pointer to store the random result.
871
872 @retval TRUE RDRAND call was successful.
873 @retval FALSE Failed attempts to call RDRAND.
874
875 **/
876 BOOLEAN
877 EFIAPI
878 InternalX86RdRand16 (
879 OUT UINT16 *Rand
880 );
881
882 /**
883 Generates a 32-bit random number through RDRAND instruction.
884
885 @param[out] Rand Buffer pointer to store the random result.
886
887 @retval TRUE RDRAND call was successful.
888 @retval FALSE Failed attempts to call RDRAND.
889
890 **/
891 BOOLEAN
892 EFIAPI
893 InternalX86RdRand32 (
894 OUT UINT32 *Rand
895 );
896
897 /**
898 Generates a 64-bit random number through RDRAND instruction.
899
900
901 @param[out] Rand Buffer pointer to store the random result.
902
903 @retval TRUE RDRAND call was successful.
904 @retval FALSE Failed attempts to call RDRAND.
905
906 **/
907 BOOLEAN
908 EFIAPI
909 InternalX86RdRand64 (
910 OUT UINT64 *Rand
911 );
912
913
914 #elif defined (MDE_CPU_IPF)
915 //
916 //
917 // IPF specific functions
918 //
919
920 /**
921 Reads control register DCR.
922
923 This is a worker function for AsmReadControlRegister()
924 when its parameter Index is IPF_CONTROL_REGISTER_DCR.
925
926 @return The 64-bit control register DCR.
927
928 **/
929 UINT64
930 EFIAPI
931 AsmReadControlRegisterDcr (
932 VOID
933 );
934
935
936 /**
937 Reads control register ITM.
938
939 This is a worker function for AsmReadControlRegister()
940 when its parameter Index is IPF_CONTROL_REGISTER_ITM.
941
942 @return The 64-bit control register ITM.
943
944 **/
945 UINT64
946 EFIAPI
947 AsmReadControlRegisterItm (
948 VOID
949 );
950
951
952 /**
953 Reads control register IVA.
954
955 This is a worker function for AsmReadControlRegister()
956 when its parameter Index is IPF_CONTROL_REGISTER_IVA.
957
958 @return The 64-bit control register IVA.
959
960 **/
961 UINT64
962 EFIAPI
963 AsmReadControlRegisterIva (
964 VOID
965 );
966
967
968 /**
969 Reads control register PTA.
970
971 This is a worker function for AsmReadControlRegister()
972 when its parameter Index is IPF_CONTROL_REGISTER_PTA.
973
974 @return The 64-bit control register PTA.
975
976 **/
977 UINT64
978 EFIAPI
979 AsmReadControlRegisterPta (
980 VOID
981 );
982
983
984 /**
985 Reads control register IPSR.
986
987 This is a worker function for AsmReadControlRegister()
988 when its parameter Index is IPF_CONTROL_REGISTER_IPSR.
989
990 @return The 64-bit control register IPSR.
991
992 **/
993 UINT64
994 EFIAPI
995 AsmReadControlRegisterIpsr (
996 VOID
997 );
998
999
1000 /**
1001 Reads control register ISR.
1002
1003 This is a worker function for AsmReadControlRegister()
1004 when its parameter Index is IPF_CONTROL_REGISTER_ISR.
1005
1006 @return The 64-bit control register ISR.
1007
1008 **/
1009 UINT64
1010 EFIAPI
1011 AsmReadControlRegisterIsr (
1012 VOID
1013 );
1014
1015
1016 /**
1017 Reads control register IIP.
1018
1019 This is a worker function for AsmReadControlRegister()
1020 when its parameter Index is IPF_CONTROL_REGISTER_IIP.
1021
1022 @return The 64-bit control register IIP.
1023
1024 **/
1025 UINT64
1026 EFIAPI
1027 AsmReadControlRegisterIip (
1028 VOID
1029 );
1030
1031
1032 /**
1033 Reads control register IFA.
1034
1035 This is a worker function for AsmReadControlRegister()
1036 when its parameter Index is IPF_CONTROL_REGISTER_IFA.
1037
1038 @return The 64-bit control register IFA.
1039
1040 **/
1041 UINT64
1042 EFIAPI
1043 AsmReadControlRegisterIfa (
1044 VOID
1045 );
1046
1047
1048 /**
1049 Reads control register ITIR.
1050
1051 This is a worker function for AsmReadControlRegister()
1052 when its parameter Index is IPF_CONTROL_REGISTER_ITIR.
1053
1054 @return The 64-bit control register ITIR.
1055
1056 **/
1057 UINT64
1058 EFIAPI
1059 AsmReadControlRegisterItir (
1060 VOID
1061 );
1062
1063
1064 /**
1065 Reads control register IIPA.
1066
1067 This is a worker function for AsmReadControlRegister()
1068 when its parameter Index is IPF_CONTROL_REGISTER_IIPA.
1069
1070 @return The 64-bit control register IIPA.
1071
1072 **/
1073 UINT64
1074 EFIAPI
1075 AsmReadControlRegisterIipa (
1076 VOID
1077 );
1078
1079
1080 /**
1081 Reads control register IFS.
1082
1083 This is a worker function for AsmReadControlRegister()
1084 when its parameter Index is IPF_CONTROL_REGISTER_IFS.
1085
1086 @return The 64-bit control register IFS.
1087
1088 **/
1089 UINT64
1090 EFIAPI
1091 AsmReadControlRegisterIfs (
1092 VOID
1093 );
1094
1095
1096 /**
1097 Reads control register IIM.
1098
1099 This is a worker function for AsmReadControlRegister()
1100 when its parameter Index is IPF_CONTROL_REGISTER_IIM.
1101
1102 @return The 64-bit control register IIM.
1103
1104 **/
1105 UINT64
1106 EFIAPI
1107 AsmReadControlRegisterIim (
1108 VOID
1109 );
1110
1111
1112 /**
1113 Reads control register IHA.
1114
1115 This is a worker function for AsmReadControlRegister()
1116 when its parameter Index is IPF_CONTROL_REGISTER_IHA.
1117
1118 @return The 64-bit control register IHA.
1119
1120 **/
1121 UINT64
1122 EFIAPI
1123 AsmReadControlRegisterIha (
1124 VOID
1125 );
1126
1127
1128 /**
1129 Reads control register LID.
1130
1131 This is a worker function for AsmReadControlRegister()
1132 when its parameter Index is IPF_CONTROL_REGISTER_LID.
1133
1134 @return The 64-bit control register LID.
1135
1136 **/
1137 UINT64
1138 EFIAPI
1139 AsmReadControlRegisterLid (
1140 VOID
1141 );
1142
1143
1144 /**
1145 Reads control register IVR.
1146
1147 This is a worker function for AsmReadControlRegister()
1148 when its parameter Index is IPF_CONTROL_REGISTER_IVR.
1149
1150 @return The 64-bit control register IVR.
1151
1152 **/
1153 UINT64
1154 EFIAPI
1155 AsmReadControlRegisterIvr (
1156 VOID
1157 );
1158
1159
1160 /**
1161 Reads control register TPR.
1162
1163 This is a worker function for AsmReadControlRegister()
1164 when its parameter Index is IPF_CONTROL_REGISTER_TPR.
1165
1166 @return The 64-bit control register TPR.
1167
1168 **/
1169 UINT64
1170 EFIAPI
1171 AsmReadControlRegisterTpr (
1172 VOID
1173 );
1174
1175
1176 /**
1177 Reads control register EOI.
1178
1179 This is a worker function for AsmReadControlRegister()
1180 when its parameter Index is IPF_CONTROL_REGISTER_EOI.
1181
1182 @return The 64-bit control register EOI.
1183
1184 **/
1185 UINT64
1186 EFIAPI
1187 AsmReadControlRegisterEoi (
1188 VOID
1189 );
1190
1191
1192 /**
1193 Reads control register IRR0.
1194
1195 This is a worker function for AsmReadControlRegister()
1196 when its parameter Index is IPF_CONTROL_REGISTER_IRR0.
1197
1198 @return The 64-bit control register IRR0.
1199
1200 **/
1201 UINT64
1202 EFIAPI
1203 AsmReadControlRegisterIrr0 (
1204 VOID
1205 );
1206
1207
1208 /**
1209 Reads control register IRR1.
1210
1211 This is a worker function for AsmReadControlRegister()
1212 when its parameter Index is IPF_CONTROL_REGISTER_IRR1.
1213
1214 @return The 64-bit control register IRR1.
1215
1216 **/
1217 UINT64
1218 EFIAPI
1219 AsmReadControlRegisterIrr1 (
1220 VOID
1221 );
1222
1223
1224 /**
1225 Reads control register IRR2.
1226
1227 This is a worker function for AsmReadControlRegister()
1228 when its parameter Index is IPF_CONTROL_REGISTER_IRR2.
1229
1230 @return The 64-bit control register IRR2.
1231
1232 **/
1233 UINT64
1234 EFIAPI
1235 AsmReadControlRegisterIrr2 (
1236 VOID
1237 );
1238
1239
1240 /**
1241 Reads control register IRR3.
1242
1243 This is a worker function for AsmReadControlRegister()
1244 when its parameter Index is IPF_CONTROL_REGISTER_IRR3.
1245
1246 @return The 64-bit control register IRR3.
1247
1248 **/
1249 UINT64
1250 EFIAPI
1251 AsmReadControlRegisterIrr3 (
1252 VOID
1253 );
1254
1255
1256 /**
1257 Reads control register ITV.
1258
1259 This is a worker function for AsmReadControlRegister()
1260 when its parameter Index is IPF_CONTROL_REGISTER_ITV.
1261
1262 @return The 64-bit control register ITV.
1263
1264 **/
1265 UINT64
1266 EFIAPI
1267 AsmReadControlRegisterItv (
1268 VOID
1269 );
1270
1271
1272 /**
1273 Reads control register PMV.
1274
1275 This is a worker function for AsmReadControlRegister()
1276 when its parameter Index is IPF_CONTROL_REGISTER_PMV.
1277
1278 @return The 64-bit control register PMV.
1279
1280 **/
1281 UINT64
1282 EFIAPI
1283 AsmReadControlRegisterPmv (
1284 VOID
1285 );
1286
1287
1288 /**
1289 Reads control register CMCV.
1290
1291 This is a worker function for AsmReadControlRegister()
1292 when its parameter Index is IPF_CONTROL_REGISTER_CMCV.
1293
1294 @return The 64-bit control register CMCV.
1295
1296 **/
1297 UINT64
1298 EFIAPI
1299 AsmReadControlRegisterCmcv (
1300 VOID
1301 );
1302
1303
1304 /**
1305 Reads control register LRR0.
1306
1307 This is a worker function for AsmReadControlRegister()
1308 when its parameter Index is IPF_CONTROL_REGISTER_LRR0.
1309
1310 @return The 64-bit control register LRR0.
1311
1312 **/
1313 UINT64
1314 EFIAPI
1315 AsmReadControlRegisterLrr0 (
1316 VOID
1317 );
1318
1319
1320 /**
1321 Reads control register LRR1.
1322
1323 This is a worker function for AsmReadControlRegister()
1324 when its parameter Index is IPF_CONTROL_REGISTER_LRR1.
1325
1326 @return The 64-bit control register LRR1.
1327
1328 **/
1329 UINT64
1330 EFIAPI
1331 AsmReadControlRegisterLrr1 (
1332 VOID
1333 );
1334
1335
1336 /**
1337 Reads application register K0.
1338
1339 This is a worker function for AsmReadApplicationRegister()
1340 when its parameter Index is IPF_APPLICATION_REGISTER_K0.
1341
1342 @return The 64-bit application register K0.
1343
1344 **/
1345 UINT64
1346 EFIAPI
1347 AsmReadApplicationRegisterK0 (
1348 VOID
1349 );
1350
1351
1352
1353 /**
1354 Reads application register K1.
1355
1356 This is a worker function for AsmReadApplicationRegister()
1357 when its parameter Index is IPF_APPLICATION_REGISTER_K1.
1358
1359 @return The 64-bit application register K1.
1360
1361 **/
1362 UINT64
1363 EFIAPI
1364 AsmReadApplicationRegisterK1 (
1365 VOID
1366 );
1367
1368
1369 /**
1370 Reads application register K2.
1371
1372 This is a worker function for AsmReadApplicationRegister()
1373 when its parameter Index is IPF_APPLICATION_REGISTER_K2.
1374
1375 @return The 64-bit application register K2.
1376
1377 **/
1378 UINT64
1379 EFIAPI
1380 AsmReadApplicationRegisterK2 (
1381 VOID
1382 );
1383
1384
1385 /**
1386 Reads application register K3.
1387
1388 This is a worker function for AsmReadApplicationRegister()
1389 when its parameter Index is IPF_APPLICATION_REGISTER_K3.
1390
1391 @return The 64-bit application register K3.
1392
1393 **/
1394 UINT64
1395 EFIAPI
1396 AsmReadApplicationRegisterK3 (
1397 VOID
1398 );
1399
1400
1401 /**
1402 Reads application register K4.
1403
1404 This is a worker function for AsmReadApplicationRegister()
1405 when its parameter Index is IPF_APPLICATION_REGISTER_K4.
1406
1407 @return The 64-bit application register K4.
1408
1409 **/
1410 UINT64
1411 EFIAPI
1412 AsmReadApplicationRegisterK4 (
1413 VOID
1414 );
1415
1416
1417 /**
1418 Reads application register K5.
1419
1420 This is a worker function for AsmReadApplicationRegister()
1421 when its parameter Index is IPF_APPLICATION_REGISTER_K5.
1422
1423 @return The 64-bit application register K5.
1424
1425 **/
1426 UINT64
1427 EFIAPI
1428 AsmReadApplicationRegisterK5 (
1429 VOID
1430 );
1431
1432
1433 /**
1434 Reads application register K6.
1435
1436 This is a worker function for AsmReadApplicationRegister()
1437 when its parameter Index is IPF_APPLICATION_REGISTER_K6.
1438
1439 @return The 64-bit application register K6.
1440
1441 **/
1442 UINT64
1443 EFIAPI
1444 AsmReadApplicationRegisterK6 (
1445 VOID
1446 );
1447
1448
1449 /**
1450 Reads application register K7.
1451
1452 This is a worker function for AsmReadApplicationRegister()
1453 when its parameter Index is IPF_APPLICATION_REGISTER_K7.
1454
1455 @return The 64-bit application register K7.
1456
1457 **/
1458 UINT64
1459 EFIAPI
1460 AsmReadApplicationRegisterK7 (
1461 VOID
1462 );
1463
1464
1465 /**
1466 Reads application register RSC.
1467
1468 This is a worker function for AsmReadApplicationRegister()
1469 when its parameter Index is IPF_APPLICATION_REGISTER_RSC.
1470
1471 @return The 64-bit application register RSC.
1472
1473 **/
1474 UINT64
1475 EFIAPI
1476 AsmReadApplicationRegisterRsc (
1477 VOID
1478 );
1479
1480
1481 /**
1482 Reads application register BSP.
1483
1484 This is a worker function for AsmReadApplicationRegister()
1485 when its parameter Index is IPF_APPLICATION_REGISTER_BSP.
1486
1487 @return The 64-bit application register BSP.
1488
1489 **/
1490 UINT64
1491 EFIAPI
1492 AsmReadApplicationRegisterBsp (
1493 VOID
1494 );
1495
1496
1497 /**
1498 Reads application register BSPSTORE.
1499
1500 This is a worker function for AsmReadApplicationRegister()
1501 when its parameter Index is IPF_APPLICATION_REGISTER_BSPSTORE.
1502
1503 @return The 64-bit application register BSPSTORE.
1504
1505 **/
1506 UINT64
1507 EFIAPI
1508 AsmReadApplicationRegisterBspstore (
1509 VOID
1510 );
1511
1512
1513 /**
1514 Reads application register RNAT.
1515
1516 This is a worker function for AsmReadApplicationRegister()
1517 when its parameter Index is IPF_APPLICATION_REGISTER_RNAT.
1518
1519 @return The 64-bit application register RNAT.
1520
1521 **/
1522 UINT64
1523 EFIAPI
1524 AsmReadApplicationRegisterRnat (
1525 VOID
1526 );
1527
1528
1529 /**
1530 Reads application register FCR.
1531
1532 This is a worker function for AsmReadApplicationRegister()
1533 when its parameter Index is IPF_APPLICATION_REGISTER_FCR.
1534
1535 @return The 64-bit application register FCR.
1536
1537 **/
1538 UINT64
1539 EFIAPI
1540 AsmReadApplicationRegisterFcr (
1541 VOID
1542 );
1543
1544
1545 /**
1546 Reads application register EFLAG.
1547
1548 This is a worker function for AsmReadApplicationRegister()
1549 when its parameter Index is IPF_APPLICATION_REGISTER_EFLAG.
1550
1551 @return The 64-bit application register EFLAG.
1552
1553 **/
1554 UINT64
1555 EFIAPI
1556 AsmReadApplicationRegisterEflag (
1557 VOID
1558 );
1559
1560
1561 /**
1562 Reads application register CSD.
1563
1564 This is a worker function for AsmReadApplicationRegister()
1565 when its parameter Index is IPF_APPLICATION_REGISTER_CSD.
1566
1567 @return The 64-bit application register CSD.
1568
1569 **/
1570 UINT64
1571 EFIAPI
1572 AsmReadApplicationRegisterCsd (
1573 VOID
1574 );
1575
1576
1577 /**
1578 Reads application register SSD.
1579
1580 This is a worker function for AsmReadApplicationRegister()
1581 when its parameter Index is IPF_APPLICATION_REGISTER_SSD.
1582
1583 @return The 64-bit application register SSD.
1584
1585 **/
1586 UINT64
1587 EFIAPI
1588 AsmReadApplicationRegisterSsd (
1589 VOID
1590 );
1591
1592
1593 /**
1594 Reads application register CFLG.
1595
1596 This is a worker function for AsmReadApplicationRegister()
1597 when its parameter Index is IPF_APPLICATION_REGISTER_CFLG.
1598
1599 @return The 64-bit application register CFLG.
1600
1601 **/
1602 UINT64
1603 EFIAPI
1604 AsmReadApplicationRegisterCflg (
1605 VOID
1606 );
1607
1608
1609 /**
1610 Reads application register FSR.
1611
1612 This is a worker function for AsmReadApplicationRegister()
1613 when its parameter Index is IPF_APPLICATION_REGISTER_FSR.
1614
1615 @return The 64-bit application register FSR.
1616
1617 **/
1618 UINT64
1619 EFIAPI
1620 AsmReadApplicationRegisterFsr (
1621 VOID
1622 );
1623
1624
1625 /**
1626 Reads application register FIR.
1627
1628 This is a worker function for AsmReadApplicationRegister()
1629 when its parameter Index is IPF_APPLICATION_REGISTER_FIR.
1630
1631 @return The 64-bit application register FIR.
1632
1633 **/
1634 UINT64
1635 EFIAPI
1636 AsmReadApplicationRegisterFir (
1637 VOID
1638 );
1639
1640
1641 /**
1642 Reads application register FDR.
1643
1644 This is a worker function for AsmReadApplicationRegister()
1645 when its parameter Index is IPF_APPLICATION_REGISTER_FDR.
1646
1647 @return The 64-bit application register FDR.
1648
1649 **/
1650 UINT64
1651 EFIAPI
1652 AsmReadApplicationRegisterFdr (
1653 VOID
1654 );
1655
1656
1657 /**
1658 Reads application register CCV.
1659
1660 This is a worker function for AsmReadApplicationRegister()
1661 when its parameter Index is IPF_APPLICATION_REGISTER_CCV.
1662
1663 @return The 64-bit application register CCV.
1664
1665 **/
1666 UINT64
1667 EFIAPI
1668 AsmReadApplicationRegisterCcv (
1669 VOID
1670 );
1671
1672
1673 /**
1674 Reads application register UNAT.
1675
1676 This is a worker function for AsmReadApplicationRegister()
1677 when its parameter Index is IPF_APPLICATION_REGISTER_UNAT.
1678
1679 @return The 64-bit application register UNAT.
1680
1681 **/
1682 UINT64
1683 EFIAPI
1684 AsmReadApplicationRegisterUnat (
1685 VOID
1686 );
1687
1688
1689 /**
1690 Reads application register FPSR.
1691
1692 This is a worker function for AsmReadApplicationRegister()
1693 when its parameter Index is IPF_APPLICATION_REGISTER_FPSR.
1694
1695 @return The 64-bit application register FPSR.
1696
1697 **/
1698 UINT64
1699 EFIAPI
1700 AsmReadApplicationRegisterFpsr (
1701 VOID
1702 );
1703
1704
1705 /**
1706 Reads application register ITC.
1707
1708 This is a worker function for AsmReadApplicationRegister()
1709 when its parameter Index is IPF_APPLICATION_REGISTER_ITC.
1710
1711 @return The 64-bit application register ITC.
1712
1713 **/
1714 UINT64
1715 EFIAPI
1716 AsmReadApplicationRegisterItc (
1717 VOID
1718 );
1719
1720
1721 /**
1722 Reads application register PFS.
1723
1724 This is a worker function for AsmReadApplicationRegister()
1725 when its parameter Index is IPF_APPLICATION_REGISTER_PFS.
1726
1727 @return The 64-bit application register PFS.
1728
1729 **/
1730 UINT64
1731 EFIAPI
1732 AsmReadApplicationRegisterPfs (
1733 VOID
1734 );
1735
1736
1737 /**
1738 Reads application register LC.
1739
1740 This is a worker function for AsmReadApplicationRegister()
1741 when its parameter Index is IPF_APPLICATION_REGISTER_LC.
1742
1743 @return The 64-bit application register LC.
1744
1745 **/
1746 UINT64
1747 EFIAPI
1748 AsmReadApplicationRegisterLc (
1749 VOID
1750 );
1751
1752
1753 /**
1754 Reads application register EC.
1755
1756 This is a worker function for AsmReadApplicationRegister()
1757 when its parameter Index is IPF_APPLICATION_REGISTER_EC.
1758
1759 @return The 64-bit application register EC.
1760
1761 **/
1762 UINT64
1763 EFIAPI
1764 AsmReadApplicationRegisterEc (
1765 VOID
1766 );
1767
1768
1769
1770 /**
1771 Transfers control to a function starting with a new stack.
1772
1773 Transfers control to the function specified by EntryPoint using the new stack
1774 specified by NewStack and passing in the parameters specified by Context1 and
1775 Context2. Context1 and Context2 are optional and may be NULL. The function
1776 EntryPoint must never return.
1777
1778 If EntryPoint is NULL, then ASSERT().
1779 If NewStack is NULL, then ASSERT().
1780
1781 @param EntryPoint A pointer to function to call with the new stack.
1782 @param Context1 A pointer to the context to pass into the EntryPoint
1783 function.
1784 @param Context2 A pointer to the context to pass into the EntryPoint
1785 function.
1786 @param NewStack A pointer to the new stack to use for the EntryPoint
1787 function.
1788 @param NewBsp A pointer to the new memory location for RSE backing
1789 store.
1790
1791 **/
1792 VOID
1793 EFIAPI
1794 AsmSwitchStackAndBackingStore (
1795 IN SWITCH_STACK_ENTRY_POINT EntryPoint,
1796 IN VOID *Context1, OPTIONAL
1797 IN VOID *Context2, OPTIONAL
1798 IN VOID *NewStack,
1799 IN VOID *NewBsp
1800 );
1801
1802 /**
1803 Internal worker function to invalidate a range of instruction cache lines
1804 in the cache coherency domain of the calling CPU.
1805
1806 Internal worker function to invalidate the instruction cache lines specified
1807 by Address and Length. If Address is not aligned on a cache line boundary,
1808 then entire instruction cache line containing Address is invalidated. If
1809 Address + Length is not aligned on a cache line boundary, then the entire
1810 instruction cache line containing Address + Length -1 is invalidated. This
1811 function may choose to invalidate the entire instruction cache if that is more
1812 efficient than invalidating the specified range. If Length is 0, the no instruction
1813 cache lines are invalidated. Address is returned.
1814 This function is only available on IPF.
1815
1816 @param Address The base address of the instruction cache lines to
1817 invalidate. If the CPU is in a physical addressing mode, then
1818 Address is a physical address. If the CPU is in a virtual
1819 addressing mode, then Address is a virtual address.
1820
1821 @param Length The number of bytes to invalidate from the instruction cache.
1822
1823 @return Address
1824
1825 **/
1826 VOID *
1827 EFIAPI
1828 InternalFlushCacheRange (
1829 IN VOID *Address,
1830 IN UINTN Length
1831 );
1832
1833 #else
1834
1835 #endif
1836
1837 #endif