1 ;------------------------------------------------------------------------------
3 ; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
4 ; SPDX-License-Identifier: BSD-2-Clause-Patent
16 ;------------------------------------------------------------------------------
21 ;------------------------------------------------------------------------------
24 ; InternalMemCopyMem (
25 ; IN VOID *Destination,
29 ;------------------------------------------------------------------------------
30 global ASM_PFX(InternalMemCopyMem)
31 ASM_PFX(InternalMemCopyMem):
34 mov rsi, rdx ; rsi <- Source
35 mov rdi, rcx ; rdi <- Destination
36 lea r9, [rsi + r8 - 1] ; r9 <- End of Source
38 mov rax, rdi ; rax <- Destination as return value
41 jae @CopyBackward ; Copy backward if overlapped
46 rep movsq ; Copy as many Qwords as possible
49 mov rsi, r9 ; rsi <- End of Source
50 lea rdi, [rdi + r8 - 1] ; esi <- End of Destination
51 std ; set direction flag
54 rep movsb ; Copy bytes backward