]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPkg/Library/CompilerIntrinsicsLib/Arm/memmove.S
ArmPkg/CompilerIntrinsicesLib: Fixed memmove() and memset()
[mirror_edk2.git] / ArmPkg / Library / CompilerIntrinsicsLib / Arm / memmove.S
CommitLineData
284fb5c8
OM
1#------------------------------------------------------------------------------\r
2#\r
3# Copyright (c) 2011-2014, ARM Limited. All rights reserved.\r
4#\r
5# This program and the accompanying materials\r
6# are licensed and made available under the terms and conditions of the BSD License\r
7# which accompanies this distribution. The full text of the license may be found at\r
8# http://opensource.org/licenses/bsd-license.php\r
9#\r
10# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12#\r
13#------------------------------------------------------------------------------\r
14\r
15 .text\r
16 .align 2\r
17 GCC_ASM_EXPORT (memmove)\r
18\r
19# VOID\r
20# EFIAPI\r
21# memmove (\r
22# IN VOID *Destination,\r
23# IN CONST VOID *Source,\r
24# IN UINT32 Size\r
25# );\r
26ASM_PFX(memmove):\r
27 CMP r2, #0\r
28 BXEQ lr\r
29 CMP r0, r1\r
30 BXEQ lr\r
31 BHI memmove_backward\r
32\r
33memmove_forward:\r
34 LDRB r3, [r1], #1\r
35 STRB r3, [r0], #1\r
36 SUBS r2, r2, #1\r
37 BXEQ lr\r
38 B memmove_forward\r
39\r
40memmove_backward:\r
41 add r0, r2\r
42 add r1, r2\r
43memmove_backward_loop:\r
44 LDRB r3, [r1, #-1]!\r
45 STRB r3, [r0, #-1]!\r
46 SUBS r2, r2, #1\r
47 BXEQ lr\r
48 B memmove_backward_loop\r