Code scrub:

MdePkg/Library/BaseCacheMaintenanceLib
MdePkg/Library/BaseDebugLibNull
MdePkg/Library/BaseIoLibIntrinsic
MdePkg/Library/BaseLib
MdePkg/Library/BaseMemoryLib
MdePkg/Library/BaseMemoryLibMmx
MdePkg/Library/BaseMemoryLibOptDxe
MdePkg/Library/BaseMemoryLibOptPei
MdePkg/Library/BaseMemoryLibRepStr
MdePkg/Library/BaseMemoryLibSse2
MdePkg/Library/BasePeCoffGetEntryPointLib


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5426 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
yshang1
2008-07-08 09:38:43 +00:00
parent d74eeda8a7
commit 38bbd3d91c
104 changed files with 392 additions and 286 deletions

View File

@@ -311,6 +311,7 @@ InternalMathDivRemU64x64 (
**/
INT64
EFIAPI
InternalMathDivRemS64x64 (
IN INT64 Dividend,
IN INT64 Divisor,
@@ -374,6 +375,7 @@ InternalSwitchStack (
**/
BOOLEAN
EFIAPI
IsNodeInList (
IN CONST LIST_ENTRY *List,
IN CONST LIST_ENTRY *Node
@@ -484,6 +486,7 @@ InternalSyncCompareExchange64 (
**/
unsigned int
EFIAPI
BitFieldReadUint (
IN unsigned int Operand,
IN UINTN StartBit,
@@ -508,6 +511,7 @@ BitFieldReadUint (
**/
unsigned int
EFIAPI
BitFieldOrUint (
IN unsigned int Operand,
IN UINTN StartBit,
@@ -533,6 +537,7 @@ BitFieldOrUint (
**/
unsigned int
EFIAPI
BitFieldAndUint (
IN unsigned int Operand,
IN UINTN StartBit,
@@ -553,6 +558,7 @@ BitFieldAndUint (
**/
VOID
EFIAPI
InternalAssertJumpBuffer (
IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer
);

View File

@@ -32,6 +32,7 @@
**/
unsigned int
EFIAPI
BitFieldReadUint (
IN unsigned int Operand,
IN UINTN StartBit,
@@ -62,6 +63,7 @@ BitFieldReadUint (
**/
unsigned int
EFIAPI
BitFieldOrUint (
IN unsigned int Operand,
IN UINTN StartBit,
@@ -93,6 +95,7 @@ BitFieldOrUint (
**/
unsigned int
EFIAPI
BitFieldAndUint (
IN unsigned int Operand,
IN UINTN StartBit,

View File

@@ -36,5 +36,5 @@ CpuDeadLoop (
{
volatile UINTN Index;
for (Index = 0; Index == 0;);
for (Index = 0; 0 == Index;);
}

View File

@@ -28,6 +28,7 @@
**/
VOID
EFIAPI
InternalAssertJumpBuffer (
IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer
);

View File

@@ -12,6 +12,25 @@
**/
/**
Performs an atomic compare exchange operation on a 32-bit
unsigned integer.
Performs an atomic compare exchange operation on the 32-bit
unsigned integer specified by Value. If Value is equal to
CompareValue, then Value is set to ExchangeValue and
CompareValue is returned. If Value is not equal to
CompareValue, then Value is returned. The compare exchange
operation must be performed using MP safe mechanisms.
@param Value A pointer to the 32-bit value for the
compare exchange operation.
@param CompareValue 32-bit value used in compare operation.
@param ExchangeValue 32-bit value used in exchange operation.
@return The original *Value before exchange.
**/
UINT32
EFIAPI
InternalSyncCompareExchange32 (

View File

@@ -38,7 +38,7 @@ GetPowerOfTwo32 (
IN UINT32 Operand
)
{
if (Operand == 0) {
if (0 == Operand) {
return 0;
}

View File

@@ -37,6 +37,7 @@
**/
INT64
EFIAPI
InternalMathDivRemS64x64 (
IN INT64 Dividend,
IN INT64 Divisor,

View File

@@ -41,6 +41,7 @@
**/
BOOLEAN
EFIAPI
IsNodeInList (
IN CONST LIST_ENTRY *List,
IN CONST LIST_ENTRY *Node
@@ -384,6 +385,8 @@ IsNodeAtEnd (
@param FirstEntry A pointer to a node in a linked list.
@param SecondEntry A pointer to another node in the same linked list.
@return SecondEntry
**/
LIST_ENTRY *

View File

@@ -44,6 +44,6 @@ LowBitSet32 (
return -1;
}
for (BitIndex = 0; (Operand & 1) == 0; BitIndex++, Operand >>= 1);
for (BitIndex = 0; 0 == (Operand & 1); BitIndex++, Operand >>= 1);
return BitIndex;
}

View File

@@ -361,6 +361,7 @@ InternalMathDivRemU64x64 (
**/
INT64
EFIAPI
InternalMathDivRemS64x64 (
IN INT64 Dividend,
IN INT64 Divisor,

View File

@@ -193,7 +193,7 @@ StrLen (
@param String Pointer to a Null-terminated Unicode string.
@return The size of String.
@return The size in bytes of String.
**/
UINTN
@@ -291,7 +291,7 @@ StrnCmp (
IN UINTN Length
)
{
if (Length == 0) {
if (0 == Length) {
return 0;
}
@@ -469,7 +469,7 @@ StrStr (
SearchStringTmp++;
}
if (*SearchStringTmp == '\0') {
if ('\0' == *SearchStringTmp) {
return (CHAR16 *) FirstMatch;
}
@@ -641,14 +641,14 @@ StrDecimalToUintn (
//
// Ignore the pad spaces (space or tab)
//
while ((*String == L' ') || (*String == L'\t')) {
while ((L' ' ==*String) || (L'\t' == *String)) {
String++;
}
//
// Ignore leading Zeros after the spaces
//
while (*String == L'0') {
while (L'0' == *String) {
String++;
}
@@ -660,7 +660,7 @@ StrDecimalToUintn (
// to the range defined by UINTN, then ASSERT().
//
ASSERT ((Result < QUIENT_MAX_UINTN_DIVIDED_BY_10) ||
((Result == QUIENT_MAX_UINTN_DIVIDED_BY_10) &&
((QUIENT_MAX_UINTN_DIVIDED_BY_10 == Result) &&
(*String - L'0') <= REMINDER_MAX_UINTN_DIVIDED_BY_10)
);
@@ -723,14 +723,14 @@ StrDecimalToUint64 (
//
// Ignore the pad spaces (space or tab)
//
while ((*String == L' ') || (*String == L'\t')) {
while ((L' ' == *String) || (L'\t' == *String)) {
String++;
}
//
// Ignore leading Zeros after the spaces
//
while (*String == L'0') {
while (L'0' == *String) {
String++;
}
@@ -742,7 +742,7 @@ StrDecimalToUint64 (
// to the range defined by UINTN, then ASSERT().
//
ASSERT ((Result < QUIENT_MAX_UINT64_DIVIDED_BY_10) ||
((Result == QUIENT_MAX_UINT64_DIVIDED_BY_10) &&
((QUIENT_MAX_UINT64_DIVIDED_BY_10 == Result) &&
(*String - L'0') <= REMINDER_MAX_UINT64_DIVIDED_BY_10)
);
@@ -805,19 +805,19 @@ StrHexToUintn (
//
// Ignore the pad spaces (space or tab)
//
while ((*String == L' ') || (*String == L'\t')) {
while ((L' ' == *String) || (L'\t' == *String)) {
String++;
}
//
// Ignore leading Zeros after the spaces
//
while (*String == L'0') {
while (L'0' == *String) {
String++;
}
if (InternalCharToUpper (*String) == L'X') {
ASSERT (*(String - 1) == L'0');
ASSERT (L'0' == *(String - 1));
if (*(String - 1) != L'0') {
return 0;
}
@@ -835,7 +835,7 @@ StrHexToUintn (
// to the range defined by UINTN, then ASSERT().
//
ASSERT ((Result < QUIENT_MAX_UINTN_DIVIDED_BY_16) ||
((Result == QUIENT_MAX_UINTN_DIVIDED_BY_16) &&
((QUIENT_MAX_UINTN_DIVIDED_BY_16 == Result) &&
(InternalHexCharToUintn (*String) <= REMINDER_MAX_UINTN_DIVIDED_BY_16))
);
@@ -899,19 +899,19 @@ StrHexToUint64 (
//
// Ignore the pad spaces (space or tab)
//
while ((*String == L' ') || (*String == L'\t')) {
while ((L' ' == *String) || (L'\t' == *String)) {
String++;
}
//
// Ignore leading Zeros after the spaces
//
while (*String == L'0') {
while (L'0' == *String) {
String++;
}
if (InternalCharToUpper (*String) == L'X') {
ASSERT (*(String - 1) == L'0');
ASSERT (L'0' == *(String - 1));
if (*(String - 1) != L'0') {
return 0;
}
@@ -929,7 +929,7 @@ StrHexToUint64 (
// to the range defined by UINTN, then ASSERT().
//
ASSERT ((Result < QUIENT_MAX_UINT64_DIVIDED_BY_16)||
((Result == QUIENT_MAX_UINT64_DIVIDED_BY_16) &&
((QUIENT_MAX_UINT64_DIVIDED_BY_16 == Result) &&
(InternalHexCharToUintn (*String) <= REMINDER_MAX_UINT64_DIVIDED_BY_16))
);
@@ -1153,7 +1153,7 @@ AsciiStrnCpy (
{
CHAR8 *ReturnValue;
if (Length == 0) {
if (0 == Length) {
return Destination;
}
@@ -1432,7 +1432,7 @@ AsciiStrnCmp (
IN UINTN Length
)
{
if (Length == 0) {
if (0 == Length) {
return 0;
}
@@ -1662,14 +1662,14 @@ AsciiStrDecimalToUintn (
//
// Ignore the pad spaces (space or tab)
//
while ((*String == ' ') || (*String == '\t')) {
while ((' ' == *String) || ('\t' == *String)) {
String++;
}
//
// Ignore leading Zeros after the spaces
//
while (*String == '0') {
while ('0' == *String) {
String++;
}
@@ -1681,7 +1681,7 @@ AsciiStrDecimalToUintn (
// to the range defined by UINTN, then ASSERT().
//
ASSERT ((Result < QUIENT_MAX_UINTN_DIVIDED_BY_10) ||
((Result == QUIENT_MAX_UINTN_DIVIDED_BY_10) &&
((QUIENT_MAX_UINTN_DIVIDED_BY_10 == Result) &&
(*String - '0') <= REMINDER_MAX_UINTN_DIVIDED_BY_10)
);
@@ -1739,14 +1739,14 @@ AsciiStrDecimalToUint64 (
//
// Ignore the pad spaces (space or tab)
//
while ((*String == ' ') || (*String == '\t')) {
while ((' ' == *String) || ('\t' == *String)) {
String++;
}
//
// Ignore leading Zeros after the spaces
//
while (*String == '0') {
while ('0' == *String) {
String++;
}
@@ -1758,7 +1758,7 @@ AsciiStrDecimalToUint64 (
// to the range defined by UINTN, then ASSERT().
//
ASSERT ((Result < QUIENT_MAX_UINT64_DIVIDED_BY_10) ||
((Result == QUIENT_MAX_UINT64_DIVIDED_BY_10) &&
((QUIENT_MAX_UINT64_DIVIDED_BY_10 == Result) &&
(*String - '0') <= REMINDER_MAX_UINT64_DIVIDED_BY_10)
);
@@ -1819,19 +1819,19 @@ AsciiStrHexToUintn (
//
// Ignore the pad spaces (space or tab)
//
while ((*String == ' ') || (*String == '\t')) {
while ((' ' == *String) || ('\t' == *String)) {
String++;
}
//
// Ignore leading Zeros after the spaces
//
while (*String == '0') {
while ('0' == *String) {
String++;
}
if (AsciiToUpper (*String) == 'X') {
ASSERT (*(String - 1) == '0');
ASSERT ('0' == *(String - 1));
if (*(String - 1) != '0') {
return 0;
}
@@ -1849,7 +1849,7 @@ AsciiStrHexToUintn (
// to the range defined by UINTN, then ASSERT().
//
ASSERT ((Result < QUIENT_MAX_UINTN_DIVIDED_BY_16) ||
((Result == QUIENT_MAX_UINTN_DIVIDED_BY_16) &&
((QUIENT_MAX_UINTN_DIVIDED_BY_16 == Result) &&
(InternalAsciiHexCharToUintn (*String) <= REMINDER_MAX_UINTN_DIVIDED_BY_16))
);
@@ -1914,19 +1914,19 @@ AsciiStrHexToUint64 (
//
// Ignore the pad spaces (space or tab)
//
while ((*String == ' ') || (*String == '\t')) {
while ((' ' == *String) || ('\t' == *String)) {
String++;
}
//
// Ignore leading Zeros after the spaces
//
while (*String == '0') {
while ('0' == *String) {
String++;
}
if (AsciiToUpper (*String) == 'X') {
ASSERT (*(String - 1) == '0');
ASSERT ('0' == *(String - 1));
if (*(String - 1) != '0') {
return 0;
}
@@ -1944,7 +1944,7 @@ AsciiStrHexToUint64 (
// to the range defined by UINTN, then ASSERT().
//
ASSERT ((Result < QUIENT_MAX_UINT64_DIVIDED_BY_16) ||
((Result == QUIENT_MAX_UINT64_DIVIDED_BY_16) &&
((QUIENT_MAX_UINT64_DIVIDED_BY_16 == Result) &&
(InternalAsciiHexCharToUintn (*String) <= REMINDER_MAX_UINT64_DIVIDED_BY_16))
);

View File

@@ -44,7 +44,6 @@ GetSpinLockProperties (
VOID
)
{
// @bug May use a PCD entry to determine this alignment.
return 32;
}
@@ -61,7 +60,7 @@ GetSpinLockProperties (
@param SpinLock A pointer to the spin lock to initialize to the released
state.
@return SpinLock
@return SpinLock initialized in release state.
**/
SPIN_LOCK *
@@ -92,7 +91,7 @@ InitializeSpinLock (
@param SpinLock A pointer to the spin lock to place in the acquired state.
@return SpinLock
@return SpinLock aquired lock.
**/
SPIN_LOCK *
@@ -190,7 +189,7 @@ AcquireSpinLockOrFail (
ASSERT (SpinLock != NULL);
LockValue = *SpinLock;
ASSERT (LockValue == SPIN_LOCK_ACQUIRED || LockValue == SPIN_LOCK_RELEASED);
ASSERT (SPIN_LOCK_ACQUIRED == LockValue || SPIN_LOCK_RELEASED == LockValue);
return (BOOLEAN)(
InterlockedCompareExchangePointer (
@@ -226,7 +225,7 @@ ReleaseSpinLock (
ASSERT (SpinLock != NULL);
LockValue = *SpinLock;
ASSERT (LockValue == SPIN_LOCK_ACQUIRED || LockValue == SPIN_LOCK_RELEASED);
ASSERT (SPIN_LOCK_ACQUIRED == LockValue || SPIN_LOCK_RELEASED == LockValue);
*SpinLock = SPIN_LOCK_RELEASED;
return SpinLock;
@@ -358,6 +357,8 @@ InterlockedCompareExchange64 (
operation.
@param CompareValue Pointer value used in compare operation.
@param ExchangeValue Pointer value used in exchange operation.
@return The original *Value before exchange.
**/
VOID *

View File

@@ -49,7 +49,6 @@ GetSpinLockProperties (
VOID
)
{
// @bug May use a PCD entry to determine this alignment.
return 32;
}
@@ -66,7 +65,7 @@ GetSpinLockProperties (
@param SpinLock A pointer to the spin lock to initialize to the released
state.
@return SpinLock
@return SpinLock in release state.
**/
SPIN_LOCK *
@@ -101,7 +100,7 @@ InitializeSpinLock (
@param SpinLock A pointer to the spin lock to place in the acquired state.
@return SpinLock
@return SpinLock accquired lock.
**/
SPIN_LOCK *
@@ -224,7 +223,7 @@ AcquireSpinLockOrFail (
@param SpinLock A pointer to the spin lock to release.
@return SpinLock
@return SpinLock released lock.
**/
SPIN_LOCK *
@@ -374,6 +373,7 @@ InterlockedCompareExchange64 (
@param CompareValue Pointer value used in compare operation.
@param ExchangeValue Pointer value used in exchange operation.
@return The original *Value before exchange.
**/
VOID *
EFIAPI

View File

@@ -51,7 +51,6 @@ GetSpinLockProperties (
VOID
)
{
// @bug May use a PCD entry to determine this alignment.
return 32;
}
@@ -68,7 +67,7 @@ GetSpinLockProperties (
@param SpinLock A pointer to the spin lock to initialize to the released
state.
@return SpinLock
@return SpinLock in released state.
**/
SPIN_LOCK *
@@ -103,7 +102,7 @@ InitializeSpinLock (
@param SpinLock A pointer to the spin lock to place in the acquired state.
@return SpinLock
@return SpinLock aquiring lock.
**/
SPIN_LOCK *
@@ -226,7 +225,7 @@ AcquireSpinLockOrFail (
@param SpinLock A pointer to the spin lock to release.
@return SpinLock
@return SpinLock releasing lock.
**/
SPIN_LOCK *
@@ -375,6 +374,8 @@ InterlockedCompareExchange64 (
operation.
@param CompareValue Pointer value used in compare operation.
@param ExchangeValue Pointer value used in exchange operation.
@return The original *Value before exchange.
**/
VOID *

View File

@@ -28,7 +28,7 @@
@param Buffer Pointer to a 16-bit value that may be unaligned.
@return *Uint16
@return Data read from Buffer.
**/
UINT16
@@ -54,7 +54,7 @@ ReadUnaligned16 (
@param Buffer Pointer to a 16-bit value that may be unaligned.
@param Value 16-bit value to write to Buffer.
@return Value
@return Value written to Buffer
**/
UINT16
@@ -79,7 +79,7 @@ WriteUnaligned16 (
@param Buffer Pointer to a 24-bit value that may be unaligned.
@return The value read.
@return The value read from Buffer.
**/
UINT32
@@ -105,7 +105,7 @@ ReadUnaligned24 (
@param Buffer Pointer to a 24-bit value that may be unaligned.
@param Value 24-bit value to write to Buffer.
@return The value written.
@return The value written to Buffer.
**/
UINT32
@@ -131,7 +131,7 @@ WriteUnaligned24 (
@param Buffer Pointer to a 32-bit value that may be unaligned.
@return *Uint32
@return Data read from Buffer.
**/
UINT32
@@ -157,7 +157,7 @@ ReadUnaligned32 (
@param Buffer Pointer to a 32-bit value that may be unaligned.
@param Value 32-bit value to write to Buffer.
@return Value
@return Value written to Buffer
**/
UINT32
@@ -182,7 +182,7 @@ WriteUnaligned32 (
@param Buffer Pointer to a 64-bit value that may be unaligned.
@return *Uint64
@return Data read from Buffer.
**/
UINT64
@@ -208,7 +208,7 @@ ReadUnaligned64 (
@param Buffer Pointer to a 64-bit value that may be unaligned.
@param Value 64-bit value to write to Buffer.
@return Value
@return Value written to Buffer.
**/
UINT64

View File

@@ -40,12 +40,12 @@ AsmFxRestore (
)
{
ASSERT (Buffer != NULL);
ASSERT (((UINTN)Buffer & 0xf) == 0);
ASSERT (0 == ((UINTN)Buffer & 0xf));
//
// Check the flag recorded by AsmFxSave()
//
ASSERT (*(UINT32 *) (&Buffer[sizeof (IA32_FX_BUFFER) - 4]) == 0xAA5555AA);
ASSERT (0xAA5555AA == *(UINT32 *) (&Buffer[sizeof (IA32_FX_BUFFER) - 4]));
InternalX86FxRestore (Buffer);
}

View File

@@ -39,7 +39,7 @@ AsmFxSave (
)
{
ASSERT (Buffer != NULL);
ASSERT (((UINTN)Buffer & 0xf) == 0);
ASSERT (0 == ((UINTN)Buffer & 0xf));
InternalX86FxSave (Buffer);

View File

@@ -37,7 +37,7 @@ GetInterruptState (
IA32_EFLAGS32 EFlags;
EFlags.UintN = AsmReadEflags ();
return (BOOLEAN)(EFlags.Bits.IF == 1);
return (BOOLEAN)(1 == EFlags.Bits.IF);
}