2 # ConvertAsm.py: Automatically generated from CopyMem.asm
4 #------------------------------------------------------------------------------
6 # Copyright (c) 2006 - 2008, Intel Corporation
7 # All rights reserved. This program and the accompanying materials
8 # are licensed and made available under the terms and conditions of the BSD License
9 # which accompanies this distribution. The full text of the license may be found at
10 # http://opensource.org/licenses/bsd-license.php
12 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
25 #------------------------------------------------------------------------------
28 #------------------------------------------------------------------------------
31 # InternalMemCopyMem (
32 # IN VOID *Destination,
36 #------------------------------------------------------------------------------
37 .intel_syntax noprefix
38 ASM_GLOBAL ASM_PFX(InternalMemCopyMem)
39 ASM_PFX(InternalMemCopyMem):
42 mov rsi, rdx # rsi <- Source
43 mov rdi, rcx # rdi <- Destination
44 lea r9, [rsi + r8 - 1] # r9 <- End of Source
46 mov rax, rdi # rax <- Destination as return value
49 jae L_CopyBackward # Copy backward if overlapped
54 rep movsq # Copy as many Qwords as possible
57 mov rsi, r9 # rsi <- End of Source
58 lea rdi, [rdi + r8 - 1] # esi <- End of Destination
59 std # set direction flag
62 rep movsb # Copy bytes backward