2008-11-03 10:25:10 +01:00
|
|
|
#
|
|
|
|
# ConvertAsm.py: Automatically generated from CopyMem.asm
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
#
|
2010-04-23 18:20:52 +02:00
|
|
|
# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
|
|
|
|
# This program and the accompanying materials
|
2008-11-03 10:25:10 +01:00
|
|
|
# are licensed and made available under the terms and conditions of the BSD License
|
|
|
|
# which accompanies this distribution. The full text of the license may be found at
|
|
|
|
# http://opensource.org/licenses/bsd-license.php
|
|
|
|
#
|
|
|
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
#
|
|
|
|
# Module Name:
|
|
|
|
#
|
|
|
|
# CopyMem.S
|
|
|
|
#
|
|
|
|
# Abstract:
|
|
|
|
#
|
|
|
|
# CopyMem function
|
|
|
|
#
|
|
|
|
# Notes:
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# VOID *
|
|
|
|
# EFIAPI
|
|
|
|
# InternalMemCopyMem (
|
|
|
|
# IN VOID *Destination,
|
|
|
|
# IN VOID *Source,
|
|
|
|
# IN UINTN Count
|
|
|
|
# )
|
|
|
|
#------------------------------------------------------------------------------
|
2009-05-20 12:22:09 +02:00
|
|
|
ASM_GLOBAL ASM_PFX(InternalMemCopyMem)
|
2008-11-03 10:25:10 +01:00
|
|
|
ASM_PFX(InternalMemCopyMem):
|
2009-08-11 17:32:16 +02:00
|
|
|
pushq %rsi
|
|
|
|
pushq %rdi
|
|
|
|
movq %rdx, %rsi # rsi <- Source
|
|
|
|
movq %rcx, %rdi # rdi <- Destination
|
|
|
|
leaq -1(%rsi, %r8,), %r9 # r9 <- End of Source
|
|
|
|
cmpq %rdi, %rsi
|
|
|
|
movq %rdi, %rax # rax <- Destination as return value
|
2008-11-03 10:25:10 +01:00
|
|
|
jae L0
|
2009-08-11 17:32:16 +02:00
|
|
|
cmpq %rdi, %r9
|
2008-11-03 10:25:10 +01:00
|
|
|
jae L_CopyBackward # Copy backward if overlapped
|
|
|
|
L0:
|
2009-08-11 17:32:16 +02:00
|
|
|
movq %r8, %rcx
|
|
|
|
andq $7, %r8
|
|
|
|
shrq $3, %rcx
|
2008-11-03 10:25:10 +01:00
|
|
|
rep movsq # Copy as many Qwords as possible
|
|
|
|
jmp L_CopyBytes
|
|
|
|
L_CopyBackward:
|
2009-08-11 17:32:16 +02:00
|
|
|
movq %r9, %rsi # rsi <- End of Source
|
|
|
|
leaq -1(%rdi, %r8), %rdi # esi <- End of Destination
|
2008-11-03 10:25:10 +01:00
|
|
|
std # set direction flag
|
|
|
|
L_CopyBytes:
|
2009-08-11 17:32:16 +02:00
|
|
|
movq %r8, %rcx
|
2008-11-03 10:25:10 +01:00
|
|
|
rep movsb # Copy bytes backward
|
|
|
|
cld
|
2009-08-11 17:32:16 +02:00
|
|
|
popq %rdi
|
|
|
|
popq %rsi
|
2008-11-03 10:25:10 +01:00
|
|
|
ret
|
|
|
|
|