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.
|
||||||
|
|
||||||
|
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -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
|
||||||
@@ -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
|
||||||
@@ -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.
|
||||||
|
|
||||||
|
@@ -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
|
||||||
|
@@ -354,7 +354,6 @@ InterlockedCompareExchange64 (
|
|||||||
@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
|
||||||
|
@@ -375,7 +375,6 @@ InterlockedCompareExchange64 (
|
|||||||
@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
|
||||||
|
@@ -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
|
||||||
@@ -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