diff options
Diffstat (limited to 'MdePkg/Library/BaseLib')
-rw-r--r-- | MdePkg/Library/BaseLib/Ia32/EnablePaging64.asm | 39 | ||||
-rw-r--r-- | MdePkg/Library/BaseLib/LinkedList.c | 42 | ||||
-rw-r--r-- | MdePkg/Library/BaseLib/String.c | 90 |
3 files changed, 96 insertions, 75 deletions
diff --git a/MdePkg/Library/BaseLib/Ia32/EnablePaging64.asm b/MdePkg/Library/BaseLib/Ia32/EnablePaging64.asm index 97d859e966..6c9b0ea76b 100644 --- a/MdePkg/Library/BaseLib/Ia32/EnablePaging64.asm +++ b/MdePkg/Library/BaseLib/Ia32/EnablePaging64.asm @@ -26,13 +26,9 @@ .code
InternalX86EnablePaging64 PROC
- cli -
- mov ebx, [esp + 4] ; save CS - mov eax, OFFSET cs_address - mov word ptr [eax], bx ; Update CS selector for far jump -
- mov eax, cr4
+ cli
+ mov [esp], @F ; offset for far retf
+ mov eax, cr4
or al, (1 SHL 5)
mov cr4, eax ; enable PAE
mov ecx, 0c0000080h
@@ -41,30 +37,19 @@ InternalX86EnablePaging64 PROC wrmsr
mov eax, cr0
bts eax, 31
- mov cr0, eax ; enable paging - retf - jmp go_to_long_mode -go_to_long_mode: - - ; - ; This is the next instruction after enabling paging. Jump to long mode - ; - db 067h - db 0eah ; Far Jump Offset:Selector to reload CS - dd OFFSET in_long_mode ; Offset is ensuing instruction boundary -cs_address: - dw 0h ; CS selector will be updated at runtime -
-in_long_mode: ; now in long mode + mov cr0, eax ; enable paging
+ retf
+@@: ; long mode starts here
+ DB 67h, 48h
+ mov ebx, [esp] ; mov rbx, [esp]
DB 67h, 48h
- mov ebx, [esp + 8] ; mov rbx, [esp]
- DB 67h, 48h
- mov ecx, [esp + 10h] ; mov rcx, [esp + 8]
+ mov ecx, [esp + 8] ; mov rcx, [esp + 8]
DB 67h, 48h
- mov edx, [esp + 18h] ; mov rdx, [esp + 10h]
+ mov edx, [esp + 10h] ; mov rdx, [esp + 10h]
DB 67h, 48h
- mov esp, [esp + 20h] ; mov rsp, [esp + 18h]
+ mov esp, [esp + 18h] ; mov rsp, [esp + 18h]
DB 48h
+ add esp, -20h ; add rsp, -20h
call ebx ; call rbx
jmp $
InternalX86EnablePaging64 ENDP
diff --git a/MdePkg/Library/BaseLib/LinkedList.c b/MdePkg/Library/BaseLib/LinkedList.c index 846a813269..a1a2453fde 100644 --- a/MdePkg/Library/BaseLib/LinkedList.c +++ b/MdePkg/Library/BaseLib/LinkedList.c @@ -96,8 +96,9 @@ InitializeListHead ( If ListHead is NULL, then ASSERT().
If Entry is NULL, then ASSERT().
If ListHead was not initialized with InitializeListHead(), then ASSERT().
- If PcdMaximumLinkedListLenth is not zero, and ListHead contains more than
- PcdMaximumLinkedListLenth nodes, 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().
@param ListHead A pointer to the head node of a doubly linked list.
@param Entry A pointer to a node that is to be inserted at the beginning
@@ -135,8 +136,9 @@ InsertHeadList ( If ListHead is NULL, then ASSERT().
If Entry is NULL, then ASSERT().
If ListHead was not initialized with InitializeListHead(), then ASSERT().
- If PcdMaximumLinkedListLenth is not zero, and ListHead contains more than
- PcdMaximumLinkedListLenth nodes, 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().
@param ListHead A pointer to the head node of a doubly linked list.
@param Entry A pointer to a node that is to be added at the end of the
@@ -173,8 +175,9 @@ InsertTailList ( If List is NULL, then ASSERT().
If List was not initialized with InitializeListHead(), then ASSERT().
- If PcdMaximumLinkedListLenth is not zero, and List contains more than
- PcdMaximumLinkedListLenth nodes, then ASSERT().
+ 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().
@param List A pointer to the head node of a doubly linked list.
@@ -240,8 +243,9 @@ GetNextNode ( If ListHead is NULL, then ASSERT().
If ListHead was not initialized with InitializeListHead(), then ASSERT().
- If PcdMaximumLinkedListLenth is not zero, and List contains more than
- PcdMaximumLinkedListLenth nodes, then ASSERT().
+ 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().
@param ListHead A pointer to the head node of a doubly linked list.
@@ -273,8 +277,9 @@ IsListEmpty ( If List is NULL, then ASSERT().
If Node is NULL, then ASSERT().
If List was not initialized with InitializeListHead(), then ASSERT().
- If PcdMaximumLinkedListLenth is not zero, and List contains more than
- PcdMaximumLinkedListLenth nodes, then ASSERT().
+ 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().
@param List A pointer to the head node of a doubly linked list.
@@ -309,8 +314,9 @@ IsNull ( If List is NULL, then ASSERT().
If Node is NULL, then ASSERT().
If List was not initialized with InitializeListHead(), then ASSERT().
- If PcdMaximumLinkedListLenth is not zero, and List contains more than
- PcdMaximumLinkedListLenth nodes, then ASSERT().
+ 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().
@param List A pointer to the head node of a doubly linked list.
@@ -349,9 +355,10 @@ 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 PcdMaximumLinkedListLenth is not zero, and the linked list containing
- FirstEntry and SecondEntry contains more than PcdMaximumLinkedListLenth
- nodes, 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
+ PcdMaximumLinkedListLength, then ASSERT().
@param FirstEntry A pointer to a node in a linked list.
@param SecondEntry A pointer to another node in the same linked list.
@@ -416,8 +423,9 @@ SwapListEntries ( If Entry is NULL, then ASSERT().
If Entry is the head node of an empty list, then ASSERT().
- If PcdMaximumLinkedListLenth is not zero, and the linked list containing
- Entry contains more than PcdMaximumLinkedListLenth nodes, then ASSERT().
+ If PcdMaximumLinkedListLength is not zero, and the number of nodes in the
+ linked list containing Entry, including the Entry node, is greater than
+ or equal to PcdMaximumLinkedListLength, then ASSERT().
@param Entry A pointer to a node in a linked list
diff --git a/MdePkg/Library/BaseLib/String.c b/MdePkg/Library/BaseLib/String.c index c4330fa5d2..80223c6732 100644 --- a/MdePkg/Library/BaseLib/String.c +++ b/MdePkg/Library/BaseLib/String.c @@ -26,7 +26,8 @@ If Source is NULL, then ASSERT().
If Source and Destination overlap, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and Source contains more than
- PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().
+ PcdMaximumUnicodeStringLength Unicode characters not including the
+ Null-terminator, then ASSERT().
@param Destination Pointer to a Null-terminated Unicode string.
@param Source Pointer to a Null-terminated Unicode string.
@@ -79,7 +80,8 @@ StrCpy ( If Source is NULL, then ASSERT().
If Source and Destination overlap, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and Source contains more than
- PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().
+ PcdMaximumUnicodeStringLength Unicode characters not including the
+ Null-terminator, then ASSERT().
@param Destination Pointer to a Null-terminated Unicode string.
@param Source Pointer to a Null-terminated Unicode string.
@@ -133,7 +135,8 @@ StrnCpy ( If String is NULL, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and String contains more than
- PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().
+ PcdMaximumUnicodeStringLength Unicode characters not including the
+ Null-terminator, then ASSERT().
@param String Pointer to a Null-terminated Unicode string.
@@ -171,7 +174,8 @@ StrLen ( If String is NULL, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and String contains more than
- PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().
+ PcdMaximumUnicodeStringLength Unicode characters not including the
+ Null-terminator, then ASSERT().
@param String Pointer to a Null-terminated Unicode string.
@@ -200,9 +204,11 @@ StrSize ( If FirstString is NULL, then ASSERT().
If SecondString is NULL, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and FirstString contains more
- than PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().
+ than PcdMaximumUnicodeStringLength Unicode characters not including the
+ Null-terminator, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and SecondString contains more
- than PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().
+ than PcdMaximumUnicodeStringLength Unicode characters not including the
+ Null-terminator, then ASSERT().
@param FirstString Pointer to a Null-terminated Unicode string.
@param SecondString Pointer to a Null-terminated Unicode string.
@@ -245,9 +251,11 @@ StrCmp ( If FirstString is NULL, then ASSERT().
If SecondString is NULL, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and FirstString contains more
- than PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().
+ than PcdMaximumUnicodeStringLength Unicode characters not including the
+ Null-terminator, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and SecondString contains more
- than PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().
+ than PcdMaximumUnicodeStringLength Unicode characters not including the
+ Null-terminator, then ASSERT().
@param FirstString Pointer to a Null-terminated Unicode string.
@param SecondString Pointer to a Null-terminated Unicode string.
@@ -301,12 +309,15 @@ StrnCmp ( If Source is NULL, then ASSERT().
If Source and Destination overlap, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and Destination contains more
- than PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().
+ than PcdMaximumUnicodeStringLength Unicode characters not including the
+ Null-terminator, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and Source contains more than
- PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().
+ PcdMaximumUnicodeStringLength Unicode characters not including the
+ Null-terminator, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and concatenating Destination
and Source results in a Unicode string with more than
- PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().
+ PcdMaximumUnicodeStringLength Unicode characters not including the
+ Null-terminator, then ASSERT().
@param Destination Pointer to a Null-terminated Unicode string.
@param Source Pointer to a Null-terminated Unicode string.
@@ -348,12 +359,15 @@ StrCat ( If Source is NULL, then ASSERT().
If Source and Destination overlap, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and Destination contains more
- than PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().
+ than PcdMaximumUnicodeStringLength Unicode characters not including the
+ Null-terminator, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and Source contains more than
- PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().
+ PcdMaximumUnicodeStringLength Unicode characters not including the
+ Null-terminator, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and concatenating Destination
and Source results in a Unicode string with more than
- PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().
+ PcdMaximumUnicodeStringLength Unicode characters not including the
+ Null-terminator, then ASSERT().
@param Destination Pointer to a Null-terminated Unicode string.
@param Source Pointer to a Null-terminated Unicode string.
@@ -393,7 +407,8 @@ StrnCat ( If Source is NULL, then ASSERT().
If Source and Destination overlap, then ASSERT().
If PcdMaximumAsciiStringLength is not zero and Source contains more than
- PcdMaximumAsciiStringLength ASCII characters, then ASSERT().
+ PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
+ then ASSERT().
@param Destination Pointer to a Null-terminated ASCII string.
@param Source Pointer to a Null-terminated ASCII string.
@@ -445,7 +460,8 @@ AsciiStrCpy ( If Source is NULL, then ASSERT().
If Source and Destination overlap, then ASSERT().
If PcdMaximumAsciiStringLength is not zero, and Source contains more than
- PcdMaximumAsciiStringLength ASCII characters, then ASSERT().
+ PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
+ then ASSERT().
@param Destination Pointer to a Null-terminated ASCII string.
@param Source Pointer to a Null-terminated ASCII string.
@@ -498,7 +514,8 @@ AsciiStrnCpy ( If String is NULL, then ASSERT().
If PcdMaximumAsciiStringLength is not zero and String contains more than
- PcdMaximumAsciiStringLength ASCII characters, then ASSERT().
+ PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
+ then ASSERT().
@param String Pointer to a Null-terminated ASCII string.
@@ -536,7 +553,8 @@ AsciiStrLen ( If String is NULL, then ASSERT().
If PcdMaximumAsciiStringLength is not zero and String contains more than
- PcdMaximumAsciiStringLength ASCII characters, then ASSERT().
+ PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
+ then ASSERT().
@param String Pointer to a Null-terminated ASCII string.
@@ -565,9 +583,11 @@ AsciiStrSize ( If FirstString is NULL, then ASSERT().
If SecondString is NULL, then ASSERT().
If PcdMaximumAsciiStringLength is not zero and FirstString contains more than
- PcdMaximumAsciiStringLength ASCII characters, then ASSERT().
+ PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
+ then ASSERT().
If PcdMaximumAsciiStringLength is not zero and SecondString contains more
- than PcdMaximumAsciiStringLength ASCII characters, then ASSERT().
+ than PcdMaximumAsciiStringLength ASCII characters not including the
+ Null-terminator, then ASSERT().
@param FirstString Pointer to a Null-terminated ASCII string.
@param SecondString Pointer to a Null-terminated ASCII string.
@@ -621,9 +641,11 @@ AsciiToUpper ( If FirstString is NULL, then ASSERT().
If SecondString is NULL, then ASSERT().
If PcdMaximumAsciiStringLength is not zero and FirstString contains more than
- PcdMaximumAsciiStringLength ASCII characters, then ASSERT().
+ PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
+ then ASSERT().
If PcdMaximumAsciiStringLength is not zero and SecondString contains more
- than PcdMaximumAsciiStringLength ASCII characters, then ASSERT().
+ than PcdMaximumAsciiStringLength ASCII characters not including the
+ Null-terminator, then ASSERT().
@param FirstString Pointer to a Null-terminated ASCII string.
@param SecondString Pointer to a Null-terminated ASCII string.
@@ -670,9 +692,11 @@ AsciiStriCmp ( If FirstString is NULL, then ASSERT().
If SecondString is NULL, then ASSERT().
If PcdMaximumAsciiStringLength is not zero and FirstString contains more than
- PcdMaximumAsciiStringLength ASCII characters, then ASSERT().
- If PcdMaximumAsciiStringLength is not zero and SecondString contains more
- than PcdMaximumAsciiStringLength ASCII characters, then ASSERT().
+ PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
+ then ASSERT().
+ If PcdMaximumAsciiStringLength is not zero and SecondString contains more than
+ PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
+ then ASSERT().
@param FirstString Pointer to a Null-terminated ASCII string.
@param SecondString Pointer to a Null-terminated ASCII string.
@@ -717,9 +741,11 @@ AsciiStrnCmp ( If Destination is NULL, then ASSERT().
If Source is NULL, then ASSERT().
If PcdMaximumAsciiStringLength is not zero and Destination contains more than
- PcdMaximumAsciiStringLength ASCII characters, then ASSERT().
+ PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
+ then ASSERT().
If PcdMaximumAsciiStringLength is not zero and Source contains more than
- PcdMaximumAsciiStringLength ASCII characters, then ASSERT().
+ PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
+ then ASSERT().
If PcdMaximumAsciiStringLength is not zero and concatenating Destination and
Source results in a ASCII string with more than PcdMaximumAsciiStringLength
ASCII characters, then ASSERT().
@@ -763,13 +789,15 @@ AsciiStrCat ( If Destination is NULL, then ASSERT().
If Source is NULL, then ASSERT().
If Source and Destination overlap, then ASSERT().
- If PcdMaximumAsciiStringLength is not zero, and Destination contains more
- than PcdMaximumAsciiStringLength ASCII characters, then ASSERT().
+ If PcdMaximumAsciiStringLength is not zero, and Destination contains more than
+ PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
+ then ASSERT().
If PcdMaximumAsciiStringLength is not zero, and Source contains more than
- PcdMaximumAsciiStringLength ASCII characters, then ASSERT().
+ PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
+ then ASSERT().
If PcdMaximumAsciiStringLength is not zero, and concatenating Destination and
Source results in a ASCII string with more than PcdMaximumAsciiStringLength
- ASCII characters, then ASSERT().
+ ASCII characters not including the Null-terminator, then ASSERT().
@param Destination Pointer to a Null-terminated ASCII string.
@param Source Pointer to a Null-terminated ASCII string.
|