1. Added '#pragma pack' directive in BaseLib.h for the structure IA32_DESCRIPTOR

2. Updated SetMem64.asm's to remove any SSE3 instructions.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@901 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
bxing 2006-07-12 09:23:28 +00:00
parent 7867eb23e8
commit db8f40e294
4 changed files with 55 additions and 55 deletions

View File

@ -134,7 +134,7 @@ typedef struct {
If Source is NULL, then ASSERT(). If Source is NULL, then ASSERT().
If Source and Destination overlap, then ASSERT(). If Source and Destination overlap, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and Source contains more than If PcdMaximumUnicodeStringLength is not zero, and Source contains more than
PcdMaximumUnicodeStringLength Unicode characters not including the PcdMaximumUnicodeStringLength Unicode characters not including the
Null-terminator, then ASSERT(). Null-terminator, then ASSERT().
@param Destination Pointer to a Null-terminated Unicode string. @param Destination Pointer to a Null-terminated Unicode string.
@ -166,7 +166,7 @@ StrCpy (
If Source is NULL, then ASSERT(). If Source is NULL, then ASSERT().
If Source and Destination overlap, then ASSERT(). If Source and Destination overlap, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and Source contains more than If PcdMaximumUnicodeStringLength is not zero, and Source contains more than
PcdMaximumUnicodeStringLength Unicode characters not including the PcdMaximumUnicodeStringLength Unicode characters not including the
Null-terminator, then ASSERT(). Null-terminator, then ASSERT().
@param Destination Pointer to a Null-terminated Unicode string. @param Destination Pointer to a Null-terminated Unicode string.
@ -191,7 +191,7 @@ StrnCpy (
If String is NULL, then ASSERT(). If String is NULL, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and String contains more than If PcdMaximumUnicodeStringLength is not zero, and String contains more than
PcdMaximumUnicodeStringLength Unicode characters not including the PcdMaximumUnicodeStringLength Unicode characters not including the
Null-terminator, then ASSERT(). Null-terminator, then ASSERT().
@param String Pointer to a Null-terminated Unicode string. @param String Pointer to a Null-terminated Unicode string.
@ -213,7 +213,7 @@ StrLen (
If String is NULL, then ASSERT(). If String is NULL, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and String contains more than If PcdMaximumUnicodeStringLength is not zero, and String contains more than
PcdMaximumUnicodeStringLength Unicode characters not including the PcdMaximumUnicodeStringLength Unicode characters not including the
Null-terminator, then ASSERT(). Null-terminator, then ASSERT().
@param String Pointer to a Null-terminated Unicode string. @param String Pointer to a Null-terminated Unicode string.
@ -239,10 +239,10 @@ StrSize (
If FirstString is NULL, then ASSERT(). If FirstString is NULL, then ASSERT().
If SecondString is NULL, then ASSERT(). If SecondString is NULL, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and FirstString contains more If PcdMaximumUnicodeStringLength is not zero, and FirstString contains more
than PcdMaximumUnicodeStringLength Unicode characters not including the than PcdMaximumUnicodeStringLength Unicode characters not including the
Null-terminator, then ASSERT(). Null-terminator, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and SecondString contains more If PcdMaximumUnicodeStringLength is not zero, and SecondString contains more
than PcdMaximumUnicodeStringLength Unicode characters not including the than PcdMaximumUnicodeStringLength Unicode characters not including the
Null-terminator, then ASSERT(). Null-terminator, then ASSERT().
@param FirstString Pointer to a Null-terminated Unicode string. @param FirstString Pointer to a Null-terminated Unicode string.
@ -751,7 +751,7 @@ InitializeListHead (
If Entry is NULL, then ASSERT(). If Entry is NULL, then ASSERT().
If ListHead was not initialized with InitializeListHead(), then ASSERT(). If ListHead was not initialized with InitializeListHead(), 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
equal to PcdMaximumLinkedListLength, then ASSERT(). equal to PcdMaximumLinkedListLength, then ASSERT().
@param ListHead A pointer to the head node of a doubly linked list. @param ListHead A pointer to the head node of a doubly linked list.
@ -779,7 +779,7 @@ InsertHeadList (
If Entry is NULL, then ASSERT(). If Entry is NULL, then ASSERT().
If ListHead was not initialized with InitializeListHead(), then ASSERT(). If ListHead was not initialized with InitializeListHead(), 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
equal to PcdMaximumLinkedListLength, then ASSERT(). equal to PcdMaximumLinkedListLength, then ASSERT().
@param ListHead A pointer to the head node of a doubly linked list. @param ListHead A pointer to the head node of a doubly linked list.
@ -805,8 +805,8 @@ InsertTailList (
If List is NULL, then ASSERT(). If List is NULL, then ASSERT().
If List was not initialized with InitializeListHead(), then ASSERT(). If List was not initialized with InitializeListHead(), then ASSERT().
If PcdMaximumLinkedListLenth is not zero, and the number of nodes If PcdMaximumLinkedListLenth is not zero, and the number of nodes
in List, including the List node, is greater than or equal to in List, including the List node, is greater than or equal to
PcdMaximumLinkedListLength, then ASSERT(). PcdMaximumLinkedListLength, then ASSERT().
@param List A pointer to the head node of a doubly linked list. @param List A pointer to the head node of a doubly linked list.
@ -857,8 +857,8 @@ GetNextNode (
If ListHead is NULL, then ASSERT(). If ListHead is NULL, then ASSERT().
If ListHead was not initialized with InitializeListHead(), then ASSERT(). If ListHead was not initialized with InitializeListHead(), then ASSERT().
If PcdMaximumLinkedListLenth is not zero, and the number of nodes If PcdMaximumLinkedListLenth is not zero, and the number of nodes
in List, including the List node, is greater than or equal to in List, including the List node, is greater than or equal to
PcdMaximumLinkedListLength, then ASSERT(). PcdMaximumLinkedListLength, then ASSERT().
@param ListHead A pointer to the head node of a doubly linked list. @param ListHead A pointer to the head node of a doubly linked list.
@ -883,8 +883,8 @@ IsListEmpty (
If List is NULL, then ASSERT(). If List is NULL, then ASSERT().
If Node is NULL, then ASSERT(). If Node is NULL, then ASSERT().
If List was not initialized with InitializeListHead(), then ASSERT(). If List was not initialized with InitializeListHead(), then ASSERT().
If PcdMaximumLinkedListLenth is not zero, and the number of nodes If PcdMaximumLinkedListLenth is not zero, and the number of nodes
in List, including the List node, is greater than or equal to in List, including the List node, is greater than or equal to
PcdMaximumLinkedListLength, then ASSERT(). PcdMaximumLinkedListLength, then ASSERT().
If Node is not a node in List and Node is not equal to List, then ASSERT(). If Node is not a node in List and Node is not equal to List, then ASSERT().
@ -912,8 +912,8 @@ IsNull (
If List is NULL, then ASSERT(). If List is NULL, then ASSERT().
If Node is NULL, then ASSERT(). If Node is NULL, then ASSERT().
If List was not initialized with InitializeListHead(), then ASSERT(). If List was not initialized with InitializeListHead(), then ASSERT().
If PcdMaximumLinkedListLenth is not zero, and the number of nodes If PcdMaximumLinkedListLenth is not zero, and the number of nodes
in List, including the List node, is greater than or equal to in List, including the List node, is greater than or equal to
PcdMaximumLinkedListLength, then ASSERT(). PcdMaximumLinkedListLength, then ASSERT().
If Node is not a node in List, then ASSERT(). If Node is not a node in List, then ASSERT().
@ -947,7 +947,7 @@ IsNodeAtEnd (
If SecondEntry and FirstEntry are not in the same linked list, then ASSERT(). If SecondEntry and FirstEntry are not in the same linked list, then ASSERT().
If PcdMaximumLinkedListLength is not zero, and the number of nodes in the If PcdMaximumLinkedListLength is not zero, and the number of nodes in the
linked list containing the FirstEntry and SecondEntry nodes, including linked list containing the FirstEntry and SecondEntry nodes, including
the FirstEntry and SecondEntry nodes, is greater than or equal to the FirstEntry and SecondEntry nodes, is greater than or equal to
PcdMaximumLinkedListLength, then ASSERT(). PcdMaximumLinkedListLength, then ASSERT().
@param FirstEntry A pointer to a node in a linked list. @param FirstEntry A pointer to a node in a linked list.
@ -973,8 +973,8 @@ SwapListEntries (
If Entry is NULL, then ASSERT(). If Entry is NULL, then ASSERT().
If Entry is the head node of an empty list, then ASSERT(). If Entry is the head node of an empty list, then ASSERT().
If PcdMaximumLinkedListLength is not zero, and the number of nodes in the If PcdMaximumLinkedListLength is not zero, and the number of nodes in the
linked list containing Entry, including the Entry node, is greater than linked list containing Entry, including the Entry node, is greater than
or equal to PcdMaximumLinkedListLength, then ASSERT(). or equal to PcdMaximumLinkedListLength, then ASSERT().
@param Entry A pointer to a node in a linked list @param Entry A pointer to a node in a linked list
@ -2905,10 +2905,12 @@ typedef union {
// Byte packed structure for an IDTR, GDTR, LDTR descriptor // Byte packed structure for an IDTR, GDTR, LDTR descriptor
/// @bug How to make this structure byte-packed in a compiler independent way? /// @bug How to make this structure byte-packed in a compiler independent way?
// //
#pragma pack (1)
typedef struct { typedef struct {
UINT16 Limit; UINT16 Limit;
UINTN Base; UINTN Base;
} IA32_DESCRIPTOR; } IA32_DESCRIPTOR;
#pragma pack ()
#define IA32_IDT_GATE_TYPE_TASK 0x85 #define IA32_IDT_GATE_TYPE_TASK 0x85
#define IA32_IDT_GATE_TYPE_INTERRUPT_16 0x86 #define IA32_IDT_GATE_TYPE_INTERRUPT_16 0x86

View File

@ -34,14 +34,14 @@
; IN UINT64 Value ; IN UINT64 Value
; ) ; )
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
InternalMemSetMem64 PROC USES edi InternalMemSetMem64 PROC
movq mm0, [esp + 16] mov eax, [esp + 4]
mov ecx, [esp + 12] mov ecx, [esp + 8]
mov edi, [esp + 8] movq mm0, [esp + 12]
mov eax, edi mov edx, eax
@@: @@:
movntq [edi], mm0 movntq [edx], mm0
add edi, 8 add edx, 8
loop @B loop @B
mfence mfence
ret ret

View File

@ -28,34 +28,34 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; VOID * ; VOID *
; _mem_SetMem64 ( ; InternalMemSetMem64 (
; IN VOID *Buffer, ; IN VOID *Buffer,
; IN UINTN Count, ; IN UINTN Count,
; IN UINT64 Value ; IN UINT64 Value
; ) ; )
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
InternalMemSetMem64 PROC USES edi InternalMemSetMem64 PROC
mov ecx, [esp + 12] mov eax, [esp + 4]
mov edi, [esp + 8] mov ecx, [esp + 8]
test edi, 8 test al, 8
DB 0f2h, 0fh, 12h, 44h, 24h, 16 ; movddup xmm0, [esp + 16] mov edx, eax
movq xmm0, [esp + 12]
jz @F jz @F
movq [edi], xmm0 movq [edx], xmm0
add edi, 8 add edx, 8
dec ecx dec ecx
@@: @@:
mov edx, ecx
shr ecx, 1 shr ecx, 1
jz @SetQwords jz @SetQwords
movlhps xmm0, xmm0
@@: @@:
movntdq [edi], xmm0 movntdq [edx], xmm0
add edi, 16 lea edx, [edx + 16]
loop @B loop @B
mfence mfence
@SetQwords: @SetQwords:
test dl, 1 jnc @F
jz @F movq [edx], xmm0
movq [edi], xmm0
@@: @@:
ret ret
InternalMemSetMem64 ENDP InternalMemSetMem64 ENDP

View File

@ -25,35 +25,33 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; VOID * ; VOID *
; _mem_SetMem64 ( ; InternalMemSetMem64 (
; IN VOID *Buffer, ; IN VOID *Buffer,
; IN UINTN Count, ; IN UINTN Count,
; IN UINT8 Value ; IN UINT64 Value
; ) ; )
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
InternalMemSetMem64 PROC USES rdi InternalMemSetMem64 PROC
mov rdi, rcx mov rax, rcx
mov r9, rcx test dl, 8
test cl, 8 xchg rcx, rdx
jz @F jz @F
mov [rdi], r8 mov [rdx], r8
add rdi, 8 add rdx, 8
dec rdx dec rcx
@@: @@:
mov rcx, rdx
shr rcx, 1 shr rcx, 1
jz @SetQwords jz @SetQwords
movd xmm0, r8 movd xmm0, r8
movlhps xmm0, xmm0 movlhps xmm0, xmm0
@@: @@:
movntdq [rdi], xmm0 movntdq [rdx], xmm0
add rdi, 16 lea rdx, [rdx + 16]
loop @B loop @B
mfence mfence
@SetQwords: @SetQwords:
test dl, 1 jnc @F
jz @F mov [rdx], r8
mov [rdi], r8
@@: @@:
ret ret
InternalMemSetMem64 ENDP InternalMemSetMem64 ENDP