Synchronize BaseLib h files to c files.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6983 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
#include "BaseLibInternals.h"
|
#include "BaseLibInternals.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Worker function that returns a bit field from Operand
|
Worker function that returns a bit field from Operand.
|
||||||
|
|
||||||
Returns the bitfield specified by the StartBit and the EndBit from Operand.
|
Returns the bitfield specified by the StartBit and the EndBit from Operand.
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ BitFieldReadUint (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Worker function that reads a bit field from Operand, performs a bitwise OR,
|
Worker function that reads a bit field from Operand, performs a bitwise OR,
|
||||||
and returns the result.
|
and returns the result.
|
||||||
|
|
||||||
Performs a bitwise OR between the bit field specified by StartBit and EndBit
|
Performs a bitwise OR between the bit field specified by StartBit and EndBit
|
||||||
@@ -74,7 +74,7 @@ BitFieldOrUint (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Worker function that reads a bit field from Operand, performs a bitwise AND,
|
Worker function that reads a bit field from Operand, performs a bitwise AND,
|
||||||
and returns the result.
|
and returns the result.
|
||||||
|
|
||||||
Performs a bitwise AND between the bit field specified by StartBit and EndBit
|
Performs a bitwise AND between the bit field specified by StartBit and EndBit
|
||||||
|
@@ -36,8 +36,8 @@
|
|||||||
UINT8
|
UINT8
|
||||||
EFIAPI
|
EFIAPI
|
||||||
CalculateSum8 (
|
CalculateSum8 (
|
||||||
IN CONST UINT8 *Buffer,
|
IN CONST UINT8 *Buffer,
|
||||||
IN UINTN Length
|
IN UINTN Length
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT8 Sum;
|
UINT8 Sum;
|
||||||
@@ -75,8 +75,8 @@ CalculateSum8 (
|
|||||||
UINT8
|
UINT8
|
||||||
EFIAPI
|
EFIAPI
|
||||||
CalculateCheckSum8 (
|
CalculateCheckSum8 (
|
||||||
IN CONST UINT8 *Buffer,
|
IN CONST UINT8 *Buffer,
|
||||||
IN UINTN Length
|
IN UINTN Length
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT8 CheckSum;
|
UINT8 CheckSum;
|
||||||
@@ -111,8 +111,8 @@ CalculateCheckSum8 (
|
|||||||
UINT16
|
UINT16
|
||||||
EFIAPI
|
EFIAPI
|
||||||
CalculateSum16 (
|
CalculateSum16 (
|
||||||
IN CONST UINT16 *Buffer,
|
IN CONST UINT16 *Buffer,
|
||||||
IN UINTN Length
|
IN UINTN Length
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT16 Sum;
|
UINT16 Sum;
|
||||||
@@ -156,8 +156,8 @@ CalculateSum16 (
|
|||||||
UINT16
|
UINT16
|
||||||
EFIAPI
|
EFIAPI
|
||||||
CalculateCheckSum16 (
|
CalculateCheckSum16 (
|
||||||
IN CONST UINT16 *Buffer,
|
IN CONST UINT16 *Buffer,
|
||||||
IN UINTN Length
|
IN UINTN Length
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT16 CheckSum;
|
UINT16 CheckSum;
|
||||||
@@ -193,8 +193,8 @@ CalculateCheckSum16 (
|
|||||||
UINT32
|
UINT32
|
||||||
EFIAPI
|
EFIAPI
|
||||||
CalculateSum32 (
|
CalculateSum32 (
|
||||||
IN CONST UINT32 *Buffer,
|
IN CONST UINT32 *Buffer,
|
||||||
IN UINTN Length
|
IN UINTN Length
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT32 Sum;
|
UINT32 Sum;
|
||||||
@@ -238,8 +238,8 @@ CalculateSum32 (
|
|||||||
UINT32
|
UINT32
|
||||||
EFIAPI
|
EFIAPI
|
||||||
CalculateCheckSum32 (
|
CalculateCheckSum32 (
|
||||||
IN CONST UINT32 *Buffer,
|
IN CONST UINT32 *Buffer,
|
||||||
IN UINTN Length
|
IN UINTN Length
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT32 CheckSum;
|
UINT32 CheckSum;
|
||||||
@@ -275,8 +275,8 @@ CalculateCheckSum32 (
|
|||||||
UINT64
|
UINT64
|
||||||
EFIAPI
|
EFIAPI
|
||||||
CalculateSum64 (
|
CalculateSum64 (
|
||||||
IN CONST UINT64 *Buffer,
|
IN CONST UINT64 *Buffer,
|
||||||
IN UINTN Length
|
IN UINTN Length
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT64 Sum;
|
UINT64 Sum;
|
||||||
@@ -320,8 +320,8 @@ CalculateSum64 (
|
|||||||
UINT64
|
UINT64
|
||||||
EFIAPI
|
EFIAPI
|
||||||
CalculateCheckSum64 (
|
CalculateCheckSum64 (
|
||||||
IN CONST UINT64 *Buffer,
|
IN CONST UINT64 *Buffer,
|
||||||
IN UINTN Length
|
IN UINTN Length
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT64 CheckSum;
|
UINT64 CheckSum;
|
||||||
|
@@ -15,14 +15,14 @@
|
|||||||
#include "BaseLibInternals.h"
|
#include "BaseLibInternals.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Worker function that locates the Node in the List
|
Worker function that locates the Node in the List.
|
||||||
|
|
||||||
By searching the List, finds the location of the Node in List. At the same time,
|
By searching the List, finds the location of the Node in List. At the same time,
|
||||||
verifies the validity of this list.
|
verifies the validity of this list.
|
||||||
|
|
||||||
If List is NULL, then ASSERT().
|
If List is NULL, then ASSERT().
|
||||||
If List->ForwardLink is NULL, then ASSERT().
|
If List->ForwardLink is NULL, then ASSERT().
|
||||||
If List->BackLink is NULL, then ASSERT().
|
If List->backLink is NULL, then ASSERT().
|
||||||
If Node is NULL, then ASSERT();
|
If Node is NULL, then ASSERT();
|
||||||
If PcdMaximumLinkedListLenth is not zero, and prior to insertion the number
|
If PcdMaximumLinkedListLenth is not zero, and prior to insertion the number
|
||||||
of nodes in ListHead, including the ListHead node, is greater than or
|
of nodes in ListHead, including the ListHead node, is greater than or
|
||||||
@@ -93,15 +93,15 @@ IsNodeInList (
|
|||||||
LIST_ENTRY *
|
LIST_ENTRY *
|
||||||
EFIAPI
|
EFIAPI
|
||||||
InitializeListHead (
|
InitializeListHead (
|
||||||
IN OUT LIST_ENTRY *List
|
IN OUT LIST_ENTRY *ListHead
|
||||||
)
|
)
|
||||||
|
|
||||||
{
|
{
|
||||||
ASSERT (List != NULL);
|
ASSERT (ListHead != NULL);
|
||||||
|
|
||||||
List->ForwardLink = List;
|
ListHead->ForwardLink = ListHead;
|
||||||
List->BackLink = List;
|
ListHead->BackLink = ListHead;
|
||||||
return List;
|
return ListHead;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -129,20 +129,20 @@ InitializeListHead (
|
|||||||
LIST_ENTRY *
|
LIST_ENTRY *
|
||||||
EFIAPI
|
EFIAPI
|
||||||
InsertHeadList (
|
InsertHeadList (
|
||||||
IN OUT LIST_ENTRY *List,
|
IN OUT LIST_ENTRY *ListHead,
|
||||||
IN OUT LIST_ENTRY *Entry
|
IN OUT LIST_ENTRY *Entry
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// ASSERT List not too long and Entry is not one of the nodes of List
|
// ASSERT List not too long and Entry is not one of the nodes of List
|
||||||
//
|
//
|
||||||
ASSERT (!IsNodeInList (List, Entry));
|
ASSERT (!IsNodeInList (ListHead, Entry));
|
||||||
|
|
||||||
Entry->ForwardLink = List->ForwardLink;
|
Entry->ForwardLink = ListHead->ForwardLink;
|
||||||
Entry->BackLink = List;
|
Entry->BackLink = ListHead;
|
||||||
Entry->ForwardLink->BackLink = Entry;
|
Entry->ForwardLink->BackLink = Entry;
|
||||||
List->ForwardLink = Entry;
|
ListHead->ForwardLink = Entry;
|
||||||
return List;
|
return ListHead;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -170,20 +170,20 @@ InsertHeadList (
|
|||||||
LIST_ENTRY *
|
LIST_ENTRY *
|
||||||
EFIAPI
|
EFIAPI
|
||||||
InsertTailList (
|
InsertTailList (
|
||||||
IN OUT LIST_ENTRY *List,
|
IN OUT LIST_ENTRY *ListHead,
|
||||||
IN OUT LIST_ENTRY *Entry
|
IN OUT LIST_ENTRY *Entry
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// ASSERT List not too long and Entry is not one of the nodes of List
|
// ASSERT List not too long and Entry is not one of the nodes of List
|
||||||
//
|
//
|
||||||
ASSERT (!IsNodeInList (List, Entry));
|
ASSERT (!IsNodeInList (ListHead, Entry));
|
||||||
|
|
||||||
Entry->ForwardLink = List;
|
Entry->ForwardLink = ListHead;
|
||||||
Entry->BackLink = List->BackLink;
|
Entry->BackLink = ListHead->BackLink;
|
||||||
Entry->BackLink->ForwardLink = Entry;
|
Entry->BackLink->ForwardLink = Entry;
|
||||||
List->BackLink = Entry;
|
ListHead->BackLink = Entry;
|
||||||
return List;
|
return ListHead;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -209,7 +209,7 @@ InsertTailList (
|
|||||||
LIST_ENTRY *
|
LIST_ENTRY *
|
||||||
EFIAPI
|
EFIAPI
|
||||||
GetFirstNode (
|
GetFirstNode (
|
||||||
IN CONST LIST_ENTRY *List
|
IN CONST LIST_ENTRY *List
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -245,8 +245,8 @@ GetFirstNode (
|
|||||||
LIST_ENTRY *
|
LIST_ENTRY *
|
||||||
EFIAPI
|
EFIAPI
|
||||||
GetNextNode (
|
GetNextNode (
|
||||||
IN CONST LIST_ENTRY *List,
|
IN CONST LIST_ENTRY *List,
|
||||||
IN CONST LIST_ENTRY *Node
|
IN CONST LIST_ENTRY *Node
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -279,15 +279,15 @@ GetNextNode (
|
|||||||
BOOLEAN
|
BOOLEAN
|
||||||
EFIAPI
|
EFIAPI
|
||||||
IsListEmpty (
|
IsListEmpty (
|
||||||
IN CONST LIST_ENTRY *List
|
IN CONST LIST_ENTRY *ListHead
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// ASSERT List not too long
|
// ASSERT List not too long
|
||||||
//
|
//
|
||||||
ASSERT (IsNodeInList (List, List));
|
ASSERT (IsNodeInList (ListHead, ListHead));
|
||||||
|
|
||||||
return (BOOLEAN)(List->ForwardLink == List);
|
return (BOOLEAN)(ListHead->ForwardLink == ListHead);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -318,8 +318,8 @@ IsListEmpty (
|
|||||||
BOOLEAN
|
BOOLEAN
|
||||||
EFIAPI
|
EFIAPI
|
||||||
IsNull (
|
IsNull (
|
||||||
IN CONST LIST_ENTRY *List,
|
IN CONST LIST_ENTRY *List,
|
||||||
IN CONST LIST_ENTRY *Node
|
IN CONST LIST_ENTRY *Node
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -356,8 +356,8 @@ IsNull (
|
|||||||
BOOLEAN
|
BOOLEAN
|
||||||
EFIAPI
|
EFIAPI
|
||||||
IsNodeAtEnd (
|
IsNodeAtEnd (
|
||||||
IN CONST LIST_ENTRY *List,
|
IN CONST LIST_ENTRY *List,
|
||||||
IN CONST LIST_ENTRY *Node
|
IN CONST LIST_ENTRY *Node
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -389,15 +389,15 @@ IsNodeAtEnd (
|
|||||||
|
|
||||||
@param FirstEntry A pointer to a node in a linked list.
|
@param FirstEntry A pointer to a node in a linked list.
|
||||||
@param SecondEntry A pointer to another node in the same linked list.
|
@param SecondEntry A pointer to another node in the same linked list.
|
||||||
|
|
||||||
@return SecondEntry.
|
@return SecondEntry.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
LIST_ENTRY *
|
LIST_ENTRY *
|
||||||
EFIAPI
|
EFIAPI
|
||||||
SwapListEntries (
|
SwapListEntries (
|
||||||
IN OUT LIST_ENTRY *FirstEntry,
|
IN OUT LIST_ENTRY *FirstEntry,
|
||||||
IN OUT LIST_ENTRY *SecondEntry
|
IN OUT LIST_ENTRY *SecondEntry
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
LIST_ENTRY *Ptr;
|
LIST_ENTRY *Ptr;
|
||||||
@@ -464,7 +464,7 @@ SwapListEntries (
|
|||||||
LIST_ENTRY *
|
LIST_ENTRY *
|
||||||
EFIAPI
|
EFIAPI
|
||||||
RemoveEntryList (
|
RemoveEntryList (
|
||||||
IN CONST LIST_ENTRY *Entry
|
IN CONST LIST_ENTRY *Entry
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ASSERT (!IsListEmpty (Entry));
|
ASSERT (!IsListEmpty (Entry));
|
||||||
|
@@ -68,8 +68,6 @@ InternalMathRShiftU64 (
|
|||||||
This function shifts the 64-bit value Operand to the right by Count bits. The
|
This function shifts the 64-bit value Operand to the right by Count bits. The
|
||||||
high Count bits are set to bit 63 of Operand. The shifted value is returned.
|
high Count bits are set to bit 63 of Operand. The shifted value is returned.
|
||||||
|
|
||||||
If Count is greater than 63, then ASSERT().
|
|
||||||
|
|
||||||
@param Operand The 64-bit operand to shift right.
|
@param Operand The 64-bit operand to shift right.
|
||||||
@param Count The number of bits to shift right.
|
@param Count The number of bits to shift right.
|
||||||
|
|
||||||
@@ -161,7 +159,7 @@ InternalMathRRotU64 (
|
|||||||
|
|
||||||
@param Operand A 64-bit unsigned value.
|
@param Operand A 64-bit unsigned value.
|
||||||
|
|
||||||
@return The byte swaped Operand.
|
@return The byte swapped Operand.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT64
|
UINT64
|
||||||
@@ -236,7 +234,7 @@ InternalMathMultU64x64 (
|
|||||||
unsigned value Divisor and generates a 64-bit unsigned quotient. This
|
unsigned value Divisor and generates a 64-bit unsigned quotient. This
|
||||||
function returns the 64-bit unsigned quotient.
|
function returns the 64-bit unsigned quotient.
|
||||||
|
|
||||||
@param Dividend A 64-bit unsigned value.
|
@param Dividend A 64-bit unsigned value.
|
||||||
@param Divisor A 32-bit unsigned value.
|
@param Divisor A 32-bit unsigned value.
|
||||||
|
|
||||||
@return Dividend / Divisor
|
@return Dividend / Divisor
|
||||||
@@ -253,8 +251,8 @@ InternalMathDivU64x32 (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Divides a 64-bit unsigned integer by a 32-bit unsigned integer
|
Divides a 64-bit unsigned integer by a 32-bit unsigned integer and
|
||||||
and generates a 32-bit unsigned remainder.
|
generates a 32-bit unsigned remainder.
|
||||||
|
|
||||||
This function divides the 64-bit unsigned value Dividend by the 32-bit
|
This function divides the 64-bit unsigned value Dividend by the 32-bit
|
||||||
unsigned value Divisor and generates a 32-bit remainder. This function
|
unsigned value Divisor and generates a 32-bit remainder. This function
|
||||||
@@ -298,7 +296,7 @@ EFIAPI
|
|||||||
InternalMathDivRemU64x32 (
|
InternalMathDivRemU64x32 (
|
||||||
IN UINT64 Dividend,
|
IN UINT64 Dividend,
|
||||||
IN UINT32 Divisor,
|
IN UINT32 Divisor,
|
||||||
OUT UINT32 *Remainder OPTIONAL
|
OUT UINT32 *Remainder OPTIONAL
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (Remainder != NULL) {
|
if (Remainder != NULL) {
|
||||||
@@ -329,7 +327,7 @@ EFIAPI
|
|||||||
InternalMathDivRemU64x64 (
|
InternalMathDivRemU64x64 (
|
||||||
IN UINT64 Dividend,
|
IN UINT64 Dividend,
|
||||||
IN UINT64 Divisor,
|
IN UINT64 Divisor,
|
||||||
OUT UINT64 *Remainder OPTIONAL
|
OUT UINT64 *Remainder OPTIONAL
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (Remainder != NULL) {
|
if (Remainder != NULL) {
|
||||||
@@ -340,7 +338,7 @@ InternalMathDivRemU64x64 (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Divides a 64-bit signed integer by a 64-bit signed integer and
|
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.
|
generates a 64-bit signed result and an optional 64-bit signed remainder.
|
||||||
|
|
||||||
This function divides the 64-bit signed value Dividend by the 64-bit
|
This function divides the 64-bit signed value Dividend by the 64-bit
|
||||||
signed value Divisor and generates a 64-bit signed quotient. If Remainder
|
signed value Divisor and generates a 64-bit signed quotient. If Remainder
|
||||||
|
@@ -23,8 +23,7 @@
|
|||||||
Checks ASSERT condition for JumpBuffer.
|
Checks ASSERT condition for JumpBuffer.
|
||||||
|
|
||||||
If JumpBuffer is NULL, then ASSERT().
|
If JumpBuffer is NULL, then ASSERT().
|
||||||
If JumpBuffer is not aligned on a BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT
|
For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT().
|
||||||
boundary, then ASSERT().
|
|
||||||
|
|
||||||
@param JumpBuffer A pointer to CPU context buffer.
|
@param JumpBuffer A pointer to CPU context buffer.
|
||||||
|
|
||||||
|
@@ -261,7 +261,7 @@ StrCmp (
|
|||||||
/**
|
/**
|
||||||
Compares up to a specified length the contents of two Null-terminated Unicode strings,
|
Compares up to a specified length the contents of two Null-terminated Unicode strings,
|
||||||
and returns the difference between the first mismatched Unicode characters.
|
and returns the difference between the first mismatched Unicode characters.
|
||||||
|
|
||||||
This function compares the Null-terminated Unicode string FirstString to the
|
This function compares the Null-terminated Unicode string FirstString to the
|
||||||
Null-terminated Unicode string SecondString. At most, Length Unicode
|
Null-terminated Unicode string SecondString. At most, Length Unicode
|
||||||
characters will be compared. If Length is 0, then 0 is returned. If
|
characters will be compared. If Length is 0, then 0 is returned. If
|
||||||
@@ -451,8 +451,8 @@ StrnCat (
|
|||||||
CHAR16 *
|
CHAR16 *
|
||||||
EFIAPI
|
EFIAPI
|
||||||
StrStr (
|
StrStr (
|
||||||
IN CONST CHAR16 *String,
|
IN CONST CHAR16 *String,
|
||||||
IN CONST CHAR16 *SearchString
|
IN CONST CHAR16 *SearchString
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
CONST CHAR16 *FirstMatch;
|
CONST CHAR16 *FirstMatch;
|
||||||
@@ -632,7 +632,7 @@ InternalIsHexaDecimalDigitCharacter (
|
|||||||
UINTN
|
UINTN
|
||||||
EFIAPI
|
EFIAPI
|
||||||
StrDecimalToUintn (
|
StrDecimalToUintn (
|
||||||
IN CONST CHAR16 *String
|
IN CONST CHAR16 *String
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINTN Result;
|
UINTN Result;
|
||||||
@@ -714,7 +714,7 @@ StrDecimalToUintn (
|
|||||||
UINT64
|
UINT64
|
||||||
EFIAPI
|
EFIAPI
|
||||||
StrDecimalToUint64 (
|
StrDecimalToUint64 (
|
||||||
IN CONST CHAR16 *String
|
IN CONST CHAR16 *String
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT64 Result;
|
UINT64 Result;
|
||||||
@@ -796,7 +796,7 @@ StrDecimalToUint64 (
|
|||||||
UINTN
|
UINTN
|
||||||
EFIAPI
|
EFIAPI
|
||||||
StrHexToUintn (
|
StrHexToUintn (
|
||||||
IN CONST CHAR16 *String
|
IN CONST CHAR16 *String
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINTN Result;
|
UINTN Result;
|
||||||
@@ -886,11 +886,11 @@ StrHexToUintn (
|
|||||||
|
|
||||||
@retval Value translated from String.
|
@retval Value translated from String.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT64
|
UINT64
|
||||||
EFIAPI
|
EFIAPI
|
||||||
StrHexToUint64 (
|
StrHexToUint64 (
|
||||||
IN CONST CHAR16 *String
|
IN CONST CHAR16 *String
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT64 Result;
|
UINT64 Result;
|
||||||
@@ -1027,8 +1027,8 @@ InternalAsciiIsHexaDecimalDigitCharacter (
|
|||||||
CHAR8 *
|
CHAR8 *
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnicodeStrToAsciiStr (
|
UnicodeStrToAsciiStr (
|
||||||
IN CONST CHAR16 *Source,
|
IN CONST CHAR16 *Source,
|
||||||
OUT CHAR8 *Destination
|
OUT CHAR8 *Destination
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
CHAR8 *ReturnValue;
|
CHAR8 *ReturnValue;
|
||||||
@@ -1421,7 +1421,7 @@ AsciiStriCmp (
|
|||||||
@param FirstString Pointer to a Null-terminated ASCII string.
|
@param FirstString Pointer to a Null-terminated ASCII string.
|
||||||
@param SecondString Pointer to a Null-terminated ASCII string.
|
@param SecondString Pointer to a Null-terminated ASCII string.
|
||||||
@param Length Maximum number of ASCII characters for compare.
|
@param Length Maximum number of ASCII characters for compare.
|
||||||
|
|
||||||
@retval ==0 FirstString is identical to SecondString.
|
@retval ==0 FirstString is identical to SecondString.
|
||||||
@retval !=0 FirstString is not identical to SecondString.
|
@retval !=0 FirstString is not identical to SecondString.
|
||||||
|
|
||||||
@@ -1577,8 +1577,8 @@ AsciiStrnCat (
|
|||||||
CHAR8 *
|
CHAR8 *
|
||||||
EFIAPI
|
EFIAPI
|
||||||
AsciiStrStr (
|
AsciiStrStr (
|
||||||
IN CONST CHAR8 *String,
|
IN CONST CHAR8 *String,
|
||||||
IN CONST CHAR8 *SearchString
|
IN CONST CHAR8 *SearchString
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
CONST CHAR8 *FirstMatch;
|
CONST CHAR8 *FirstMatch;
|
||||||
@@ -1729,7 +1729,7 @@ AsciiStrDecimalToUintn (
|
|||||||
UINT64
|
UINT64
|
||||||
EFIAPI
|
EFIAPI
|
||||||
AsciiStrDecimalToUint64 (
|
AsciiStrDecimalToUint64 (
|
||||||
IN CONST CHAR8 *String
|
IN CONST CHAR8 *String
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT64 Result;
|
UINT64 Result;
|
||||||
@@ -1809,7 +1809,7 @@ AsciiStrDecimalToUint64 (
|
|||||||
UINTN
|
UINTN
|
||||||
EFIAPI
|
EFIAPI
|
||||||
AsciiStrHexToUintn (
|
AsciiStrHexToUintn (
|
||||||
IN CONST CHAR8 *String
|
IN CONST CHAR8 *String
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINTN Result;
|
UINTN Result;
|
||||||
@@ -1901,7 +1901,7 @@ AsciiStrHexToUintn (
|
|||||||
UINT64
|
UINT64
|
||||||
EFIAPI
|
EFIAPI
|
||||||
AsciiStrHexToUint64 (
|
AsciiStrHexToUint64 (
|
||||||
IN CONST CHAR8 *String
|
IN CONST CHAR8 *String
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT64 Result;
|
UINT64 Result;
|
||||||
|
@@ -24,16 +24,16 @@
|
|||||||
from little endian to big endian or vice versa. The byte swapped value is
|
from little endian to big endian or vice versa. The byte swapped value is
|
||||||
returned.
|
returned.
|
||||||
|
|
||||||
@param Value Operand A 16-bit unsigned value.
|
@param Value A 16-bit unsigned value.
|
||||||
|
|
||||||
@return The byte swapped Operand.
|
@return The byte swapped value.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT16
|
UINT16
|
||||||
EFIAPI
|
EFIAPI
|
||||||
SwapBytes16 (
|
SwapBytes16 (
|
||||||
IN UINT16 Operand
|
IN UINT16 Value
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return (UINT16) ((Operand << 8) | (Operand >> 8));
|
return (UINT16) ((Value<< 8) | (Value>> 8));
|
||||||
}
|
}
|
||||||
|
@@ -24,22 +24,22 @@
|
|||||||
from little endian to big endian or vice versa. The byte swapped value is
|
from little endian to big endian or vice versa. The byte swapped value is
|
||||||
returned.
|
returned.
|
||||||
|
|
||||||
@param Value Operand A 32-bit unsigned value.
|
@param Value A 32-bit unsigned value.
|
||||||
|
|
||||||
@return The byte swapped Operand.
|
@return The byte swapped Value.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT32
|
UINT32
|
||||||
EFIAPI
|
EFIAPI
|
||||||
SwapBytes32 (
|
SwapBytes32 (
|
||||||
IN UINT32 Operand
|
IN UINT32 Value
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT32 LowerBytes;
|
UINT32 LowerBytes;
|
||||||
UINT32 HigherBytes;
|
UINT32 HigherBytes;
|
||||||
|
|
||||||
LowerBytes = (UINT32) SwapBytes16 ((UINT16) Operand);
|
LowerBytes = (UINT32) SwapBytes16 ((UINT16) Value);
|
||||||
HigherBytes = (UINT32) SwapBytes16 ((UINT16) (Operand >> 16));
|
HigherBytes = (UINT32) SwapBytes16 ((UINT16) (Value >> 16));
|
||||||
|
|
||||||
return (LowerBytes << 16 | HigherBytes);
|
return (LowerBytes << 16 | HigherBytes);
|
||||||
}
|
}
|
||||||
|
@@ -24,16 +24,16 @@
|
|||||||
from little endian to big endian or vice versa. The byte swapped value is
|
from little endian to big endian or vice versa. The byte swapped value is
|
||||||
returned.
|
returned.
|
||||||
|
|
||||||
@param Value Operand A 64-bit unsigned value.
|
@param Value A 64-bit unsigned value.
|
||||||
|
|
||||||
@return The byte swapped Operand.
|
@return The byte swapped Value.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT64
|
UINT64
|
||||||
EFIAPI
|
EFIAPI
|
||||||
SwapBytes64 (
|
SwapBytes64 (
|
||||||
IN UINT64 Operand
|
IN UINT64 Value
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return InternalMathSwapBytes64 (Operand);
|
return InternalMathSwapBytes64 (Value);
|
||||||
}
|
}
|
||||||
|
@@ -41,6 +41,7 @@
|
|||||||
a single parameter of type VOID * that specifies the new backing
|
a single parameter of type VOID * that specifies the new backing
|
||||||
store pointer.
|
store pointer.
|
||||||
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
|
@@ -61,7 +61,7 @@ GetSpinLockProperties (
|
|||||||
SPIN_LOCK *
|
SPIN_LOCK *
|
||||||
EFIAPI
|
EFIAPI
|
||||||
InitializeSpinLock (
|
InitializeSpinLock (
|
||||||
OUT SPIN_LOCK *SpinLock
|
OUT SPIN_LOCK *SpinLock
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ASSERT (SpinLock != NULL);
|
ASSERT (SpinLock != NULL);
|
||||||
@@ -352,9 +352,8 @@ InterlockedCompareExchange64 (
|
|||||||
operation.
|
operation.
|
||||||
@param CompareValue Pointer value used in compare operation.
|
@param CompareValue Pointer value used in compare operation.
|
||||||
@param ExchangeValue Pointer value used in exchange operation.
|
@param ExchangeValue Pointer value used in exchange operation.
|
||||||
|
|
||||||
@return The original *Value before exchange.
|
|
||||||
|
|
||||||
|
@return The original *Value before exchange.
|
||||||
**/
|
**/
|
||||||
VOID *
|
VOID *
|
||||||
EFIAPI
|
EFIAPI
|
||||||
|
@@ -69,7 +69,7 @@ GetSpinLockProperties (
|
|||||||
SPIN_LOCK *
|
SPIN_LOCK *
|
||||||
EFIAPI
|
EFIAPI
|
||||||
InitializeSpinLock (
|
InitializeSpinLock (
|
||||||
OUT SPIN_LOCK *SpinLock
|
OUT SPIN_LOCK *SpinLock
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ASSERT (SpinLock != NULL);
|
ASSERT (SpinLock != NULL);
|
||||||
|
@@ -72,7 +72,7 @@ GetSpinLockProperties (
|
|||||||
SPIN_LOCK *
|
SPIN_LOCK *
|
||||||
EFIAPI
|
EFIAPI
|
||||||
InitializeSpinLock (
|
InitializeSpinLock (
|
||||||
OUT SPIN_LOCK *SpinLock
|
OUT SPIN_LOCK *SpinLock
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ASSERT (SpinLock != NULL);
|
ASSERT (SpinLock != NULL);
|
||||||
@@ -373,9 +373,8 @@ InterlockedCompareExchange64 (
|
|||||||
operation.
|
operation.
|
||||||
@param CompareValue Pointer value used in compare operation.
|
@param CompareValue Pointer value used in compare operation.
|
||||||
@param ExchangeValue Pointer value used in exchange operation.
|
@param ExchangeValue Pointer value used in exchange operation.
|
||||||
|
|
||||||
@return The original *Value before exchange.
|
|
||||||
|
|
||||||
|
@return The original *Value before exchange.
|
||||||
**/
|
**/
|
||||||
VOID *
|
VOID *
|
||||||
EFIAPI
|
EFIAPI
|
||||||
|
@@ -34,7 +34,7 @@
|
|||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
AsmFxRestore (
|
AsmFxRestore (
|
||||||
IN CONST IA32_FX_BUFFER *Buffer
|
IN CONST IA32_FX_BUFFER *Buffer
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ASSERT (Buffer != NULL);
|
ASSERT (Buffer != NULL);
|
||||||
|
@@ -40,7 +40,8 @@ AsmReadMsr32 (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Zero-extend a 32-bit value and writes it to a Machine Specific Register(MSR).
|
Writes a 32-bit value to a Machine Specific Register(MSR), and returns the value.
|
||||||
|
The upper 32-bits of the MSR are set to zero.
|
||||||
|
|
||||||
Writes the 32-bit value specified by Value to the MSR specified by Index. The
|
Writes the 32-bit value specified by Value to the MSR specified by Index. The
|
||||||
upper 32-bits of the MSR write are set to zero. The 32-bit value written to
|
upper 32-bits of the MSR write are set to zero. The 32-bit value written to
|
||||||
@@ -192,7 +193,7 @@ AsmMsrBitFieldRead32 (
|
|||||||
/**
|
/**
|
||||||
Writes a bit field to an MSR.
|
Writes a bit field to an MSR.
|
||||||
|
|
||||||
Writes Value to a bit field in the lower 32-bits of a 64-bit MSR. The bit
|
Writes Value to a bit field in the lower 32-bits of a 64-bit MSR. The bit
|
||||||
field is specified by the StartBit and the EndBit. All other bits in the
|
field is specified by the StartBit and the EndBit. All other bits in the
|
||||||
destination MSR are preserved. The lower 32-bits of the MSR written is
|
destination MSR are preserved. The lower 32-bits of the MSR written is
|
||||||
returned. The caller must either guarantee that Index and the data written
|
returned. The caller must either guarantee that Index and the data written
|
||||||
@@ -464,7 +465,7 @@ AsmMsrAndThenOr64 (
|
|||||||
@param EndBit The ordinal of the most significant bit in the bit field.
|
@param EndBit The ordinal of the most significant bit in the bit field.
|
||||||
Range 0..63.
|
Range 0..63.
|
||||||
|
|
||||||
@return The value written back to the MSR.
|
@return The value read from the MSR.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT64
|
UINT64
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
#include "BaseLibInternals.h"
|
#include "BaseLibInternals.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reads the current Interrupt Descriptor Table Register(GDTR) descriptor.
|
Reads the current Interrupt Descriptor Table Register(IDTR) descriptor.
|
||||||
|
|
||||||
Reads and returns the current IDTR descriptor and returns it in Idtr. This
|
Reads and returns the current IDTR descriptor and returns it in Idtr. This
|
||||||
function is only available on IA-32 and x64.
|
function is only available on IA-32 and x64.
|
||||||
|
@@ -185,11 +185,47 @@ AsmPrepareThunk16 (
|
|||||||
Transfers control to a 16-bit real mode entry point and returns the results.
|
Transfers control to a 16-bit real mode entry point and returns the results.
|
||||||
|
|
||||||
Transfers control to a 16-bit real mode entry point and returns the results.
|
Transfers control to a 16-bit real mode entry point and returns the results.
|
||||||
AsmPrepareThunk16() must be called with ThunkContext before this function is
|
AsmPrepareThunk16() must be called with ThunkContext before this function is used.
|
||||||
used. This function must be called with interrupts disabled.
|
This function must be called with interrupts disabled.
|
||||||
|
|
||||||
|
The register state from the RealModeState field of ThunkContext is restored just prior
|
||||||
|
to calling the 16-bit real mode entry point. This includes the EFLAGS field of RealModeState,
|
||||||
|
which is used to set the interrupt state when a 16-bit real mode entry point is called.
|
||||||
|
Control is transferred to the 16-bit real mode entry point specified by the CS and Eip fields of RealModeState.
|
||||||
|
The stack is initialized to the SS and ESP fields of RealModeState. Any parameters passed to
|
||||||
|
the 16-bit real mode code must be populated by the caller at SS:ESP prior to calling this function.
|
||||||
|
The 16-bit real mode entry point is invoked with a 16-bit CALL FAR instruction,
|
||||||
|
so when accessing stack contents, the 16-bit real mode code must account for the 16-bit segment
|
||||||
|
and 16-bit offset of the return address that were pushed onto the stack. The 16-bit real mode entry
|
||||||
|
point must exit with a RETF instruction. The register state is captured into RealModeState immediately
|
||||||
|
after the RETF instruction is executed.
|
||||||
|
|
||||||
|
If EFLAGS specifies interrupts enabled, or any of the 16-bit real mode code enables interrupts,
|
||||||
|
or any of the 16-bit real mode code makes a SW interrupt, then the caller is responsible for making sure
|
||||||
|
the IDT at address 0 is initialized to handle any HW or SW interrupts that may occur while in 16-bit real mode.
|
||||||
|
|
||||||
|
If EFLAGS specifies interrupts enabled, or any of the 16-bit real mode code enables interrupts,
|
||||||
|
then the caller is responsible for making sure the 8259 PIC is in a state compatible with 16-bit real mode.
|
||||||
|
This includes the base vectors, the interrupt masks, and the edge/level trigger mode.
|
||||||
|
|
||||||
|
If THUNK_ATTRIBUTE_BIG_REAL_MODE is set in the ThunkAttributes field of ThunkContext, then the user code
|
||||||
|
is invoked in big real mode. Otherwise, the user code is invoked in 16-bit real mode with 64KB segment limits.
|
||||||
|
|
||||||
|
If neither THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 nor THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL are set in
|
||||||
|
ThunkAttributes, then it is assumed that the user code did not enable the A20 mask, and no attempt is made to
|
||||||
|
disable the A20 mask.
|
||||||
|
|
||||||
|
If THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 is set and THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL is clear in
|
||||||
|
ThunkAttributes, then attempt to use the INT 15 service to disable the A20 mask. If this INT 15 call fails,
|
||||||
|
then attempt to disable the A20 mask by directly accessing the 8042 keyboard controller I/O ports.
|
||||||
|
|
||||||
|
If THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 is clear and THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL is set in
|
||||||
|
ThunkAttributes, then attempt to disable the A20 mask by directly accessing the 8042 keyboard controller I/O ports.
|
||||||
|
|
||||||
If ThunkContext is NULL, then ASSERT().
|
If ThunkContext is NULL, then ASSERT().
|
||||||
If AsmPrepareThunk16() was not previously called with ThunkContext, then ASSERT().
|
If AsmPrepareThunk16() was not previously called with ThunkContext, then ASSERT().
|
||||||
|
If both THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 and THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL are set in
|
||||||
|
ThunkAttributes, then ASSERT().
|
||||||
|
|
||||||
@param ThunkContext A pointer to the context structure that describes the
|
@param ThunkContext A pointer to the context structure that describes the
|
||||||
16-bit real mode code to call.
|
16-bit real mode code to call.
|
||||||
@@ -225,10 +261,9 @@ AsmThunk16 (
|
|||||||
caller only need to perform a single 16-bit real mode thunk, then this
|
caller only need to perform a single 16-bit real mode thunk, then this
|
||||||
service should be used. If the caller intends to make more than one 16-bit
|
service should be used. If the caller intends to make more than one 16-bit
|
||||||
real mode thunk, then it is more efficient if AsmPrepareThunk16() is called
|
real mode thunk, then it is more efficient if AsmPrepareThunk16() is called
|
||||||
once and AsmThunk16() can be called for each 16-bit real mode thunk. This
|
once and AsmThunk16() can be called for each 16-bit real mode thunk.
|
||||||
function must be called with interrupts disabled.
|
|
||||||
|
|
||||||
If ThunkContext is NULL, then ASSERT().
|
See AsmPrepareThunk16() and AsmThunk16() for the detailed description and ASSERT() conditions.
|
||||||
|
|
||||||
@param ThunkContext A pointer to the context structure that describes the
|
@param ThunkContext A pointer to the context structure that describes the
|
||||||
16-bit real mode code to call.
|
16-bit real mode code to call.
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
#include "BaseLibInternals.h"
|
#include "BaseLibInternals.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Writes the current Interrupt Descriptor Table Register(GDTR) descriptor.
|
Writes the current Interrupt Descriptor Table Register(IDTR) descriptor.
|
||||||
|
|
||||||
Writes the current IDTR descriptor and returns it in Idtr. This function is
|
Writes the current IDTR descriptor and returns it in Idtr. This function is
|
||||||
only available on IA-32 and x64.
|
only available on IA-32 and x64.
|
||||||
|
Reference in New Issue
Block a user