1 ;------------------------------------------------------------------------------
3 ; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
4 ; SPDX-License-Identifier: BSD-2-Clause-Patent
16 ;------------------------------------------------------------------------------
20 ;------------------------------------------------------------------------------
23 ; InternalMemCopyMem (
24 ; IN VOID *Destination,
28 ;------------------------------------------------------------------------------
29 global ASM_PFX(InternalMemCopyMem)
30 ASM_PFX(InternalMemCopyMem):
33 mov esi, [esp + 16] ; esi <- Source
34 mov edi, [esp + 12] ; edi <- Destination
35 mov edx, [esp + 20] ; edx <- Count
36 lea eax, [esi + edx - 1] ; eax <- End of Source
39 cmp eax, edi ; Overlapped?
40 jae @CopyBackward ; Copy backward if overlapped
44 shr ecx, 3 ; ecx <- # of Qwords to copy
48 movq [esp], mm0 ; save mm0
55 movq mm0, [esp] ; restore mm0
56 pop ecx ; stack cleanup
57 pop ecx ; stack cleanup
60 mov esi, eax ; esi <- Last byte in Source
61 lea edi, [edi + edx - 1] ; edi <- Last byte in Destination