\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
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