THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
- Module Name: BaseLib.h
-
**/
#ifndef __BASE_LIB__
#define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT 8
#elif defined (MDE_CPU_IPF)
+
//
// IPF context buffer used by SetJump() and LongJump()
//
OUT CHAR16 *Destination,
IN CONST CHAR16 *Source
);
+
+
/**
Copies one Null-terminated Unicode string with a maximum length to another
Null-terminated Unicode string with a maximum length and returns the new
IN CONST CHAR16 *Source,
IN UINTN Length
);
+
+
/**
Returns the length of a Null-terminated Unicode string.
StrLen (
IN CONST CHAR16 *String
);
+
+
/**
Returns the size of a Null-terminated Unicode string in bytes, including the
Null terminator.
StrSize (
IN CONST CHAR16 *String
);
+
+
/**
Compares two Null-terminated Unicode strings, and returns the difference
between the first mismatched Unicode characters.
IN CONST CHAR16 *FirstString,
IN CONST CHAR16 *SecondString
);
+
+
/**
Compares two Null-terminated Unicode strings with maximum lengths, and
returns the difference between the first mismatched Unicode characters.
IN CONST CHAR16 *SecondString,
IN UINTN Length
);
+
+
/**
Concatenates one Null-terminated Unicode string to another Null-terminated
Unicode string, and returns the concatenated Unicode string.
IN OUT CHAR16 *Destination,
IN CONST CHAR16 *Source
);
+
+
/**
Concatenates one Null-terminated Unicode string with a maximum length to the
end of another Null-terminated Unicode string, and returns the concatenated
StrDecimalToUint64 (
IN CONST CHAR16 *String
);
+
/**
Convert a Null-terminated Unicode hexadecimal string to a value of type UINTN.
IN CONST CHAR16 *String
);
+
/**
Convert a Null-terminated Unicode hexadecimal string to a value of type UINT64.
IN CONST CHAR16 *String
);
+
/**
Convert one Null-terminated Unicode string to a Null-terminated
ASCII string and returns the ASCII string.
OUT CHAR8 *Destination
);
+
/**
Copies one Null-terminated ASCII string to another Null-terminated ASCII
string and returns the new ASCII string.
OUT CHAR8 *Destination,
IN CONST CHAR8 *Source
);
+
+
/**
Copies one Null-terminated ASCII string with a maximum length to another
Null-terminated ASCII string with a maximum length and returns the new ASCII
IN CONST CHAR8 *Source,
IN UINTN Length
);
+
+
/**
Returns the length of a Null-terminated ASCII string.
AsciiStrLen (
IN CONST CHAR8 *String
);
+
+
/**
Returns the size of a Null-terminated ASCII string in bytes, including the
Null terminator.
AsciiStrSize (
IN CONST CHAR8 *String
);
+
+
/**
Compares two Null-terminated ASCII strings, and returns the difference
between the first mismatched ASCII characters.
IN CONST CHAR8 *FirstString,
IN CONST CHAR8 *SecondString
);
+
+
/**
Performs a case insensitive comparison of two Null-terminated ASCII strings,
and returns the difference between the first mismatched ASCII characters.
IN CONST CHAR8 *FirstString,
IN CONST CHAR8 *SecondString
);
+
+
/**
Compares two Null-terminated ASCII strings with maximum lengths, and returns
the difference between the first mismatched ASCII characters.
IN CONST CHAR8 *SecondString,
IN UINTN Length
);
+
+
/**
Concatenates one Null-terminated ASCII string to another Null-terminated
ASCII string, and returns the concatenated ASCII string.
IN OUT CHAR8 *Destination,
IN CONST CHAR8 *Source
);
+
+
/**
Concatenates one Null-terminated ASCII string with a maximum length to the
end of another Null-terminated ASCII string, and returns the concatenated
IN UINTN Length
);
+
/**
Returns the first occurance of a Null-terminated ASCII sub-string
in a Null-terminated ASCII string.
IN CONST CHAR8 *SearchString
);
+
/**
Convert a Null-terminated ASCII decimal string to a value of type
UINTN.
IN CONST CHAR8 *String
);
+
/**
Convert a Null-terminated ASCII decimal string to a value of type
UINT64.
IN CONST CHAR8 *String
);
+
/**
Convert a Null-terminated ASCII hexadecimal string to a value of type UINTN.
IN CONST CHAR8 *String
);
+
/**
Convert a Null-terminated ASCII hexadecimal string to a value of type UINT64.
IN CONST CHAR8 *String
);
+
/**
Convert one Null-terminated ASCII string to a Null-terminated
Unicode string and returns the Unicode string.
OUT CHAR16 *Destination
);
+
/**
Converts an 8-bit value to an 8-bit BCD value.
IN UINT8 Value
);
+
/**
Converts an 8-bit BCD value to an 8-bit value.
**/
#define INITIALIZE_LIST_HEAD_VARIABLE(ListHead) {&ListHead, &ListHead}
+
/**
Initializes the head node of a doubly linked list, and returns the pointer to
the head node of the doubly linked list.
IN LIST_ENTRY *ListHead
);
+
/**
Adds a node to the beginning of a doubly linked list, and returns the pointer
to the head node of the doubly linked list.
IN LIST_ENTRY *Entry
);
+
/**
Adds a node to the end of a doubly linked list, and returns the pointer to
the head node of the doubly linked list.
IN LIST_ENTRY *Entry
);
+
/**
Retrieves the first node of a doubly linked list.
IN CONST LIST_ENTRY *List
);
+
/**
Retrieves the next node of a doubly linked list.
IN CONST LIST_ENTRY *Node
);
+
/**
Checks to see if a doubly linked list is empty or not.
IN CONST LIST_ENTRY *ListHead
);
+
/**
Determines if a node in a doubly linked list is null.
IN CONST LIST_ENTRY *Node
);
+
/**
Determines if a node the last node in a doubly linked list.
IN CONST LIST_ENTRY *Node
);
+
/**
Swaps the location of two nodes in a doubly linked list, and returns the
first node after the swap.
IN LIST_ENTRY *SecondEntry
);
+
/**
Removes a node from a doubly linked list, and returns the node that follows
the removed node.
IN UINTN Count
);
+
/**
Shifts a 64-bit integer right between 0 and 63 bits. This high bits are
filled with zeros. The shifted value is returned.
IN UINTN Count
);
+
/**
Shifts a 64-bit integer right between 0 and 63 bits. The high bits are filled
with original integer's bit 63. The shifted value is returned.
IN UINTN Count
);
+
/**
Rotates a 32-bit integer left between 0 and 31 bits, filling the low bits
with the high bits that were rotated.
IN UINTN Count
);
+
/**
Rotates a 32-bit integer right between 0 and 31 bits, filling the high bits
with the low bits that were rotated.
IN UINTN Count
);
+
/**
Rotates a 64-bit integer left between 0 and 63 bits, filling the low bits
with the high bits that were rotated.
IN UINTN Count
);
+
/**
Rotates a 64-bit integer right between 0 and 63 bits, filling the high bits
with the high low bits that were rotated.
IN UINTN Count
);
+
/**
Returns the bit position of the lowest bit set in a 32-bit value.
IN UINT32 Operand
);
+
/**
Returns the bit position of the lowest bit set in a 64-bit value.
IN UINT64 Operand
);
+
/**
Returns the bit position of the highest bit set in a 32-bit value. Equivalent
to log2(x).
IN UINT32 Operand
);
+
/**
Returns the bit position of the highest bit set in a 64-bit value. Equivalent
to log2(x).
IN UINT64 Operand
);
+
/**
Returns the value of the highest bit set in a 32-bit value. Equivalent to
1 << HighBitSet32(x).
IN UINT32 Operand
);
+
/**
Returns the value of the highest bit set in a 64-bit value. Equivalent to
1 << HighBitSet64(x).
IN UINT64 Operand
);
+
/**
Switches the endianess of a 16-bit integer.
IN UINT16 Value
);
+
/**
Switches the endianess of a 32-bit integer.
IN UINT32 Value
);
+
/**
Switches the endianess of a 64-bit integer.
IN UINT64 Value
);
+
/**
Multiples a 64-bit unsigned integer by a 32-bit unsigned integer and
generates a 64-bit unsigned result.
IN UINT32 Multiplier
);
+
/**
Multiples a 64-bit unsigned integer by a 64-bit unsigned integer and
generates a 64-bit unsigned result.
IN UINT64 Multiplier
);
+
/**
Multiples a 64-bit signed integer by a 64-bit signed integer and generates a
64-bit signed result.
IN INT64 Multiplier
);
+
/**
Divides a 64-bit unsigned integer by a 32-bit unsigned integer and generates
a 64-bit unsigned result.
IN UINT32 Divisor
);
+
/**
Divides a 64-bit unsigned integer by a 32-bit unsigned integer and generates
a 32-bit unsigned remainder.
IN UINT32 Divisor
);
+
/**
Divides a 64-bit unsigned integer by a 32-bit unsigned integer and generates
a 64-bit unsigned result and an optional 32-bit unsigned remainder.
OUT UINT32 *Remainder OPTIONAL
);
+
/**
Divides a 64-bit unsigned integer by a 64-bit unsigned integer and generates
a 64-bit unsigned result and an optional 64-bit unsigned remainder.
OUT UINT64 *Remainder OPTIONAL
);
+
/**
Divides a 64-bit signed integer by a 64-bit signed integer and generates a
64-bit signed result and a optional 64-bit signed remainder.
OUT INT64 *Remainder OPTIONAL
);
+
/**
Reads a 16-bit value from memory that may be unaligned.
IN CONST UINT16 *Uint16
);
+
/**
Writes a 16-bit value to memory that may be unaligned.
IN UINT16 Value
);
+
/**
Reads a 24-bit value from memory that may be unaligned.
IN CONST UINT32 *Buffer
);
+
/**
Writes a 24-bit value to memory that may be unaligned.
IN UINT32 Value
);
+
/**
Reads a 32-bit value from memory that may be unaligned.
IN CONST UINT32 *Uint32
);
+
/**
Writes a 32-bit value to memory that may be unaligned.
IN UINT32 Value
);
+
/**
Reads a 64-bit value from memory that may be unaligned.
IN CONST UINT64 *Uint64
);
+
/**
Writes a 64-bit value to memory that may be unaligned.
IN UINT64 Value
);
+
//
// Bit Field Functions
//
IN UINTN EndBit
);
+
/**
Writes a bit field to an 8-bit value, and returns the result.
IN UINT8 Value
);
+
/**
Reads a bit field from an 8-bit value, performs a bitwise OR, and returns the
result.
IN UINT8 OrData
);
+
/**
Reads a bit field from an 8-bit value, performs a bitwise AND, and returns
the result.
IN UINT8 AndData
);
+
/**
Reads a bit field from an 8-bit value, performs a bitwise AND followed by a
bitwise OR, and returns the result.
IN UINT8 OrData
);
+
/**
Returns a bit field from a 16-bit value.
IN UINTN EndBit
);
+
/**
Writes a bit field to a 16-bit value, and returns the result.
IN UINT16 Value
);
+
/**
Reads a bit field from a 16-bit value, performs a bitwise OR, and returns the
result.
IN UINT16 OrData
);
+
/**
Reads a bit field from a 16-bit value, performs a bitwise AND, and returns
the result.
IN UINT16 AndData
);
+
/**
Reads a bit field from a 16-bit value, performs a bitwise AND followed by a
bitwise OR, and returns the result.
IN UINT16 OrData
);
+
/**
Returns a bit field from a 32-bit value.
IN UINTN EndBit
);
+
/**
Writes a bit field to a 32-bit value, and returns the result.
IN UINT32 Value
);
+
/**
Reads a bit field from a 32-bit value, performs a bitwise OR, and returns the
result.
IN UINT32 OrData
);
+
/**
Reads a bit field from a 32-bit value, performs a bitwise AND, and returns
the result.
IN UINT32 AndData
);
+
/**
Reads a bit field from a 32-bit value, performs a bitwise AND followed by a
bitwise OR, and returns the result.
IN UINT32 OrData
);
+
/**
Returns a bit field from a 64-bit value.
IN UINTN EndBit
);
+
/**
Writes a bit field to a 64-bit value, and returns the result.
IN UINT64 Value
);
+
/**
Reads a bit field from a 64-bit value, performs a bitwise OR, and returns the
result.
IN UINT64 OrData
);
+
/**
Reads a bit field from a 64-bit value, performs a bitwise AND, and returns
the result.
IN UINT64 AndData
);
+
/**
Reads a bit field from a 64-bit value, performs a bitwise AND followed by a
bitwise OR, and returns the result.
IN UINT64 OrData
);
+
//
// Base Library Synchronization Functions
//
VOID
);
+
/**
Initializes a spin lock to the released state and returns the spin lock.
IN SPIN_LOCK *SpinLock
);
+
/**
Waits until a spin lock can be placed in the acquired state.
IN SPIN_LOCK *SpinLock
);
+
/**
Attempts to place a spin lock in the acquired state.
IN SPIN_LOCK *SpinLock
);
+
/**
Releases a spin lock.
IN SPIN_LOCK *SpinLock
);
+
/**
Performs an atomic increment of an 32-bit unsigned integer.
IN UINT32 *Value
);
+
/**
Performs an atomic decrement of an 32-bit unsigned integer.
IN UINT32 *Value
);
+
/**
Performs an atomic compare exchange operation on a 32-bit unsigned integer.
IN UINT32 ExchangeValue
);
+
/**
Performs an atomic compare exchange operation on a 64-bit unsigned integer.
IN UINT64 ExchangeValue
);
+
/**
Performs an atomic compare exchange operation on a pointer value.
IN VOID *ExchangeValue
);
+
//
// Base Library Checksum Functions
//
IN UINTN Length
);
+
/**
Returns the sum of all elements in a buffer of 16-bit values. During
calculation, the carry bits are dropped.
IN UINTN Length
);
+
/**
Returns the two's complement checksum of all elements in a buffer of
16-bit values.
IN UINTN Length
);
+
/**
Returns the sum of all elements in a buffer of 32-bit values. During
calculation, the carry bits are dropped.
IN UINTN Length
);
+
/**
Returns the two's complement checksum of all elements in a buffer of
32-bit values.
IN UINTN Length
);
+
/**
Returns the sum of all elements in a buffer of 64-bit values. During
calculation, the carry bits are dropped.
IN UINTN Length
);
+
/**
Returns the two's complement checksum of all elements in a buffer of
64-bit values.
IN UINTN Length
);
+
//
// Base Library CPU Functions
//
IN VOID *Context2 OPTIONAL
);
+
/**
Used to serialize load and store operations.
VOID
);
+
/**
Saves the current CPU context that can be restored with a call to LongJump()
and returns 0.
OUT BASE_LIBRARY_JUMP_BUFFER *JumpBuffer
);
+
/**
Restores the CPU context that was saved with SetJump().
IN UINTN Value
);
+
/**
Enables CPU interrupts.
VOID
);
+
/**
Disables CPU interrupts.
VOID
);
+
/**
Disables CPU interrupts and returns the interrupt state prior to the disable
operation.
VOID
);
+
/**
Enables CPU interrupts for the smallest window required to capture any
pending interrupts.
VOID
);
+
/**
Retrieves the current CPU interrupt state.
VOID
);
+
/**
Set the current CPU interrupt state.
IN BOOLEAN InterruptState
);
+
/**
Places the CPU in a sleep state until an interrupt is received.
VOID
);
+
/**
Requests CPU to pause for a short period of time.
VOID
);
+
/**
Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU.
VOID
);
+
/**
Transfers control to a function starting with a new stack.
...
);
+
/**
Generates a breakpoint on the CPU.
VOID
);
+
/**
Executes an infinite loop.
VOID
);
-//
-// IA32 and X64 Specific Functions
-//
-//
-// Byte packed structure for 16-bit Real Mode EFLAGS
-//
-typedef union {
- struct {
- UINT32 CF:1; // Carry Flag
- UINT32 Reserved_0:1; // Reserved
- UINT32 PF:1; // Parity Flag
- UINT32 Reserved_1:1; // Reserved
- UINT32 AF:1; // Auxiliary Carry Flag
- UINT32 Reserved_2:1; // Reserved
- UINT32 ZF:1; // Zero Flag
- UINT32 SF:1; // Sign Flag
- UINT32 TF:1; // Trap Flag
- UINT32 IF:1; // Interrupt Enable Flag
- UINT32 DF:1; // Direction Flag
- UINT32 OF:1; // Overflow Flag
- UINT32 IOPL:2; // I/O Privilege Level
- UINT32 NT:1; // Nested Task
- UINT32 Reserved_3:1; // Reserved
- } Bits;
- UINT16 Uint16;
-} IA32_FLAGS16;
-
-//
-// Byte packed structure for EFLAGS/RFLAGS
-// 32-bits on IA-32
-// 64-bits on X64. The upper 32-bits on X64 are reserved
-//
-typedef union {
- struct {
- UINT32 CF:1; // Carry Flag
- UINT32 Reserved_0:1; // Reserved
- UINT32 PF:1; // Parity Flag
- UINT32 Reserved_1:1; // Reserved
- UINT32 AF:1; // Auxiliary Carry Flag
- UINT32 Reserved_2:1; // Reserved
- UINT32 ZF:1; // Zero Flag
- UINT32 SF:1; // Sign Flag
- UINT32 TF:1; // Trap Flag
- UINT32 IF:1; // Interrupt Enable Flag
- UINT32 DF:1; // Direction Flag
- UINT32 OF:1; // Overflow Flag
- UINT32 IOPL:2; // I/O Privilege Level
- UINT32 NT:1; // Nested Task
- UINT32 Reserved_3:1; // Reserved
- UINT32 RF:1; // Resume Flag
- UINT32 VM:1; // Virtual 8086 Mode
- UINT32 AC:1; // Alignment Check
- UINT32 VIF:1; // Virtual Interrupt Flag
- UINT32 VIP:1; // Virtual Interrupt Pending
- UINT32 ID:1; // ID Flag
- UINT32 Reserved_4:10; // Reserved
- } Bits;
- UINTN UintN;
-} IA32_EFLAGS32;
-//
-// Byte packed structure for Control Register 0 (CR0)
-// 32-bits on IA-32
-// 64-bits on X64. The upper 32-bits on X64 are reserved
-//
-typedef union {
- struct {
- UINT32 PE:1; // Protection Enable
- UINT32 MP:1; // Monitor Coprocessor
- UINT32 EM:1; // Emulation
- UINT32 TS:1; // Task Switched
- UINT32 ET:1; // Extension Type
- UINT32 NE:1; // Numeric Error
- UINT32 Reserved_0:10; // Reserved
- UINT32 WP:1; // Write Protect
- UINT32 Reserved_1:1; // Reserved
- UINT32 AM:1; // Alignment Mask
- UINT32 Reserved_2:10; // Reserved
- UINT32 NW:1; // Mot Write-through
- UINT32 CD:1; // Cache Disable
- UINT32 PG:1; // Paging
- } Bits;
- UINTN UintN;
-} IA32_CR0;
+#if defined (MDE_CPU_IPF)
-//
-// Byte packed structure for Control Register 4 (CR4)
-// 32-bits on IA-32
-// 64-bits on X64. The upper 32-bits on X64 are reserved
-//
-typedef union {
- struct {
- UINT32 VME:1; // Virtual-8086 Mode Extensions
- UINT32 PVI:1; // Protected-Mode Virtual Interrupts
- UINT32 TSD:1; // Time Stamp Disable
- UINT32 DE:1; // Debugging Extensions
- UINT32 PSE:1; // Page Size Extensions
- UINT32 PAE:1; // Physical Address Extension
- UINT32 MCE:1; // Machine Check Enable
- UINT32 PGE:1; // Page Global Enable
- UINT32 PCE:1; // Performance Monitoring Counter
- // Enable
- UINT32 OSFXSR:1; // Operating System Support for
- // FXSAVE and FXRSTOR instructions
- UINT32 OSXMMEXCPT:1; // Operating System Support for
- // Unmasked SIMD Floating Point
- // Exceptions
- UINT32 Reserved_0:2; // Reserved
- UINT32 VMXE:1; // VMX Enable
- UINT32 Reserved_1:18; // Reseved
- } Bits;
- UINTN UintN;
-} IA32_CR4;
+/**
+ Flush a range of cache lines in the cache coherency domain of the calling
+ CPU.
-//
-// Byte packed structure for an IDTR, GDTR, LDTR descriptor
-/// @bug How to make this structure byte-packed in a compiler independent way?
-//
-#pragma pack (1)
+ Invalidates the cache lines specified by Address and Length. If Address is
+ not aligned on a cache line boundary, then entire cache line containing
+ Address is invalidated. If Address + Length is not aligned on a cache line
+ boundary, then the entire instruction cache line containing Address + Length
+ -1 is invalidated. This function may choose to invalidate the entire
+ instruction cache if that is more efficient than invalidating the specified
+ range. If Length is 0, the no instruction cache lines are invalidated.
+ Address is returned.
+
+ If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().
+
+ @param Address The base address of the instruction lines to invalidate. If
+ the CPU is in a physical addressing mode, then Address is a
+ physical address. If the CPU is in a virtual addressing mode,
+ then Address is a virtual address.
+
+ @param Length The number of bytes to invalidate from the instruction cache.
+
+ @return Address
+
+**/
+VOID *
+EFIAPI
+IpfFlushCacheRange (
+ IN VOID *Address,
+ IN UINTN Length
+ );
+
+
+/**
+ Executes a FC instruction
+ Executes a FC instruction on the cache line specified by Address.
+ The cache line size affected is at least 32-bytes (aligned on a 32-byte boundary).
+ An implementation may flush a larger region. This function is only available on IPF.
+
+ @param Address The Address of cache line to be flushed.
+
+ @return The address of FC instruction executed.
+
+**/
+UINT64
+EFIAPI
+AsmFc (
+ IN UINT64 Address
+ );
+
+
+/**
+ Executes a FC.I instruction.
+ Executes a FC.I instruction on the cache line specified by Address.
+ The cache line size affected is at least 32-bytes (aligned on a 32-byte boundary).
+ An implementation may flush a larger region. This function is only available on IPF.
+
+ @param Address The Address of cache line to be flushed.
+
+ @return The address of FC.I instruction executed.
+
+**/
+UINT64
+EFIAPI
+AsmFci (
+ IN UINT64 Address
+ );
+
+
+/**
+ Reads the current value of a Processor Identifier Register (CPUID).
+ The Index of largest implemented CPUID (One less than the number of implemented CPUID
+ registers) is determined by CPUID [3] bits {7:0}.
+ No parameter checking is performed on Index. If the Index value is beyond the
+ implemented CPUID register range, a Reserved Register/Field fault may occur. The caller
+ must either guarantee that Index is valid, or the caller must set up fault handlers to
+ catch the faults. This function is only available on IPF.
+
+ @param Index The 8-bit Processor Identifier Register index to read.
+
+ @return The current value of Processor Identifier Register specified by Index.
+
+**/
+UINT64
+EFIAPI
+AsmReadCpuid (
+ IN UINT8 Index
+ );
+
+
+/**
+ Reads the current value of 64-bit Processor Status Register (PSR).
+ This function is only available on IPF.
+
+ @return The current value of PSR.
+
+**/
+UINT64
+EFIAPI
+AsmReadPsr (
+ VOID
+ );
+
+
+/**
+ Writes the current value of 64-bit Processor Status Register (PSR).
+ No parameter checking is performed on Value. All bits of Value corresponding to
+ reserved fields of PSR must be 0 or a Reserved Register/Field fault may occur. The caller must either guarantee that Value is valid, or the caller must set up fault handlers to catch the faults.
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to PSR.
+
+ @return The 64-bit value written to the PSR.
+
+**/
+UINT64
+EFIAPI
+AsmWritePsr (
+ IN UINT64 Value
+ );
+
+
+/**
+ Reads the current value of 64-bit Kernel Register #0 (KR0).
+ This function is only available on IPF.
+
+ @return The current value of KR0.
+
+**/
+UINT64
+EFIAPI
+AsmReadKr0 (
+ VOID
+ );
+
+
+/**
+ Reads the current value of 64-bit Kernel Register #1 (KR1).
+ This function is only available on IPF.
+
+ @return The current value of KR1.
+
+**/
+UINT64
+EFIAPI
+AsmReadKr1 (
+ VOID
+ );
+
+
+/**
+ Reads the current value of 64-bit Kernel Register #2 (KR2).
+ This function is only available on IPF.
+
+ @return The current value of KR2.
+
+**/
+UINT64
+EFIAPI
+AsmReadKr2 (
+ VOID
+ );
+
+
+/**
+ Reads the current value of 64-bit Kernel Register #3 (KR3).
+ This function is only available on IPF.
+
+ @return The current value of KR3.
+
+**/
+UINT64
+EFIAPI
+AsmReadKr3 (
+ VOID
+ );
+
+
+/**
+ Reads the current value of 64-bit Kernel Register #4 (KR4).
+ This function is only available on IPF.
+
+ @return The current value of KR4.
+
+**/
+UINT64
+EFIAPI
+AsmReadKr4 (
+ VOID
+ );
+
+
+/**
+ Reads the current value of 64-bit Kernel Register #5 (KR5).
+ This function is only available on IPF.
+
+ @return The current value of KR5.
+
+**/
+UINT64
+EFIAPI
+AsmReadKr5 (
+ VOID
+ );
+
+
+/**
+ Reads the current value of 64-bit Kernel Register #6 (KR6).
+ This function is only available on IPF.
+
+ @return The current value of KR6.
+
+**/
+UINT64
+EFIAPI
+AsmReadKr6 (
+ VOID
+ );
+
+
+/**
+ Reads the current value of 64-bit Kernel Register #7 (KR7).
+ This function is only available on IPF.
+
+ @return The current value of KR7.
+
+**/
+UINT64
+EFIAPI
+AsmReadKr7 (
+ VOID
+ );
+
+
+/**
+ Write the current value of 64-bit Kernel Register #0 (KR0).
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to KR0.
+
+ @return The 64-bit value written to the KR0.
+
+**/
+UINT64
+EFIAPI
+AsmWriteKr0 (
+ IN UINT64 Value
+ );
+
+
+/**
+ Write the current value of 64-bit Kernel Register #1 (KR1).
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to KR1.
+
+ @return The 64-bit value written to the KR1.
+
+**/
+UINT64
+EFIAPI
+AsmWriteKr1 (
+ IN UINT64 Value
+ );
+
+
+/**
+ Write the current value of 64-bit Kernel Register #2 (KR2).
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to KR2.
+
+ @return The 64-bit value written to the KR2.
+
+**/
+UINT64
+EFIAPI
+AsmWriteKr2 (
+ IN UINT64 Value
+ );
+
+
+/**
+ Write the current value of 64-bit Kernel Register #3 (KR3).
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to KR3.
+
+ @return The 64-bit value written to the KR3.
+
+**/
+UINT64
+EFIAPI
+AsmWriteKr3 (
+ IN UINT64 Value
+ );
+
+
+/**
+ Write the current value of 64-bit Kernel Register #4 (KR4).
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to KR4.
+
+ @return The 64-bit value written to the KR4.
+
+**/
+UINT64
+EFIAPI
+AsmWriteKr4 (
+ IN UINT64 Value
+ );
+
+
+/**
+ Write the current value of 64-bit Kernel Register #5 (KR5).
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to KR5.
+
+ @return The 64-bit value written to the KR5.
+
+**/
+UINT64
+EFIAPI
+AsmWriteKr5 (
+ IN UINT64 Value
+ );
+
+
+/**
+ Write the current value of 64-bit Kernel Register #6 (KR6).
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to KR6.
+
+ @return The 64-bit value written to the KR6.
+
+**/
+UINT64
+EFIAPI
+AsmWriteKr6 (
+ IN UINT64 Value
+ );
+
+
+/**
+ Write the current value of 64-bit Kernel Register #7 (KR7).
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to KR7.
+
+ @return The 64-bit value written to the KR7.
+
+**/
+UINT64
+EFIAPI
+AsmWriteKr7 (
+ IN UINT64 Value
+ );
+
+
+/**
+ Reads the current value of Interval Timer Counter Register (ITC).
+ This function is only available on IPF.
+
+ @return The current value of ITC.
+
+**/
+UINT64
+EFIAPI
+AsmReadItc (
+ VOID
+ );
+
+
+/**
+ Reads the current value of Interval Timer Vector Register (ITV).
+ This function is only available on IPF.
+
+ @return The current value of ITV.
+
+**/
+UINT64
+EFIAPI
+AsmReadItv (
+ VOID
+ );
+
+
+/**
+ Reads the current value of Interval Timer Match Register (ITM).
+ This function is only available on IPF.
+
+ @return The current value of ITM.
+**/
+UINT64
+EFIAPI
+AsmReadItm (
+ VOID
+ );
+
+
+/**
+ Writes the current value of 64-bit Interval Timer Counter Register (ITC).
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to ITC.
+
+ @return The 64-bit value written to the ITC.
+
+**/
+UINT64
+EFIAPI
+AsmWriteItc (
+ IN UINT64 Value
+ );
+
+
+/**
+ Writes the current value of 64-bit Interval Timer Match Register (ITM).
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to ITM.
+
+ @return The 64-bit value written to the ITM.
+
+**/
+UINT64
+EFIAPI
+AsmWriteItm (
+ IN UINT64 Value
+ );
+
+
+/**
+ Writes the current value of 64-bit Interval Timer Vector Register (ITV).
+ No parameter checking is performed on Value. All bits of Value corresponding to
+ reserved fields of ITV must be 0 or a Reserved Register/Field fault may occur.
+ The caller must either guarantee that Value is valid, or the caller must set up
+ fault handlers to catch the faults.
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to ITV.
+
+ @return The 64-bit value written to the ITV.
+
+**/
+UINT64
+EFIAPI
+AsmWriteItv (
+ IN UINT64 Value
+ );
+
+
+/**
+ Reads the current value of Default Control Register (DCR).
+ This function is only available on IPF.
+
+ @return The current value of DCR.
+
+**/
+UINT64
+EFIAPI
+AsmReadDcr (
+ VOID
+ );
+
+
+/**
+ Reads the current value of Interruption Vector Address Register (IVA).
+ This function is only available on IPF.
+
+ @return The current value of IVA.
+**/
+UINT64
+EFIAPI
+AsmReadIva (
+ VOID
+ );
+
+
+/**
+ Reads the current value of Page Table Address Register (PTA).
+ This function is only available on IPF.
+
+ @return The current value of PTA.
+
+**/
+UINT64
+EFIAPI
+AsmReadPta (
+ VOID
+ );
+
+
+/**
+ Writes the current value of 64-bit Default Control Register (DCR).
+ No parameter checking is performed on Value. All bits of Value corresponding to
+ reserved fields of DCR must be 0 or a Reserved Register/Field fault may occur.
+ The caller must either guarantee that Value is valid, or the caller must set up
+ fault handlers to catch the faults.
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to DCR.
+
+ @return The 64-bit value written to the DCR.
+
+**/
+UINT64
+EFIAPI
+AsmWriteDcr (
+ IN UINT64 Value
+ );
+
+
+/**
+ Writes the current value of 64-bit Interruption Vector Address Register (IVA).
+ The size of vector table is 32 K bytes and is 32 K bytes aligned
+ the low 15 bits of Value is ignored when written.
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to IVA.
+
+ @return The 64-bit value written to the IVA.
+
+**/
+UINT64
+EFIAPI
+AsmWriteIva (
+ IN UINT64 Value
+ );
+
+
+/**
+ Writes the current value of 64-bit Page Table Address Register (PTA).
+ No parameter checking is performed on Value. All bits of Value corresponding to
+ reserved fields of DCR must be 0 or a Reserved Register/Field fault may occur.
+ The caller must either guarantee that Value is valid, or the caller must set up
+ fault handlers to catch the faults.
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to PTA.
+
+ @return The 64-bit value written to the PTA.
+**/
+UINT64
+EFIAPI
+AsmWritePta (
+ IN UINT64 Value
+ );
+
+
+/**
+ Reads the current value of Local Interrupt ID Register (LID).
+ This function is only available on IPF.
+
+ @return The current value of LID.
+
+**/
+UINT64
+EFIAPI
+AsmReadLid (
+ VOID
+ );
+
+
+/**
+ Reads the current value of External Interrupt Vector Register (IVR).
+ This function is only available on IPF.
+
+ @return The current value of IVR.
+
+**/
+UINT64
+EFIAPI
+AsmReadIvr (
+ VOID
+ );
+
+
+/**
+ Reads the current value of Task Priority Register (TPR).
+ This function is only available on IPF.
+
+ @return The current value of TPR.
+
+**/
+UINT64
+EFIAPI
+AsmReadTpr (
+ VOID
+ );
+
+
+/**
+ Reads the current value of External Interrupt Request Register #0 (IRR0).
+ This function is only available on IPF.
+
+ @return The current value of IRR0.
+
+**/
+UINT64
+EFIAPI
+AsmReadIrr0 (
+ VOID
+ );
+
+
+/**
+ Reads the current value of External Interrupt Request Register #1 (IRR1).
+ This function is only available on IPF.
+
+ @return The current value of IRR1.
+
+**/
+UINT64
+EFIAPI
+AsmReadIrr1 (
+ VOID
+ );
+
+
+/**
+ Reads the current value of External Interrupt Request Register #2 (IRR2).
+ This function is only available on IPF.
+
+ @return The current value of IRR2.
+
+**/
+UINT64
+EFIAPI
+AsmReadIrr2 (
+ VOID
+ );
+
+
+/**
+ Reads the current value of External Interrupt Request Register #3 (IRR3).
+ This function is only available on IPF.
+
+ @return The current value of IRR3.
+
+**/
+UINT64
+EFIAPI
+AsmReadIrr3 (
+ VOID
+ );
+
+
+/**
+ Reads the current value of Performance Monitor Vector Register (PMV).
+ This function is only available on IPF.
+
+ @return The current value of PMV.
+
+**/
+UINT64
+EFIAPI
+AsmReadPmv (
+ VOID
+ );
+
+
+/**
+ Reads the current value of Corrected Machine Check Vector Register (CMCV).
+ This function is only available on IPF.
+
+ @return The current value of CMCV.
+
+**/
+UINT64
+EFIAPI
+AsmReadCmcv (
+ VOID
+ );
+
+
+/**
+ Reads the current value of Local Redirection Register #0 (LRR0).
+ This function is only available on IPF.
+
+ @return The current value of LRR0.
+
+**/
+UINT64
+EFIAPI
+AsmReadLrr0 (
+ VOID
+ );
+
+
+/**
+ Reads the current value of Local Redirection Register #1 (LRR1).
+ This function is only available on IPF.
+
+ @return The current value of LRR1.
+
+**/
+UINT64
+EFIAPI
+AsmReadLrr1 (
+ VOID
+ );
+
+
+/**
+ Writes the current value of 64-bit Page Local Interrupt ID Register (LID).
+ No parameter checking is performed on Value. All bits of Value corresponding to
+ reserved fields of LID must be 0 or a Reserved Register/Field fault may occur.
+ The caller must either guarantee that Value is valid, or the caller must set up
+ fault handlers to catch the faults.
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to LID.
+
+ @return The 64-bit value written to the LID.
+
+**/
+UINT64
+EFIAPI
+AsmWriteLid (
+ IN UINT64 Value
+ );
+
+
+/**
+ Writes the current value of 64-bit Task Priority Register (TPR).
+ No parameter checking is performed on Value. All bits of Value corresponding to
+ reserved fields of TPR must be 0 or a Reserved Register/Field fault may occur.
+ The caller must either guarantee that Value is valid, or the caller must set up
+ fault handlers to catch the faults.
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to TPR.
+
+ @return The 64-bit value written to the TPR.
+
+**/
+UINT64
+EFIAPI
+AsmWriteTpr (
+ IN UINT64 Value
+ );
+
+
+/**
+ Performs a write operation on End OF External Interrupt Register (EOI).
+ Writes a value of 0 to the EOI Register. This function is only available on IPF.
+
+**/
+VOID
+EFIAPI
+AsmWriteEoi (
+ VOID
+ );
+
+
+/**
+ Writes the current value of 64-bit Performance Monitor Vector Register (PMV).
+ No parameter checking is performed on Value. All bits of Value corresponding
+ to reserved fields of PMV must be 0 or a Reserved Register/Field fault may occur.
+ The caller must either guarantee that Value is valid, or the caller must set up
+ fault handlers to catch the faults.
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to PMV.
+
+ @return The 64-bit value written to the PMV.
+
+**/
+UINT64
+EFIAPI
+AsmWritePmv (
+ IN UINT64 Value
+ );
+
+
+/**
+ Writes the current value of 64-bit Corrected Machine Check Vector Register (CMCV).
+ No parameter checking is performed on Value. All bits of Value corresponding
+ to reserved fields of CMCV must be 0 or a Reserved Register/Field fault may occur.
+ The caller must either guarantee that Value is valid, or the caller must set up
+ fault handlers to catch the faults.
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to CMCV.
+
+ @return The 64-bit value written to the CMCV.
+
+**/
+UINT64
+EFIAPI
+AsmWriteCmcv (
+ IN UINT64 Value
+ );
+
+
+/**
+ Writes the current value of 64-bit Local Redirection Register #0 (LRR0).
+ No parameter checking is performed on Value. All bits of Value corresponding
+ to reserved fields of LRR0 must be 0 or a Reserved Register/Field fault may occur.
+ The caller must either guarantee that Value is valid, or the caller must set up
+ fault handlers to catch the faults.
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to LRR0.
+
+ @return The 64-bit value written to the LRR0.
+
+**/
+UINT64
+EFIAPI
+AsmWriteLrr0 (
+ IN UINT64 Value
+ );
+
+
+/**
+ Writes the current value of 64-bit Local Redirection Register #1 (LRR1).
+ No parameter checking is performed on Value. All bits of Value corresponding
+ to reserved fields of LRR1 must be 0 or a Reserved Register/Field fault may occur.
+ The caller must either guarantee that Value is valid, or the caller must
+ set up fault handlers to catch the faults.
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to LRR1.
+
+ @return The 64-bit value written to the LRR1.
+
+**/
+UINT64
+EFIAPI
+AsmWriteLrr1 (
+ IN UINT64 Value
+ );
+
+
+/**
+ Reads the current value of Instruction Breakpoint Register (IBR).
+
+ The Instruction Breakpoint Registers are used in pairs. The even numbered
+ registers contain breakpoint addresses, and the odd numbered registers contain
+ breakpoint mask conditions. At least 4 instruction registers pairs are implemented
+ on all processor models. Implemented registers are contiguous starting with
+ register 0. No parameter checking is performed on Index, and if the Index value
+ is beyond the implemented IBR register range, a Reserved Register/Field fault may
+ occur. The caller must either guarantee that Index is valid, or the caller must
+ set up fault handlers to catch the faults.
+ This function is only available on IPF.
+
+ @param Index The 8-bit Instruction Breakpoint Register index to read.
+
+ @return The current value of Instruction Breakpoint Register specified by Index.
+
+**/
+UINT64
+EFIAPI
+AsmReadIbr (
+ IN UINT8 Index
+ );
+
+
+/**
+ Reads the current value of Data Breakpoint Register (DBR).
+
+ The Data Breakpoint Registers are used in pairs. The even numbered registers
+ contain breakpoint addresses, and odd numbered registers contain breakpoint
+ mask conditions. At least 4 data registers pairs are implemented on all processor
+ models. Implemented registers are contiguous starting with register 0.
+ No parameter checking is performed on Index. If the Index value is beyond
+ the implemented DBR register range, a Reserved Register/Field fault may occur.
+ The caller must either guarantee that Index is valid, or the caller must set up
+ fault handlers to catch the faults.
+ This function is only available on IPF.
+
+ @param Index The 8-bit Data Breakpoint Register index to read.
+
+ @return The current value of Data Breakpoint Register specified by Index.
+
+**/
+UINT64
+EFIAPI
+AsmReadDbr (
+ IN UINT8 Index
+ );
+
+
+/**
+ Reads the current value of Performance Monitor Configuration Register (PMC).
+
+ All processor implementations provide at least 4 performance counters
+ (PMC/PMD [4]...PMC/PMD [7] pairs), and 4 performance monitor counter overflow
+ status registers (PMC [0]¡ PMC [3]). Processor implementations may provide
+ additional implementation-dependent PMC and PMD to increase the number of
+ ¡®generic¡¯ performance counters (PMC/PMD pairs). The remainder of PMC and PMD
+ register set is implementation dependent. No parameter checking is performed
+ on Index. If the Index value is beyond the implemented PMC register range,
+ zero value will be returned.
+ This function is only available on IPF.
+
+ @param Index The 8-bit Performance Monitor Configuration Register index to read.
+
+ @return The current value of Performance Monitor Configuration Register
+ specified by Index.
+
+**/
+UINT64
+EFIAPI
+AsmReadPmc (
+ IN UINT8 Index
+ );
+
+
+/**
+ Reads the current value of Performance Monitor Data Register (PMD).
+
+ All processor implementations provide at least 4 performance counters
+ (PMC/PMD [4]...PMC/PMD [7] pairs), and 4 performance monitor counter
+ overflow status registers (PMC [0]¡ PMC [3]). Processor implementations may
+ provide additional implementation-dependent PMC and PMD to increase the number
+ of ¡®generic¡¯ performance counters (PMC/PMD pairs). The remainder of PMC and PMD
+ register set is implementation dependent. No parameter checking is performed
+ on Index. If the Index value is beyond the implemented PMD register range,
+ zero value will be returned.
+ This function is only available on IPF.
+
+ @param Index The 8-bit Performance Monitor Data Register index to read.
+
+ @return The current value of Performance Monitor Data Register specified by Index.
+
+**/
+UINT64
+EFIAPI
+AsmReadPmd (
+ IN UINT8 Index
+ );
+
+
+/**
+ Writes the current value of 64-bit Instruction Breakpoint Register (IBR).
+
+ Writes current value of Instruction Breakpoint Register specified by Index.
+ The Instruction Breakpoint Registers are used in pairs. The even numbered
+ registers contain breakpoint addresses, and odd numbered registers contain
+ breakpoint mask conditions. At least 4 instruction registers pairs are implemented
+ on all processor models. Implemented registers are contiguous starting with
+ register 0. No parameter checking is performed on Index. If the Index value
+ is beyond the implemented IBR register range, a Reserved Register/Field fault may
+ occur. The caller must either guarantee that Index is valid, or the caller must
+ set up fault handlers to catch the faults.
+ This function is only available on IPF.
+
+ @param Index The 8-bit Instruction Breakpoint Register index to write.
+ @param Value The 64-bit value to write to IBR.
+
+ @return The 64-bit value written to the IBR.
+
+**/
+UINT64
+EFIAPI
+AsmWriteIbr (
+ IN UINT8 Index,
+ IN UINT64 Value
+ );
+
+
+/**
+ Writes the current value of 64-bit Data Breakpoint Register (DBR).
+
+ Writes current value of Data Breakpoint Register specified by Index.
+ The Data Breakpoint Registers are used in pairs. The even numbered registers
+ contain breakpoint addresses, and odd numbered registers contain breakpoint
+ mask conditions. At least 4 data registers pairs are implemented on all processor
+ models. Implemented registers are contiguous starting with register 0. No parameter
+ checking is performed on Index. If the Index value is beyond the implemented
+ DBR register range, a Reserved Register/Field fault may occur. The caller must
+ either guarantee that Index is valid, or the caller must set up fault handlers to
+ catch the faults.
+ This function is only available on IPF.
+
+ @param Index The 8-bit Data Breakpoint Register index to write.
+ @param Value The 64-bit value to write to DBR.
+
+ @return The 64-bit value written to the DBR.
+
+**/
+UINT64
+EFIAPI
+AsmWriteDbr (
+ IN UINT8 Index,
+ IN UINT64 Value
+ );
+
+
+/**
+ Writes the current value of 64-bit Performance Monitor Configuration Register (PMC).
+
+ Writes current value of Performance Monitor Configuration Register specified by Index.
+ All processor implementations provide at least 4 performance counters
+ (PMC/PMD [4]...PMC/PMD [7] pairs), and 4 performance monitor counter overflow status
+ registers (PMC [0]¡ PMC [3]). Processor implementations may provide additional
+ implementation-dependent PMC and PMD to increase the number of ¡®generic¡¯ performance
+ counters (PMC/PMD pairs). The remainder of PMC and PMD register set is implementation
+ dependent. No parameter checking is performed on Index. If the Index value is
+ beyond the implemented PMC register range, the write is ignored.
+ This function is only available on IPF.
+
+ @param Index The 8-bit Performance Monitor Configuration Register index to write.
+ @param Value The 64-bit value to write to PMC.
+
+ @return The 64-bit value written to the PMC.
+
+**/
+UINT64
+EFIAPI
+AsmWritePmc (
+ IN UINT8 Index,
+ IN UINT64 Value
+ );
+
+
+/**
+ Writes the current value of 64-bit Performance Monitor Data Register (PMD).
+
+ Writes current value of Performance Monitor Data Register specified by Index.
+ All processor implementations provide at least 4 performance counters
+ (PMC/PMD [4]...PMC/PMD [7] pairs), and 4 performance monitor counter overflow
+ status registers (PMC [0]¡ PMC [3]). Processor implementations may provide
+ additional implementation-dependent PMC and PMD to increase the number of ¡®generic¡¯
+ performance counters (PMC/PMD pairs). The remainder of PMC and PMD register set
+ is implementation dependent. No parameter checking is performed on Index. If the
+ Index value is beyond the implemented PMD register range, the write is ignored.
+ This function is only available on IPF.
+
+ @param Index The 8-bit Performance Monitor Data Register index to write.
+ @param Value The 64-bit value to write to PMD.
+
+ @return The 64-bit value written to the PMD.
+
+**/
+UINT64
+EFIAPI
+AsmWritePmd (
+ IN UINT8 Index,
+ IN UINT64 Value
+ );
+
+
+/**
+ Reads the current value of 64-bit Global Pointer (GP).
+
+ Reads and returns the current value of GP.
+ This function is only available on IPF.
+
+ @return The current value of GP.
+
+**/
+UINT64
+EFIAPI
+AsmReadGp (
+ VOID
+ );
+
+
+/**
+ Write the current value of 64-bit Global Pointer (GP).
+
+ Writes the current value of GP. The 64-bit value written to the GP is returned.
+ No parameter checking is performed on Value.
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to GP.
+
+ @return The 64-bit value written to the GP.
+
+**/
+UINT64
+EFIAPI
+AsmWriteGp (
+ IN UINT64 Value
+ );
+
+
+/**
+ Reads the current value of 64-bit Stack Pointer (SP).
+
+ Reads and returns the current value of SP.
+ This function is only available on IPF.
+
+ @return The current value of SP.
+
+**/
+UINT64
+EFIAPI
+AsmReadSp (
+ VOID
+ );
+
+
+/**
+ Determines if the CPU is currently executing in virtual, physical, or mixed mode.
+
+ Determines the current execution mode of the CPU.
+ If the CPU is in virtual mode(PSR.RT=1, PSR.DT=1, PSR.IT=1), then 1 is returned.
+ If the CPU is in physical mode(PSR.RT=0, PSR.DT=0, PSR.IT=0), then 0 is returned.
+ If the CPU is not in physical mode or virtual mode, then it is in mixed mode,
+ and -1 is returned.
+ This function is only available on IPF.
+
+ @return 1 The CPU is in virtual mode.
+ @return 0 The CPU is in physical mode.
+ @return -1 The CPU is in mixed mode.
+
+**/
+INT64
+EFIAPI
+AsmCpuVirtual (
+ VOID
+ );
+
+
+/**
+ Makes a PAL procedure call.
+
+ This is a wrapper function to make a PAL procedure call. Based on the Index
+ value this API will make static or stacked PAL call. The following table
+ describes the usage of PAL Procedure Index Assignment. Architected procedures
+ may be designated as required or optional. If a PAL procedure is specified
+ as optional, a unique return code of 0xFFFFFFFFFFFFFFFF is returned in the
+ Status field of the PAL_CALL_RETURN structure.
+ This indicates that the procedure is not present in this PAL implementation.
+ It is the caller¡¯s responsibility to check for this return code after calling
+ any optional PAL procedure.
+ No parameter checking is performed on the 5 input parameters, but there are
+ some common rules that the caller should follow when making a PAL call. Any
+ address passed to PAL as buffers for return parameters must be 8-byte aligned.
+ Unaligned addresses may cause undefined results. For those parameters defined
+ as reserved or some fields defined as reserved must be zero filled or the invalid
+ argument return value may be returned or undefined result may occur during the
+ execution of the procedure. If the PalEntryPoint does not point to a valid
+ PAL entry point then the system behavior is undefined. This function is only
+ available on IPF.
+
+ @param PalEntryPoint The PAL procedure calls entry point.
+ @param Index The PAL procedure Index number.
+ @param Arg2 The 2nd parameter for PAL procedure calls.
+ @param Arg3 The 3rd parameter for PAL procedure calls.
+ @param Arg4 The 4th parameter for PAL procedure calls.
+
+ @return structure returned from the PAL Call procedure, including the status and return value.
+
+**/
+PAL_CALL_RETURN
+EFIAPI
+AsmPalCall (
+ IN UINT64 PalEntryPoint,
+ IN UINT64 Index,
+ IN UINT64 Arg2,
+ IN UINT64 Arg3,
+ IN UINT64 Arg4
+ );
+
+
+/**
+ Transfers control to a function starting with a new stack.
+
+ Transfers control to the function specified by EntryPoint using the new stack
+ specified by NewStack and passing in the parameters specified by Context1 and
+ Context2. Context1 and Context2 are optional and may be NULL. The function
+ EntryPoint must never return.
+
+ If EntryPoint is NULL, then ASSERT().
+ If NewStack is NULL, then ASSERT().
+
+ @param EntryPoint A pointer to function to call with the new stack.
+ @param Context1 A pointer to the context to pass into the EntryPoint
+ function.
+ @param Context2 A pointer to the context to pass into the EntryPoint
+ function.
+ @param NewStack A pointer to the new stack to use for the EntryPoint
+ function.
+ @param NewBsp A pointer to the new memory location for RSE backing
+ store.
+
+**/
+VOID
+EFIAPI
+AsmSwitchStackAndBackingStore (
+ IN SWITCH_STACK_ENTRY_POINT EntryPoint,
+ IN VOID *Context1, OPTIONAL
+ IN VOID *Context2, OPTIONAL
+ IN VOID *NewStack,
+ IN VOID *NewBsp
+ );
+
+
+//
+// Bugbug: This call should be removed after
+// the PalCall Instance issue has been fixed.
+//
+/**
+ Performs a PAL call using static calling convention.
+
+ An internal function to perform a PAL call using static calling convention.
+
+ @param PalEntryPoint The entry point address of PAL. The address in ar.kr5
+ would be used if this parameter were NULL on input.
+ @param Arg1 The first argument of a PAL call.
+ @param Arg1 The second argument of a PAL call.
+ @param Arg1 The third argument of a PAL call.
+ @param Arg1 The fourth argument of a PAL call.
+
+ @return The values returned in r8, r9, r10 and r11.
+
+**/
+PAL_CALL_RETURN
+PalCallStatic (
+ IN CONST VOID *PalEntryPoint,
+ IN UINT64 Arg1,
+ IN UINT64 Arg2,
+ IN UINT64 Arg3,
+ IN UINT64 Arg4
+ );
+
+
+#elif defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
+//
+// IA32 and X64 Specific Functions
+//
+//
+// Byte packed structure for 16-bit Real Mode EFLAGS
+//
+typedef union {
+ struct {
+ UINT32 CF:1; // Carry Flag
+ UINT32 Reserved_0:1; // Reserved
+ UINT32 PF:1; // Parity Flag
+ UINT32 Reserved_1:1; // Reserved
+ UINT32 AF:1; // Auxiliary Carry Flag
+ UINT32 Reserved_2:1; // Reserved
+ UINT32 ZF:1; // Zero Flag
+ UINT32 SF:1; // Sign Flag
+ UINT32 TF:1; // Trap Flag
+ UINT32 IF:1; // Interrupt Enable Flag
+ UINT32 DF:1; // Direction Flag
+ UINT32 OF:1; // Overflow Flag
+ UINT32 IOPL:2; // I/O Privilege Level
+ UINT32 NT:1; // Nested Task
+ UINT32 Reserved_3:1; // Reserved
+ } Bits;
+ UINT16 Uint16;
+} IA32_FLAGS16;
+
+//
+// Byte packed structure for EFLAGS/RFLAGS
+// 32-bits on IA-32
+// 64-bits on X64. The upper 32-bits on X64 are reserved
+//
+typedef union {
+ struct {
+ UINT32 CF:1; // Carry Flag
+ UINT32 Reserved_0:1; // Reserved
+ UINT32 PF:1; // Parity Flag
+ UINT32 Reserved_1:1; // Reserved
+ UINT32 AF:1; // Auxiliary Carry Flag
+ UINT32 Reserved_2:1; // Reserved
+ UINT32 ZF:1; // Zero Flag
+ UINT32 SF:1; // Sign Flag
+ UINT32 TF:1; // Trap Flag
+ UINT32 IF:1; // Interrupt Enable Flag
+ UINT32 DF:1; // Direction Flag
+ UINT32 OF:1; // Overflow Flag
+ UINT32 IOPL:2; // I/O Privilege Level
+ UINT32 NT:1; // Nested Task
+ UINT32 Reserved_3:1; // Reserved
+ UINT32 RF:1; // Resume Flag
+ UINT32 VM:1; // Virtual 8086 Mode
+ UINT32 AC:1; // Alignment Check
+ UINT32 VIF:1; // Virtual Interrupt Flag
+ UINT32 VIP:1; // Virtual Interrupt Pending
+ UINT32 ID:1; // ID Flag
+ UINT32 Reserved_4:10; // Reserved
+ } Bits;
+ UINTN UintN;
+} IA32_EFLAGS32;
+
+//
+// Byte packed structure for Control Register 0 (CR0)
+// 32-bits on IA-32
+// 64-bits on X64. The upper 32-bits on X64 are reserved
+//
+typedef union {
+ struct {
+ UINT32 PE:1; // Protection Enable
+ UINT32 MP:1; // Monitor Coprocessor
+ UINT32 EM:1; // Emulation
+ UINT32 TS:1; // Task Switched
+ UINT32 ET:1; // Extension Type
+ UINT32 NE:1; // Numeric Error
+ UINT32 Reserved_0:10; // Reserved
+ UINT32 WP:1; // Write Protect
+ UINT32 Reserved_1:1; // Reserved
+ UINT32 AM:1; // Alignment Mask
+ UINT32 Reserved_2:10; // Reserved
+ UINT32 NW:1; // Mot Write-through
+ UINT32 CD:1; // Cache Disable
+ UINT32 PG:1; // Paging
+ } Bits;
+ UINTN UintN;
+} IA32_CR0;
+
+//
+// Byte packed structure for Control Register 4 (CR4)
+// 32-bits on IA-32
+// 64-bits on X64. The upper 32-bits on X64 are reserved
+//
+typedef union {
+ struct {
+ UINT32 VME:1; // Virtual-8086 Mode Extensions
+ UINT32 PVI:1; // Protected-Mode Virtual Interrupts
+ UINT32 TSD:1; // Time Stamp Disable
+ UINT32 DE:1; // Debugging Extensions
+ UINT32 PSE:1; // Page Size Extensions
+ UINT32 PAE:1; // Physical Address Extension
+ UINT32 MCE:1; // Machine Check Enable
+ UINT32 PGE:1; // Page Global Enable
+ UINT32 PCE:1; // Performance Monitoring Counter
+ // Enable
+ UINT32 OSFXSR:1; // Operating System Support for
+ // FXSAVE and FXRSTOR instructions
+ UINT32 OSXMMEXCPT:1; // Operating System Support for
+ // Unmasked SIMD Floating Point
+ // Exceptions
+ UINT32 Reserved_0:2; // Reserved
+ UINT32 VMXE:1; // VMX Enable
+ UINT32 Reserved_1:18; // Reseved
+ } Bits;
+ UINTN UintN;
+} IA32_CR4;
+
+//
+// Byte packed structure for an IDTR, GDTR, LDTR descriptor
+/// @bug How to make this structure byte-packed in a compiler independent way?
+//
+#pragma pack (1)
typedef struct {
UINT16 Limit;
UINTN Base;
OUT UINT32 *Edx OPTIONAL
);
+
/**
Retrieves CPUID information using an extended leaf identifier.
OUT UINT32 *Edx OPTIONAL
);
+
/**
Returns the lower 32-bits of a Machine Specific Register(MSR).
IN UINT32 Index
);
+
/**
Zero-extend a 32-bit value and writes it to a Machine Specific Register(MSR).
IN UINT32 Value
);
+
/**
Reads a 64-bit MSR, performs a bitwise inclusive OR on the lower 32-bits, and
writes the result back to the 64-bit MSR.
IN UINT32 OrData
);
+
/**
Reads a 64-bit MSR, performs a bitwise AND on the lower 32-bits, and writes
the result back to the 64-bit MSR.
IN UINT32 AndData
);
+
/**
Reads a 64-bit MSR, performs a bitwise AND followed by a bitwise inclusive OR
on the lower 32-bits, and writes the result back to the 64-bit MSR.
IN UINT32 OrData
);
+
/**
Reads a bit field of an MSR.
IN UINTN EndBit
);
+
/**
Writes a bit field to an MSR.
IN UINT32 Value
);
+
/**
Reads a bit field in a 64-bit MSR, performs a bitwise OR, and writes the
result back to the bit field in the 64-bit MSR.
IN UINT32 OrData
);
+
/**
Reads a bit field in a 64-bit MSR, performs a bitwise AND, and writes the
result back to the bit field in the 64-bit MSR.
IN UINT32 AndData
);
+
/**
Reads a bit field in a 64-bit MSR, performs a bitwise AND followed by a
bitwise inclusive OR, and writes the result back to the bit field in the
IN UINT32 OrData
);
+
/**
Returns a 64-bit Machine Specific Register(MSR).
IN UINT32 Index
);
+
/**
Writes a 64-bit value to a Machine Specific Register(MSR), and returns the
value.
IN UINT64 Value
);
+
/**
Reads a 64-bit MSR, performs a bitwise inclusive OR, and writes the result
back to the 64-bit MSR.
IN UINT64 OrData
);
+
/**
Reads a 64-bit MSR, performs a bitwise AND, and writes the result back to the
64-bit MSR.
IN UINT64 AndData
);
+
/**
Reads a 64-bit MSR, performs a bitwise AND followed by a bitwise inclusive
OR, and writes the result back to the 64-bit MSR.
IN UINT64 OrData
);
+
/**
Reads a bit field of an MSR.
IN UINTN EndBit
);
+
/**
Writes a bit field to an MSR.
IN UINT64 Value
);
+
/**
Reads a bit field in a 64-bit MSR, performs a bitwise inclusive OR, and
writes the result back to the bit field in the 64-bit MSR.
IN UINT64 OrData
);
+
/**
Reads a bit field in a 64-bit MSR, performs a bitwise AND, and writes the
result back to the bit field in the 64-bit MSR.
IN UINT64 AndData
);
+
/**
Reads a bit field in a 64-bit MSR, performs a bitwise AND followed by a
bitwise inclusive OR, and writes the result back to the bit field in the
IN UINT64 OrData
);
+
/**
Reads the current value of the EFLAGS register.
VOID
);
+
/**
Reads the current value of the Control Register 0 (CR0).
VOID
);
+
/**
Reads the current value of the Control Register 2 (CR2).
VOID
);
+
/**
Reads the current value of the Control Register 3 (CR3).
VOID
);
+
/**
Reads the current value of the Control Register 4 (CR4).
VOID
);
+
/**
Writes a value to Control Register 0 (CR0).
UINTN Cr0
);
+
/**
Writes a value to Control Register 2 (CR2).
UINTN Cr2
);
+
/**
Writes a value to Control Register 3 (CR3).
UINTN Cr3
);
+
/**
Writes a value to Control Register 4 (CR4).
UINTN Cr4
);
+
/**
Reads the current value of Debug Register 0 (DR0).
VOID
);
+
/**
Reads the current value of Debug Register 1 (DR1).
VOID
);
+
/**
Reads the current value of Debug Register 2 (DR2).
VOID
);
+
/**
Reads the current value of Debug Register 3 (DR3).
VOID
);
+
/**
Reads the current value of Debug Register 4 (DR4).
VOID
);
+
/**
Reads the current value of Debug Register 5 (DR5).
VOID
);
+
/**
Reads the current value of Debug Register 6 (DR6).
VOID
);
+
/**
Reads the current value of Debug Register 7 (DR7).
VOID
);
+
/**
Writes a value to Debug Register 0 (DR0).
UINTN Dr0
);
+
/**
Writes a value to Debug Register 1 (DR1).
UINTN Dr1
);
+
/**
Writes a value to Debug Register 2 (DR2).
UINTN Dr2
);
+
/**
Writes a value to Debug Register 3 (DR3).
UINTN Dr3
);
+
/**
Writes a value to Debug Register 4 (DR4).
UINTN Dr4
);
+
/**
Writes a value to Debug Register 5 (DR5).
UINTN Dr5
);
+
/**
Writes a value to Debug Register 6 (DR6).
UINTN Dr6
);
+
/**
Writes a value to Debug Register 7 (DR7).
UINTN Dr7
);
+
/**
Reads the current value of Code Segment Register (CS).
VOID
);
+
/**
Reads the current value of Data Segment Register (DS).
VOID
);
+
/**
Reads the current value of Extra Segment Register (ES).
VOID
);
+
/**
Reads the current value of FS Data Segment Register (FS).
VOID
);
+
/**
Reads the current value of GS Data Segment Register (GS).
VOID
);
+
/**
Reads the current value of Stack Segment Register (SS).
VOID
);
+
/**
Reads the current value of Task Register (TR).
VOID
);
+
/**
Reads the current Global Descriptor Table Register(GDTR) descriptor.
OUT IA32_DESCRIPTOR *Gdtr
);
+
/**
Writes the current Global Descriptor Table Register (GDTR) descriptor.
IN CONST IA32_DESCRIPTOR *Gdtr
);
+
/**
Reads the current Interrupt Descriptor Table Register(GDTR) descriptor.
OUT IA32_DESCRIPTOR *Idtr
);
+
/**
Writes the current Interrupt Descriptor Table Register(GDTR) descriptor.
IN CONST IA32_DESCRIPTOR *Idtr
);
+
/**
Reads the current Local Descriptor Table Register(LDTR) selector.
VOID
);
+
/**
Writes the current Local Descriptor Table Register (GDTR) selector.
IN UINT16 Ldtr
);
+
/**
Save the current floating point/SSE/SSE2 context to a buffer.
OUT IA32_FX_BUFFER *Buffer
);
+
/**
Restores the current floating point/SSE/SSE2 context from a buffer.
IN CONST IA32_FX_BUFFER *Buffer
);
+
/**
Reads the current value of 64-bit MMX Register #0 (MM0).
VOID
);
+
/**
Reads the current value of 64-bit MMX Register #1 (MM1).
VOID
);
+
/**
Reads the current value of 64-bit MMX Register #2 (MM2).
VOID
);
+
/**
Reads the current value of 64-bit MMX Register #3 (MM3).
VOID
);
+
/**
Reads the current value of 64-bit MMX Register #4 (MM4).
VOID
);
+
/**
Reads the current value of 64-bit MMX Register #5 (MM5).
VOID
);
+
/**
Reads the current value of 64-bit MMX Register #6 (MM6).
VOID
);
+
/**
Reads the current value of 64-bit MMX Register #7 (MM7).
VOID
);
+
/**
Writes the current value of 64-bit MMX Register #0 (MM0).
IN UINT64 Value
);
+
/**
Writes the current value of 64-bit MMX Register #1 (MM1).
IN UINT64 Value
);
+
/**
Writes the current value of 64-bit MMX Register #2 (MM2).
IN UINT64 Value
);
+
/**
Writes the current value of 64-bit MMX Register #3 (MM3).
IN UINT64 Value
);
+
/**
Writes the current value of 64-bit MMX Register #4 (MM4).
IN UINT64 Value
);
+
/**
Writes the current value of 64-bit MMX Register #5 (MM5).
IN UINT64 Value
);
+
/**
Writes the current value of 64-bit MMX Register #6 (MM6).
IN UINT64 Value
);
+
/**
Writes the current value of 64-bit MMX Register #7 (MM7).
IN UINT64 Value
);
+
/**
Reads the current value of Time Stamp Counter (TSC).
VOID
);
+
/**
Reads the current value of a Performance Counter (PMC).
IN UINT32 Index
);
+
/**
Sets up a monitor buffer that is used by AsmMwait().
IN UINTN Edx
);
+
/**
Executes an MWAIT instruction.
IN UINTN Ecx
);
+
/**
Executes a WBINVD instruction.
VOID
);
+
/**
Executes a INVD instruction.
VOID
);
+
/**
Flushes a cache line from all the instruction and data caches within the
coherency domain of the CPU.
IN VOID *LinearAddress
);
+
/**
Enables the 32-bit paging mode on the CPU.
IN VOID *NewStack
);
+
/**
Disables the 32-bit paging mode on the CPU.
IN VOID *NewStack
);
+
/**
Enables the 64-bit paging mode on the CPU.
IN UINT64 NewStack
);
+
/**
Disables the 64-bit paging mode on the CPU.
IN UINT32 NewStack
);
+
//
// 16-bit thunking services
//
OUT UINT32 *ExtraStackSize
);
+
/**
Prepares all structures a code required to use AsmThunk16().
OUT THUNK_CONTEXT *ThunkContext
);
+
/**
Transfers control to a 16-bit real mode entry point and returns the results.
IN OUT THUNK_CONTEXT *ThunkContext
);
+
/**
Prepares all structures and code for a 16-bit real mode thunk, transfers
control to a 16-bit real mode entry point, and returns the results.
IN OUT THUNK_CONTEXT *ThunkContext
);
-typedef struct {
- UINT64 Status;
- UINT64 r9;
- UINT64 r10;
- UINT64 r11;
-} PAL_PROC_RETURN;
-
-//
-// IPF Specific functions
-//
-
-
-/**
- Performs a PAL call using static calling convention.
-
- An internal function to perform a PAL call using static calling convention.
-
- @param PalEntryPoint The entry point address of PAL. The address in ar.kr5
- would be used if this parameter were NULL on input.
- @param Arg1 The first argument of a PAL call.
- @param Arg1 The second argument of a PAL call.
- @param Arg1 The third argument of a PAL call.
- @param Arg1 The fourth argument of a PAL call.
-
- @return The values returned in r8, r9, r10 and r11.
-
-**/
-PAL_PROC_RETURN
-PalCallStatic (
- IN CONST VOID *PalEntryPoint,
- IN UINT64 Arg1,
- IN UINT64 Arg2,
- IN UINT64 Arg3,
- IN UINT64 Arg4
- );
-
-
-/**
- Returns the current value of ar.itc.
-
- An internal function to return the current value of ar.itc, which is the
- timer tick on IPF.
-
- @return The currect value of ar.itc
-
-**/
-INT64
-IpfReadItc (
- VOID
- );
-
-
-/**
- Flush a range of cache lines in the cache coherency domain of the calling
- CPU.
-
- Invalidates the cache lines specified by Address and Length. If Address is
- not aligned on a cache line boundary, then entire cache line containing
- Address is invalidated. If Address + Length is not aligned on a cache line
- boundary, then the entire instruction cache line containing Address + Length
- -1 is invalidated. This function may choose to invalidate the entire
- instruction cache if that is more efficient than invalidating the specified
- range. If Length is 0, the no instruction cache lines are invalidated.
- Address is returned.
-
- If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().
-
- @param Address The base address of the instruction lines to invalidate. If
- the CPU is in a physical addressing mode, then Address is a
- physical address. If the CPU is in a virtual addressing mode,
- then Address is a virtual address.
-
- @param Length The number of bytes to invalidate from the instruction cache.
-
- @return Address
+#else
-**/
-VOID *
-EFIAPI
-IpfFlushCacheRange (
- IN VOID *Address,
- IN UINTN Length
- );
+#endif
#endif