mirror of https://github.com/acidanthera/audk.git
Add PcdVerifyNoteInList for judge whether do verification of node in list in debug mode. The default value is FALSE.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9016 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
558bfebb99
commit
1081f624a4
|
@ -1357,7 +1357,7 @@ GetFirstNode (
|
|||
InitializeListHead(), then ASSERT().
|
||||
If PcdMaximumLinkedListLenth is not zero, and List contains more than
|
||||
PcdMaximumLinkedListLenth nodes, then ASSERT().
|
||||
If Node is not a node in List, then ASSERT().
|
||||
If PcdVerifyNodeInList is TRUE and Node is not a node in List, then ASSERT().
|
||||
|
||||
@param List A pointer to the head node of a doubly linked list.
|
||||
@param Node A pointer to a node in the doubly linked list.
|
||||
|
@ -1416,7 +1416,8 @@ IsListEmpty (
|
|||
If PcdMaximumLinkedListLenth is not zero, and the number of nodes
|
||||
in List, including the List node, is greater than or equal to
|
||||
PcdMaximumLinkedListLength, then ASSERT().
|
||||
If Node is not a node in List and Node is not equal to List, then ASSERT().
|
||||
If PcdVerifyNodeInList is TRUE and Node is not a node in List the and Node is not equal
|
||||
to List, then ASSERT().
|
||||
|
||||
@param List A pointer to the head node of a doubly linked list.
|
||||
@param Node A pointer to a node in the doubly linked list.
|
||||
|
@ -1447,7 +1448,7 @@ IsNull (
|
|||
If PcdMaximumLinkedListLenth is not zero, and the number of nodes
|
||||
in List, including the List node, is greater than or equal to
|
||||
PcdMaximumLinkedListLength, then ASSERT().
|
||||
If Node is not a node in List, then ASSERT().
|
||||
If PcdVerifyNodeInList is TRUE and Node is not a node in List, then ASSERT().
|
||||
|
||||
@param List A pointer to the head node of a doubly linked list.
|
||||
@param Node A pointer to a node in the doubly linked list.
|
||||
|
@ -1477,7 +1478,8 @@ IsNodeAtEnd (
|
|||
|
||||
If FirstEntry is NULL, then ASSERT().
|
||||
If SecondEntry is NULL, then ASSERT().
|
||||
If SecondEntry and FirstEntry are not in the same linked list, then ASSERT().
|
||||
If PcdVerifyNodeInList is TRUE and SecondEntry and FirstEntry are not in the
|
||||
same linked list, then ASSERT().
|
||||
If PcdMaximumLinkedListLength is not zero, and the number of nodes in the
|
||||
linked list containing the FirstEntry and SecondEntry nodes, including
|
||||
the FirstEntry and SecondEntry nodes, is greater than or equal to
|
||||
|
|
|
@ -591,8 +591,8 @@
|
|||
DebugLib
|
||||
BaseMemoryLib
|
||||
|
||||
[Pcd.common]
|
||||
[Pcd]
|
||||
gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength
|
||||
gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength
|
||||
gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength
|
||||
|
||||
gEfiMdePkgTokenSpaceGuid.PcdVerifyNodeInList
|
||||
|
|
|
@ -23,28 +23,36 @@
|
|||
If List is NULL, then ASSERT().
|
||||
If List->ForwardLink is NULL, then ASSERT().
|
||||
If List->backLink is NULL, then ASSERT().
|
||||
If Node is NULL, then ASSERT();
|
||||
If PcdMaximumLinkedListLenth is not zero, and prior to insertion the number
|
||||
of nodes in ListHead, including the ListHead node, is greater than or
|
||||
equal to PcdMaximumLinkedListLength, then ASSERT().
|
||||
If Node is NULL, then ASSERT().
|
||||
If PcdVerifyNodeInList is TRUE and DoMembershipCheck is TRUE and Node
|
||||
is in not a member of List, then return FALSE
|
||||
If PcdMaximumLinkedListLenth is not zero, and List contains more than
|
||||
PcdMaximumLinkedListLenth nodes, then ASSERT().
|
||||
|
||||
@param List A pointer to a node in a linked list.
|
||||
@param Node A pointer to one nod.
|
||||
@param List A pointer to a node in a linked list.
|
||||
@param Node A pointer to a node in a linked list.
|
||||
@param VerifyNodeInList TRUE if a check should be made to see if Node is a
|
||||
member of List. FALSE if no membership test should
|
||||
be performed.
|
||||
|
||||
@retval TRUE Node is in List
|
||||
@retval FALSE Node isn't in List, or List is invalid
|
||||
@retval TRUE if PcdVerifyNodeInList is FALSE
|
||||
@retval TRUE if DoMembershipCheck is FALSE
|
||||
@retval TRUE if PcdVerifyNodeInList is TRUE and DoMembershipCheck is TRUE
|
||||
and Node is a member of List.
|
||||
@retval FALSE if PcdVerifyNodeInList is TRUE and DoMembershipCheck is TRUE
|
||||
and Node is in not a member of List.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
InternalBaseLibIsNodeInList (
|
||||
IN CONST LIST_ENTRY *List,
|
||||
IN CONST LIST_ENTRY *Node
|
||||
IN CONST LIST_ENTRY *List,
|
||||
IN CONST LIST_ENTRY *Node,
|
||||
IN BOOLEAN VerifyNodeInList
|
||||
)
|
||||
{
|
||||
UINTN Count;
|
||||
CONST LIST_ENTRY *Ptr;
|
||||
BOOLEAN Found;
|
||||
UINTN Count;
|
||||
CONST LIST_ENTRY *Ptr;
|
||||
|
||||
//
|
||||
// Test the validity of List and Node
|
||||
|
@ -54,24 +62,54 @@ InternalBaseLibIsNodeInList (
|
|||
ASSERT (List->BackLink != NULL);
|
||||
ASSERT (Node != NULL);
|
||||
|
||||
Count = PcdGet32 (PcdMaximumLinkedListLength);
|
||||
Count = 0;
|
||||
Ptr = List;
|
||||
|
||||
Ptr = List;
|
||||
do {
|
||||
Ptr = Ptr->ForwardLink;
|
||||
Count--;
|
||||
} while ((Ptr != List) && (Ptr != Node) && (Count > 0));
|
||||
Found = (BOOLEAN)(Ptr == Node);
|
||||
|
||||
if (PcdGet32 (PcdMaximumLinkedListLength) > 0) {
|
||||
while ((Count > 0) && (Ptr != List)) {
|
||||
if (FeaturePcdGet (PcdVerifyNodeInList) && VerifyNodeInList) {
|
||||
//
|
||||
// Check to see if Node is a member of List.
|
||||
// Exit early if the number of nodes in List >= PcdMaximumLinkedListLength
|
||||
//
|
||||
do {
|
||||
Ptr = Ptr->ForwardLink;
|
||||
Count--;
|
||||
if (PcdGet32 (PcdMaximumLinkedListLength) > 0) {
|
||||
Count++;
|
||||
//
|
||||
// ASSERT() if the linked list is too long
|
||||
//
|
||||
ASSERT (Count < PcdGet32 (PcdMaximumLinkedListLength));
|
||||
|
||||
//
|
||||
// Return if the linked list is too long
|
||||
//
|
||||
if (Count >= PcdGet32 (PcdMaximumLinkedListLength)) {
|
||||
return (BOOLEAN)(Ptr == Node);
|
||||
}
|
||||
}
|
||||
} while ((Ptr != List) && (Ptr != Node));
|
||||
|
||||
if (Ptr != Node) {
|
||||
return FALSE;
|
||||
}
|
||||
ASSERT (Count > 0);
|
||||
}
|
||||
|
||||
return Found;
|
||||
if (PcdGet32 (PcdMaximumLinkedListLength) > 0) {
|
||||
//
|
||||
// Count the total number of nodes in List.
|
||||
// Exit early if the number of nodes in List >= PcdMaximumLinkedListLength
|
||||
//
|
||||
do {
|
||||
Ptr = Ptr->ForwardLink;
|
||||
Count++;
|
||||
} while ((Ptr != List) && (Count < PcdGet32 (PcdMaximumLinkedListLength)));
|
||||
|
||||
//
|
||||
// ASSERT() if the linked list is too long
|
||||
//
|
||||
ASSERT (Count < PcdGet32 (PcdMaximumLinkedListLength));
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -136,7 +174,7 @@ InsertHeadList (
|
|||
//
|
||||
// ASSERT List not too long and Entry is not one of the nodes of List
|
||||
//
|
||||
ASSERT (!InternalBaseLibIsNodeInList (ListHead, Entry));
|
||||
ASSERT (InternalBaseLibIsNodeInList (ListHead, Entry, FALSE));
|
||||
|
||||
Entry->ForwardLink = ListHead->ForwardLink;
|
||||
Entry->BackLink = ListHead;
|
||||
|
@ -177,7 +215,7 @@ InsertTailList (
|
|||
//
|
||||
// ASSERT List not too long and Entry is not one of the nodes of List
|
||||
//
|
||||
ASSERT (!InternalBaseLibIsNodeInList (ListHead, Entry));
|
||||
ASSERT (InternalBaseLibIsNodeInList (ListHead, Entry, FALSE));
|
||||
|
||||
Entry->ForwardLink = ListHead;
|
||||
Entry->BackLink = ListHead->BackLink;
|
||||
|
@ -215,7 +253,7 @@ GetFirstNode (
|
|||
//
|
||||
// ASSERT List not too long
|
||||
//
|
||||
ASSERT (InternalBaseLibIsNodeInList (List, List));
|
||||
ASSERT (InternalBaseLibIsNodeInList (List, List, FALSE));
|
||||
|
||||
return List->ForwardLink;
|
||||
}
|
||||
|
@ -233,7 +271,7 @@ GetFirstNode (
|
|||
InitializeListHead(), then ASSERT().
|
||||
If PcdMaximumLinkedListLenth is not zero, and List contains more than
|
||||
PcdMaximumLinkedListLenth nodes, then ASSERT().
|
||||
If Node is not a node in List, then ASSERT().
|
||||
If PcdVerifyNodeInList is TRUE and Node is not a node in List, then ASSERT().
|
||||
|
||||
@param List A pointer to the head node of a doubly linked list.
|
||||
@param Node A pointer to a node in the doubly linked list.
|
||||
|
@ -252,7 +290,7 @@ GetNextNode (
|
|||
//
|
||||
// ASSERT List not too long and Node is one of the nodes of List
|
||||
//
|
||||
ASSERT (InternalBaseLibIsNodeInList (List, Node));
|
||||
ASSERT (InternalBaseLibIsNodeInList (List, Node, TRUE));
|
||||
|
||||
return Node->ForwardLink;
|
||||
}
|
||||
|
@ -285,7 +323,7 @@ IsListEmpty (
|
|||
//
|
||||
// ASSERT List not too long
|
||||
//
|
||||
ASSERT (InternalBaseLibIsNodeInList (ListHead, ListHead));
|
||||
ASSERT (InternalBaseLibIsNodeInList (ListHead, ListHead, FALSE));
|
||||
|
||||
return (BOOLEAN)(ListHead->ForwardLink == ListHead);
|
||||
}
|
||||
|
@ -306,7 +344,8 @@ IsListEmpty (
|
|||
If PcdMaximumLinkedListLenth is not zero, and the number of nodes
|
||||
in List, including the List node, is greater than or equal to
|
||||
PcdMaximumLinkedListLength, then ASSERT().
|
||||
If Node is not a node in List and Node is not equal to List, then ASSERT().
|
||||
If PcdVerifyNodeInList is TRUE and Node is not a node in List and Node is not
|
||||
equal to List, then ASSERT().
|
||||
|
||||
@param List A pointer to the head node of a doubly linked list.
|
||||
@param Node A pointer to a node in the doubly linked list.
|
||||
|
@ -325,7 +364,7 @@ IsNull (
|
|||
//
|
||||
// ASSERT List not too long and Node is one of the nodes of List
|
||||
//
|
||||
ASSERT (InternalBaseLibIsNodeInList (List, Node));
|
||||
ASSERT (InternalBaseLibIsNodeInList (List, Node, TRUE));
|
||||
|
||||
return (BOOLEAN)(Node == List);
|
||||
}
|
||||
|
@ -344,7 +383,7 @@ IsNull (
|
|||
If PcdMaximumLinkedListLenth is not zero, and the number of nodes
|
||||
in List, including the List node, is greater than or equal to
|
||||
PcdMaximumLinkedListLength, then ASSERT().
|
||||
If Node is not a node in List, then ASSERT().
|
||||
If PcdVerifyNodeInList is TRUE and Node is not a node in List, then ASSERT().
|
||||
|
||||
@param List A pointer to the head node of a doubly linked list.
|
||||
@param Node A pointer to a node in the doubly linked list.
|
||||
|
@ -363,7 +402,7 @@ IsNodeAtEnd (
|
|||
//
|
||||
// ASSERT List not too long and Node is one of the nodes of List
|
||||
//
|
||||
ASSERT (InternalBaseLibIsNodeInList (List, Node));
|
||||
ASSERT (InternalBaseLibIsNodeInList (List, Node, TRUE));
|
||||
|
||||
return (BOOLEAN)(!IsNull (List, Node) && List->BackLink == Node);
|
||||
}
|
||||
|
@ -381,7 +420,8 @@ IsNodeAtEnd (
|
|||
|
||||
If FirstEntry is NULL, then ASSERT().
|
||||
If SecondEntry is NULL, then ASSERT().
|
||||
If SecondEntry and FirstEntry are not in the same linked list, then ASSERT().
|
||||
If PcdVerifyNodeInList is TRUE and SecondEntry and FirstEntry are not in the
|
||||
same linked list, then ASSERT().
|
||||
If PcdMaximumLinkedListLength is not zero, and the number of nodes in the
|
||||
linked list containing the FirstEntry and SecondEntry nodes, including
|
||||
the FirstEntry and SecondEntry nodes, is greater than or equal to
|
||||
|
@ -409,7 +449,7 @@ SwapListEntries (
|
|||
//
|
||||
// ASSERT Entry1 and Entry2 are in the same linked list
|
||||
//
|
||||
ASSERT (InternalBaseLibIsNodeInList (FirstEntry, SecondEntry));
|
||||
ASSERT (InternalBaseLibIsNodeInList (FirstEntry, SecondEntry, TRUE));
|
||||
|
||||
//
|
||||
// Ptr is the node pointed to by FirstEntry->ForwardLink
|
||||
|
|
|
@ -823,7 +823,12 @@
|
|||
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangDeprecate|FALSE|BOOLEAN|0x00000012
|
||||
|
||||
## If TRUE, UGA Draw Protocol is still consumed.
|
||||
gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport|TRUE|BOOLEAN|0x00000013
|
||||
gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport|TRUE|BOOLEAN|0x00000027
|
||||
|
||||
## If TRUE, a check will be made to see if a specified node is a member of linked list
|
||||
# in the following BaseLib fucntions: GetNextNode(), IsNull(), IsNodeAtEnd(),
|
||||
# SwapListEntries()
|
||||
gEfiMdePkgTokenSpaceGuid.PcdVerifyNodeInList|FALSE|BOOLEAN|0x00000028
|
||||
|
||||
[PcdsFixedAtBuild]
|
||||
## Indicates the maximum length of unicode string
|
||||
|
|
Loading…
Reference in New Issue