]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPkg/Library/BaseMemoryLibStm/Arm/CopyMem.S
Update the copyright notice format
[mirror_edk2.git] / ArmPkg / Library / BaseMemoryLibStm / Arm / CopyMem.S
CommitLineData
d39eb83c 1#------------------------------------------------------------------------------ \r
2#\r
3# CopyMem() worker for ARM\r
4#\r
5# This file started out as C code that did 64 bit moves if the buffer was\r
6# 32-bit aligned, else it does a byte copy. It also does a byte copy for\r
7# any trailing bytes. It was updated to do 32-byte copies using stm/ldm. \r
8#\r
d6ebcab7
HT
9# Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>\r
10# This program and the accompanying materials\r
d39eb83c 11# are licensed and made available under the terms and conditions of the BSD License\r
12# which accompanies this distribution. The full text of the license may be found at\r
13# http://opensource.org/licenses/bsd-license.php\r
14#\r
15# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
16# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
17#\r
18#------------------------------------------------------------------------------\r
19\r
20/**\r
21 Copy Length bytes from Source to Destination. Overlap is OK.\r
22\r
23 This implementation \r
24\r
25 @param Destination Target of copy\r
26 @param Source Place to copy from\r
27 @param Length Number of bytes to copy\r
28\r
29 @return Destination\r
30\r
31\r
32VOID *\r
33EFIAPI\r
34InternalMemCopyMem (\r
35 OUT VOID *DestinationBuffer,\r
36 IN CONST VOID *SourceBuffer,\r
37 IN UINTN Length\r
38 )\r
39**/\r
40.text\r
41.align 2\r
42.globl ASM_PFX(InternalMemCopyMem)\r
43\r
44ASM_PFX(InternalMemCopyMem):\r
45 stmfd sp!, {r4-r11, lr}\r
46 tst r0, #3\r
47 mov r11, r0\r
48 mov r10, r0\r
49 mov ip, r2\r
50 mov lr, r1\r
51 movne r0, #0\r
52 bne L4\r
53 tst r1, #3\r
54 movne r3, #0\r
55 moveq r3, #1\r
56 cmp r2, #31\r
57 movls r0, #0\r
58 andhi r0, r3, #1\r
59L4:\r
60 cmp r11, r1\r
61 bcc L26\r
62 bls L7\r
63 rsb r3, r1, r11\r
64 cmp ip, r3\r
65 bcc L26\r
66 cmp ip, #0\r
67 beq L7\r
68 add r10, r11, ip\r
69 add lr, ip, r1\r
70 b L16\r
71L29:\r
72 sub ip, ip, #8\r
73 cmp ip, #7\r
74 ldrd r2, [lr, #-8]!\r
75 movls r0, #0\r
76 cmp ip, #0\r
77 strd r2, [r10, #-8]!\r
78 beq L7\r
79L16:\r
80 cmp r0, #0\r
81 bne L29\r
82 sub r3, lr, #1\r
83 sub ip, ip, #1\r
84 ldrb r3, [r3, #0] \r
85 sub r2, r10, #1\r
86 cmp ip, #0\r
87 sub r10, r10, #1\r
88 sub lr, lr, #1\r
89 strb r3, [r2, #0]\r
90 bne L16\r
91 b L7\r
92L11:\r
93 ldrb r3, [lr], #1 \r
94 sub ip, ip, #1\r
95 strb r3, [r10], #1\r
96L26:\r
97 cmp ip, #0\r
98 beq L7\r
99L30:\r
100 cmp r0, #0\r
101 beq L11\r
102 sub ip, ip, #32\r
103 cmp ip, #31\r
104 ldmia lr!, {r2-r9}\r
105 movls r0, #0\r
106 cmp ip, #0\r
107 stmia r10!, {r2-r9}\r
108 bne L30\r
109L7:\r
110 mov r0, r11\r
111 ldmfd sp!, {r4-r11, pc}\r
112 \r