]>
Commit | Line | Data |
---|---|---|
3402aac7 | 1 | ;------------------------------------------------------------------------------\r |
d39eb83c | 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. Update using VSTM/SLDM to do 128 byte copies.\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 | |
3402aac7 | 23 | This implementation\r |
d39eb83c | 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 | |
32 | VOID *\r | |
33 | EFIAPI\r | |
34 | InternalMemCopyMem (\r | |
35 | OUT VOID *DestinationBuffer,\r | |
36 | IN CONST VOID *SourceBuffer,\r | |
37 | IN UINTN Length\r | |
38 | )\r | |
39 | **/\r | |
1e57a462 | 40 | \r |
efda1775 | 41 | INCLUDE AsmMacroExport.inc\r |
d39eb83c | 42 | \r |
efda1775 | 43 | RVCT_ASM_EXPORT InternalMemCopyMem\r |
1e57a462 | 44 | stmfd sp!, {r4, r9, lr}\r |
45 | tst r0, #3\r | |
46 | mov r4, r0\r | |
47 | mov r9, r0\r | |
48 | mov ip, r2\r | |
49 | mov lr, r1\r | |
50 | movne r0, #0\r | |
51 | bne L4\r | |
52 | tst r1, #3\r | |
53 | movne r3, #0\r | |
54 | moveq r3, #1\r | |
55 | cmp r2, #127\r | |
56 | movls r0, #0\r | |
57 | andhi r0, r3, #1\r | |
58 | L4\r | |
59 | cmp r4, r1\r | |
60 | bcc L26\r | |
61 | bls L7\r | |
62 | rsb r3, r1, r4\r | |
63 | cmp ip, r3\r | |
64 | bcc L26\r | |
65 | cmp ip, #0\r | |
66 | beq L7\r | |
67 | add r9, r4, ip\r | |
68 | add lr, ip, r1\r | |
69 | b L16\r | |
70 | L29\r | |
71 | sub ip, ip, #8\r | |
72 | cmp ip, #7\r | |
73 | ldrd r2, [lr, #-8]!\r | |
74 | movls r0, #0\r | |
75 | cmp ip, #0\r | |
76 | strd r2, [r9, #-8]!\r | |
77 | beq L7\r | |
78 | L16\r | |
79 | cmp r0, #0\r | |
80 | bne L29\r | |
81 | sub r3, lr, #1\r | |
82 | sub ip, ip, #1\r | |
3402aac7 | 83 | ldrb r3, [r3, #0]\r |
1e57a462 | 84 | sub r2, r9, #1\r |
85 | cmp ip, #0\r | |
86 | sub r9, r9, #1\r | |
87 | sub lr, lr, #1\r | |
88 | strb r3, [r2, #0]\r | |
89 | bne L16\r | |
90 | b L7\r | |
91 | L11\r | |
3402aac7 | 92 | ldrb r3, [lr], #1\r |
1e57a462 | 93 | sub ip, ip, #1\r |
94 | strb r3, [r9], #1\r | |
95 | L26\r | |
96 | cmp ip, #0\r | |
97 | beq L7\r | |
98 | L30\r | |
99 | cmp r0, #0\r | |
100 | beq L11\r | |
101 | sub ip, ip, #128 // 32\r | |
102 | cmp ip, #127 // 31\r | |
103 | vldm lr!, {d0-d15}\r | |
104 | movls r0, #0\r | |
105 | cmp ip, #0\r | |
106 | vstm r9!, {d0-d15}\r | |
107 | bne L30\r | |
108 | L7\r | |
109 | dsb\r | |
110 | mov r0, r4\r | |
111 | ldmfd sp!, {r4, r9, pc}\r | |
d39eb83c | 112 | \r |
113 | END\r | |
3402aac7 | 114 | \r |