]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/BaseMemoryLibMmx/Ia32/CopyMem.asm
ArmPkg/ArmDisassemblerLib: fix check for MSR instruction
[mirror_edk2.git] / MdePkg / Library / BaseMemoryLibMmx / Ia32 / CopyMem.asm
index b709a809d5ff7b812beff7318ca16043a89752fc..38e1da7d8173b48edb59c2e76d39baec531a2726 100644 (file)
@@ -1,10 +1,10 @@
 ;------------------------------------------------------------------------------\r
 ;\r
-; Copyright (c) 2006, Intel Corporation\r
-; All rights reserved. This program and the accompanying materials\r
+; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>\r
+; This program and the accompanying materials\r
 ; are licensed and made available under the terms and conditions of the BSD License\r
 ; which accompanies this distribution.  The full text of the license may be found at\r
-; http://opensource.org/licenses/bsd-license.php\r
+; http://opensource.org/licenses/bsd-license.php.\r
 ;\r
 ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
     .686\r
     .model  flat,C\r
-    .xmm\r
+    .mmx\r
     .code\r
 \r
 ;------------------------------------------------------------------------------\r
 ;  VOID *\r
-;  _mem_CopyMem (\r
+;  EFIAPI\r
+;  InternalMemCopyMem (\r
 ;    IN VOID   *Destination,\r
 ;    IN VOID   *Source,\r
 ;    IN UINTN  Count\r
-;    )\r
+;    );\r
 ;------------------------------------------------------------------------------\r
 InternalMemCopyMem  PROC    USES    esi edi\r
     mov     esi, [esp + 16]             ; esi <- Source\r
     mov     edi, [esp + 12]             ; edi <- Destination\r
     mov     edx, [esp + 20]             ; edx <- Count\r
-    lea     eax, [edi + edx - 1]        ; eax <- End of Destination\r
+    lea     eax, [esi + edx - 1]        ; eax <- End of Source\r
     cmp     esi, edi\r
     jae     @F\r
-    cmp     eax, esi                    ; Overlapped?\r
+    cmp     eax, edi                    ; Overlapped?\r
     jae     @CopyBackward               ; Copy backward if overlapped\r
-@@:\r
-    xor     ecx, ecx\r
-    sub     ecx, esi\r
-    and     ecx, 7                      ; ecx + esi aligns on 8-byte boundary\r
-    jz      @F\r
-    cmp     ecx, edx\r
-    cmova   ecx, edx\r
-    sub     edx, ecx                    ; edx <- remaining bytes to copy\r
-    rep     movsb\r
 @@:\r
     mov     ecx, edx\r
     and     edx, 7\r
@@ -62,18 +54,17 @@ InternalMemCopyMem  PROC    USES    esi edi
     movq    [esp], mm0                  ; save mm0\r
 @@:\r
     movq    mm0, [esi]\r
-    movntq  [edi], mm0\r
+    movq    [edi], mm0\r
     add     esi, 8\r
     add     edi, 8\r
     loop    @B\r
-    mfence\r
     movq    mm0, [esp]                  ; restore mm0\r
     pop     ecx                         ; stack cleanup\r
     pop     ecx                         ; stack cleanup\r
     jmp     @CopyBytes\r
 @CopyBackward:\r
-    mov     edi, eax                    ; edi <- Last byte in Destination\r
-    lea     esi, [esi + edx - 1]        ; esi <- Last byte in Source\r
+    mov     esi, eax                    ; esi <- Last byte in Source\r
+    lea     edi, [edi + edx - 1]        ; edi <- Last byte in Destination\r
     std\r
 @CopyBytes:\r
     mov     ecx, edx\r