]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1. Added '#pragma pack' directive in BaseLib.h for the structure IA32_DESCRIPTOR
authorbxing <bxing@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 12 Jul 2006 09:23:28 +0000 (09:23 +0000)
committerbxing <bxing@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 12 Jul 2006 09:23:28 +0000 (09:23 +0000)
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

MdePkg/Include/Library/BaseLib.h
MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem64.asm
MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem64.asm
MdePkg/Library/BaseMemoryLibSse2/x64/SetMem64.asm

index ca3fdbf3fe7db3226847719eb0189d7599fa694e..ea61da14ca4974ee18d910fe379cb54c6f9f5450 100644 (file)
@@ -134,7 +134,7 @@ typedef struct {
   If Source is NULL, then ASSERT().\r
   If Source and Destination overlap, then ASSERT().\r
   If PcdMaximumUnicodeStringLength is not zero, and Source contains more than\r
   If Source is NULL, then ASSERT().\r
   If Source and Destination overlap, then ASSERT().\r
   If PcdMaximumUnicodeStringLength is not zero, and Source contains more than\r
-  PcdMaximumUnicodeStringLength Unicode characters not including the \r
+  PcdMaximumUnicodeStringLength Unicode characters not including the\r
   Null-terminator, then ASSERT().\r
 \r
   @param  Destination Pointer to a Null-terminated Unicode string.\r
   Null-terminator, then ASSERT().\r
 \r
   @param  Destination Pointer to a Null-terminated Unicode string.\r
@@ -166,7 +166,7 @@ StrCpy (
   If Source is NULL, then ASSERT().\r
   If Source and Destination overlap, then ASSERT().\r
   If PcdMaximumUnicodeStringLength is not zero, and Source contains more than\r
   If Source is NULL, then ASSERT().\r
   If Source and Destination overlap, then ASSERT().\r
   If PcdMaximumUnicodeStringLength is not zero, and Source contains more than\r
-  PcdMaximumUnicodeStringLength Unicode characters not including the \r
+  PcdMaximumUnicodeStringLength Unicode characters not including the\r
   Null-terminator, then ASSERT().\r
 \r
   @param  Destination Pointer to a Null-terminated Unicode string.\r
   Null-terminator, then ASSERT().\r
 \r
   @param  Destination Pointer to a Null-terminated Unicode string.\r
@@ -191,7 +191,7 @@ StrnCpy (
 \r
   If String is NULL, then ASSERT().\r
   If PcdMaximumUnicodeStringLength is not zero, and String contains more than\r
 \r
   If String is NULL, then ASSERT().\r
   If PcdMaximumUnicodeStringLength is not zero, and String contains more than\r
-  PcdMaximumUnicodeStringLength Unicode characters not including the \r
+  PcdMaximumUnicodeStringLength Unicode characters not including the\r
   Null-terminator, then ASSERT().\r
 \r
   @param  String  Pointer to a Null-terminated Unicode string.\r
   Null-terminator, then ASSERT().\r
 \r
   @param  String  Pointer to a Null-terminated Unicode string.\r
@@ -213,7 +213,7 @@ StrLen (
 \r
   If String is NULL, then ASSERT().\r
   If PcdMaximumUnicodeStringLength is not zero, and String contains more than\r
 \r
   If String is NULL, then ASSERT().\r
   If PcdMaximumUnicodeStringLength is not zero, and String contains more than\r
-  PcdMaximumUnicodeStringLength Unicode characters not including the \r
+  PcdMaximumUnicodeStringLength Unicode characters not including the\r
   Null-terminator, then ASSERT().\r
 \r
   @param  String  Pointer to a Null-terminated Unicode string.\r
   Null-terminator, then ASSERT().\r
 \r
   @param  String  Pointer to a Null-terminated Unicode string.\r
@@ -239,10 +239,10 @@ StrSize (
   If FirstString is NULL, then ASSERT().\r
   If SecondString is NULL, then ASSERT().\r
   If PcdMaximumUnicodeStringLength is not zero, and FirstString contains more\r
   If FirstString is NULL, then ASSERT().\r
   If SecondString is NULL, then ASSERT().\r
   If PcdMaximumUnicodeStringLength is not zero, and FirstString contains more\r
-  than PcdMaximumUnicodeStringLength Unicode characters not including the \r
+  than PcdMaximumUnicodeStringLength Unicode characters not including the\r
   Null-terminator, then ASSERT().\r
   If PcdMaximumUnicodeStringLength is not zero, and SecondString contains more\r
   Null-terminator, then ASSERT().\r
   If PcdMaximumUnicodeStringLength is not zero, and SecondString contains more\r
-  than PcdMaximumUnicodeStringLength Unicode characters not including the \r
+  than PcdMaximumUnicodeStringLength Unicode characters not including the\r
   Null-terminator, then ASSERT().\r
 \r
   @param  FirstString   Pointer to a Null-terminated Unicode string.\r
   Null-terminator, then ASSERT().\r
 \r
   @param  FirstString   Pointer to a Null-terminated Unicode string.\r
@@ -751,7 +751,7 @@ InitializeListHead (
   If Entry is NULL, then ASSERT().\r
   If ListHead was not initialized with InitializeListHead(), then ASSERT().\r
   If PcdMaximumLinkedListLenth is not zero, and prior to insertion the number\r
   If Entry is NULL, then ASSERT().\r
   If ListHead was not initialized with InitializeListHead(), then ASSERT().\r
   If PcdMaximumLinkedListLenth is not zero, and prior to insertion the number\r
-  of nodes in ListHead, including the ListHead node, is greater than or \r
+  of nodes in ListHead, including the ListHead node, is greater than or\r
   equal to PcdMaximumLinkedListLength, then ASSERT().\r
 \r
   @param  ListHead  A pointer to the head node of a doubly linked list.\r
   equal to PcdMaximumLinkedListLength, then ASSERT().\r
 \r
   @param  ListHead  A pointer to the head node of a doubly linked list.\r
@@ -779,7 +779,7 @@ InsertHeadList (
   If Entry is NULL, then ASSERT().\r
   If ListHead was not initialized with InitializeListHead(), then ASSERT().\r
   If PcdMaximumLinkedListLenth is not zero, and prior to insertion the number\r
   If Entry is NULL, then ASSERT().\r
   If ListHead was not initialized with InitializeListHead(), then ASSERT().\r
   If PcdMaximumLinkedListLenth is not zero, and prior to insertion the number\r
-  of nodes in ListHead, including the ListHead node, is greater than or \r
+  of nodes in ListHead, including the ListHead node, is greater than or\r
   equal to PcdMaximumLinkedListLength, then ASSERT().\r
 \r
   @param  ListHead  A pointer to the head node of a doubly linked list.\r
   equal to PcdMaximumLinkedListLength, then ASSERT().\r
 \r
   @param  ListHead  A pointer to the head node of a doubly linked list.\r
@@ -805,8 +805,8 @@ InsertTailList (
 \r
   If List is NULL, then ASSERT().\r
   If List was not initialized with InitializeListHead(), then ASSERT().\r
 \r
   If List is NULL, then ASSERT().\r
   If List was not initialized with InitializeListHead(), then ASSERT().\r
-  If PcdMaximumLinkedListLenth is not zero, and the number of nodes \r
-  in List, including the List node, is greater than or equal to \r
+  If PcdMaximumLinkedListLenth is not zero, and the number of nodes\r
+  in List, including the List node, is greater than or equal to\r
   PcdMaximumLinkedListLength, then ASSERT().\r
 \r
   @param  List  A pointer to the head node of a doubly linked list.\r
   PcdMaximumLinkedListLength, then ASSERT().\r
 \r
   @param  List  A pointer to the head node of a doubly linked list.\r
@@ -857,8 +857,8 @@ GetNextNode (
 \r
   If ListHead is NULL, then ASSERT().\r
   If ListHead was not initialized with InitializeListHead(), then ASSERT().\r
 \r
   If ListHead is NULL, then ASSERT().\r
   If ListHead was not initialized with InitializeListHead(), then ASSERT().\r
-  If PcdMaximumLinkedListLenth is not zero, and the number of nodes \r
-  in List, including the List node, is greater than or equal to \r
+  If PcdMaximumLinkedListLenth is not zero, and the number of nodes\r
+  in List, including the List node, is greater than or equal to\r
   PcdMaximumLinkedListLength, then ASSERT().\r
 \r
   @param  ListHead  A pointer to the head node of a doubly linked list.\r
   PcdMaximumLinkedListLength, then ASSERT().\r
 \r
   @param  ListHead  A pointer to the head node of a doubly linked list.\r
@@ -883,8 +883,8 @@ IsListEmpty (
   If List is NULL, then ASSERT().\r
   If Node is NULL, then ASSERT().\r
   If List was not initialized with InitializeListHead(), then ASSERT().\r
   If List is NULL, then ASSERT().\r
   If Node is NULL, then ASSERT().\r
   If List was not initialized with InitializeListHead(), then ASSERT().\r
-  If PcdMaximumLinkedListLenth is not zero, and the number of nodes \r
-  in List, including the List node, is greater than or equal to \r
+  If PcdMaximumLinkedListLenth is not zero, and the number of nodes\r
+  in List, including the List node, is greater than or equal to\r
   PcdMaximumLinkedListLength, then ASSERT().\r
   If Node is not a node in List and Node is not equal to List, then ASSERT().\r
 \r
   PcdMaximumLinkedListLength, then ASSERT().\r
   If Node is not a node in List and Node is not equal to List, then ASSERT().\r
 \r
@@ -912,8 +912,8 @@ IsNull (
   If List is NULL, then ASSERT().\r
   If Node is NULL, then ASSERT().\r
   If List was not initialized with InitializeListHead(), then ASSERT().\r
   If List is NULL, then ASSERT().\r
   If Node is NULL, then ASSERT().\r
   If List was not initialized with InitializeListHead(), then ASSERT().\r
-  If PcdMaximumLinkedListLenth is not zero, and the number of nodes \r
-  in List, including the List node, is greater than or equal to \r
+  If PcdMaximumLinkedListLenth is not zero, and the number of nodes\r
+  in List, including the List node, is greater than or equal to\r
   PcdMaximumLinkedListLength, then ASSERT().\r
   If Node is not a node in List, then ASSERT().\r
 \r
   PcdMaximumLinkedListLength, then ASSERT().\r
   If Node is not a node in List, then ASSERT().\r
 \r
@@ -947,7 +947,7 @@ IsNodeAtEnd (
   If SecondEntry and FirstEntry are not in the same linked list, then ASSERT().\r
   If PcdMaximumLinkedListLength is not zero, and the number of nodes in the\r
   linked list containing the FirstEntry and SecondEntry nodes, including\r
   If SecondEntry and FirstEntry are not in the same linked list, then ASSERT().\r
   If PcdMaximumLinkedListLength is not zero, and the number of nodes in the\r
   linked list containing the FirstEntry and SecondEntry nodes, including\r
-  the FirstEntry and SecondEntry nodes, is greater than or equal to \r
+  the FirstEntry and SecondEntry nodes, is greater than or equal to\r
   PcdMaximumLinkedListLength, then ASSERT().\r
 \r
   @param  FirstEntry  A pointer to a node in a linked list.\r
   PcdMaximumLinkedListLength, then ASSERT().\r
 \r
   @param  FirstEntry  A pointer to a node in a linked list.\r
@@ -973,8 +973,8 @@ SwapListEntries (
 \r
   If Entry is NULL, then ASSERT().\r
   If Entry is the head node of an empty list, then ASSERT().\r
 \r
   If Entry is NULL, then ASSERT().\r
   If Entry is the head node of an empty list, then ASSERT().\r
-  If PcdMaximumLinkedListLength is not zero, and the number of nodes in the \r
-  linked list containing Entry, including the Entry node, is greater than \r
+  If PcdMaximumLinkedListLength is not zero, and the number of nodes in the\r
+  linked list containing Entry, including the Entry node, is greater than\r
   or equal to PcdMaximumLinkedListLength, then ASSERT().\r
 \r
   @param  Entry A pointer to a node in a linked list\r
   or equal to PcdMaximumLinkedListLength, then ASSERT().\r
 \r
   @param  Entry A pointer to a node in a linked list\r
@@ -2905,10 +2905,12 @@ typedef union {
 // Byte packed structure for an IDTR, GDTR, LDTR descriptor\r
 /// @bug  How to make this structure byte-packed in a compiler independent way?\r
 //\r
 // Byte packed structure for an IDTR, GDTR, LDTR descriptor\r
 /// @bug  How to make this structure byte-packed in a compiler independent way?\r
 //\r
+#pragma pack (1)\r
 typedef struct {\r
   UINT16  Limit;\r
   UINTN   Base;\r
 } IA32_DESCRIPTOR;\r
 typedef struct {\r
   UINT16  Limit;\r
   UINTN   Base;\r
 } IA32_DESCRIPTOR;\r
+#pragma pack ()\r
 \r
 #define IA32_IDT_GATE_TYPE_TASK          0x85\r
 #define IA32_IDT_GATE_TYPE_INTERRUPT_16  0x86\r
 \r
 #define IA32_IDT_GATE_TYPE_TASK          0x85\r
 #define IA32_IDT_GATE_TYPE_INTERRUPT_16  0x86\r
index b6076085058b63e7c28404c148d5895cc8eeccfa..310f418d0c3e7dd0cc9e9cc89abecd4038c40b51 100644 (file)
 ;    IN UINT64 Value\r
 ;    )\r
 ;------------------------------------------------------------------------------\r
 ;    IN UINT64 Value\r
 ;    )\r
 ;------------------------------------------------------------------------------\r
-InternalMemSetMem64 PROC    USES    edi\r
-    movq    mm0, [esp + 16]\r
-    mov     ecx, [esp + 12]\r
-    mov     edi, [esp + 8]\r
-    mov     eax, edi\r
+InternalMemSetMem64 PROC\r
+    mov     eax, [esp + 4]\r
+    mov     ecx, [esp + 8]\r
+    movq    mm0, [esp + 12]\r
+    mov     edx, eax\r
 @@:\r
 @@:\r
-    movntq  [edi], mm0\r
-    add     edi, 8\r
+    movntq  [edx], mm0\r
+    add     edx, 8\r
     loop    @B\r
     mfence\r
     ret\r
     loop    @B\r
     mfence\r
     ret\r
index 1ddc7ea191b9d0d8744b42a5a6f1e03393c75d9e..c5d75c6f2b7ed1a11218f52cd97f514bb73b0438 100644 (file)
 \r
 ;------------------------------------------------------------------------------\r
 ;  VOID *\r
 \r
 ;------------------------------------------------------------------------------\r
 ;  VOID *\r
-;  _mem_SetMem64 (\r
+;  InternalMemSetMem64 (\r
 ;    IN VOID   *Buffer,\r
 ;    IN UINTN  Count,\r
 ;    IN UINT64 Value\r
 ;    )\r
 ;------------------------------------------------------------------------------\r
 ;    IN VOID   *Buffer,\r
 ;    IN UINTN  Count,\r
 ;    IN UINT64 Value\r
 ;    )\r
 ;------------------------------------------------------------------------------\r
-InternalMemSetMem64 PROC    USES    edi\r
-    mov     ecx, [esp + 12]\r
-    mov     edi, [esp + 8]\r
-    test    edi, 8\r
-    DB      0f2h, 0fh, 12h, 44h, 24h, 16    ; movddup xmm0, [esp + 16]\r
+InternalMemSetMem64 PROC\r
+    mov     eax, [esp + 4]\r
+    mov     ecx, [esp + 8]\r
+    test    al, 8\r
+    mov     edx, eax\r
+    movq    xmm0, [esp + 12]\r
     jz      @F\r
     jz      @F\r
-    movq    [edi], xmm0\r
-    add     edi, 8\r
+    movq    [edx], xmm0\r
+    add     edx, 8\r
     dec     ecx\r
 @@:\r
     dec     ecx\r
 @@:\r
-    mov     edx, ecx\r
     shr     ecx, 1\r
     jz      @SetQwords\r
     shr     ecx, 1\r
     jz      @SetQwords\r
+    movlhps xmm0, xmm0\r
 @@:\r
 @@:\r
-    movntdq [edi], xmm0\r
-    add     edi, 16\r
+    movntdq [edx], xmm0\r
+    lea     edx, [edx + 16]\r
     loop    @B\r
     mfence\r
 @SetQwords:\r
     loop    @B\r
     mfence\r
 @SetQwords:\r
-    test    dl, 1\r
-    jz      @F\r
-    movq    [edi], xmm0\r
+    jnc     @F\r
+    movq    [edx], xmm0\r
 @@:\r
     ret\r
 InternalMemSetMem64 ENDP\r
 @@:\r
     ret\r
 InternalMemSetMem64 ENDP\r
index 8b33386ad0bfbd90fd33bed224653f283574c8f6..ef94c562b5d017f053cd46e5676c8de59d835651 100644 (file)
 \r
 ;------------------------------------------------------------------------------\r
 ;  VOID *\r
 \r
 ;------------------------------------------------------------------------------\r
 ;  VOID *\r
-;  _mem_SetMem64 (\r
+;  InternalMemSetMem64 (\r
 ;    IN VOID   *Buffer,\r
 ;    IN UINTN  Count,\r
 ;    IN VOID   *Buffer,\r
 ;    IN UINTN  Count,\r
-;    IN UINT Value\r
+;    IN UINT64 Value\r
 ;    )\r
 ;------------------------------------------------------------------------------\r
 ;    )\r
 ;------------------------------------------------------------------------------\r
-InternalMemSetMem64 PROC    USES    rdi\r
-    mov     rdi, rcx\r
-    mov     r9, rcx\r
-    test    cl, 8\r
+InternalMemSetMem64 PROC\r
+    mov     rax, rcx\r
+    test    dl, 8\r
+    xchg    rcx, rdx\r
     jz      @F\r
     jz      @F\r
-    mov     [rdi], r8\r
-    add     rdi, 8\r
-    dec     rdx\r
+    mov     [rdx], r8\r
+    add     rdx, 8\r
+    dec     rcx\r
 @@:\r
 @@:\r
-    mov     rcx, rdx\r
     shr     rcx, 1\r
     jz      @SetQwords\r
     movd    xmm0, r8\r
     movlhps xmm0, xmm0\r
 @@:\r
     shr     rcx, 1\r
     jz      @SetQwords\r
     movd    xmm0, r8\r
     movlhps xmm0, xmm0\r
 @@:\r
-    movntdq [rdi], xmm0\r
-    add     rdi, 16\r
+    movntdq [rdx], xmm0\r
+    lea     rdx, [rdx + 16]\r
     loop    @B\r
     mfence\r
 @SetQwords:\r
     loop    @B\r
     mfence\r
 @SetQwords:\r
-    test    dl, 1\r
-    jz      @F\r
-    mov     [rdi], r8\r
+    jnc     @F\r
+    mov     [rdx], r8\r
 @@:\r
     ret\r
 InternalMemSetMem64 ENDP\r
 @@:\r
     ret\r
 InternalMemSetMem64 ENDP\r