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