]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.S
add corresponding .S files for BaseMemoryLibXXX X64 arch. Note that we use ".intel_sy...
[mirror_edk2.git] / MdePkg / Library / BaseMemoryLibMmx / X64 / CopyMem.S
CommitLineData
4df876ad 1#
2# ConvertAsm.py: Automatically generated from CopyMem.asm
3#
c5ecf6c1 4#------------------------------------------------------------------------------
5#
6# Copyright (c) 2006, 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
11#
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.
14#
15# Module Name:
16#
4df876ad 17# CopyMem.S
c5ecf6c1 18#
19# Abstract:
20#
21# CopyMem function
22#
23# Notes:
24#
25#------------------------------------------------------------------------------
26
27
28#------------------------------------------------------------------------------
4df876ad 29# VOID *
30# EFIAPI
31# InternalMemCopyMem (
32# IN VOID *Destination,
33# IN VOID *Source,
34# IN UINTN Count
35# )
c5ecf6c1 36#------------------------------------------------------------------------------
4df876ad 37.intel_syntax noprefix
38.globl ASM_PFX(InternalMemCopyMem)
39ASM_PFX(InternalMemCopyMem):
40 push rsi
41 push rdi
42 mov rsi, rdx # rsi <- Source
43 mov rdi, rcx # rdi <- Destination
44 lea r9, [rsi + r8 - 1] # r9 <- End of Source
45 cmp rsi, rdi
46 mov rax, rdi # rax <- Destination as return value
47 jae _InternalMemCopyMem_al_0000
48 cmp r9, rdi
49 jae _atSym_CopyBackward # Copy backward if overlapped
50_InternalMemCopyMem_al_0000:
51 mov rcx, r8
52 and r8, 7
53 shr rcx, 3
54 rep movsq # Copy as many Qwords as possible
55 jmp _atSym_CopyBytes
56_atSym_CopyBackward:
57 mov rsi, r9 # rsi <- End of Source
58 lea rdi, [rdi + r8 - 1] # esi <- End of Destination
c5ecf6c1 59 std # set direction flag
4df876ad 60_atSym_CopyBytes:
61 mov rcx, r8
62 rep movsb # Copy bytes backward
c5ecf6c1 63 cld
4df876ad 64 pop rdi
65 pop rsi
c5ecf6c1 66 ret
4df876ad 67