]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Library/BaseMemoryLibStm/Arm/CopyMem.asm
Remove tabs from all text files in the package.
[mirror_edk2.git] / ArmPkg / Library / BaseMemoryLibStm / Arm / CopyMem.asm
1 ;------------------------------------------------------------------------------
2 ;
3 ; CopyMem() worker for ARM
4 ;
5 ; This file started out as C code that did 64 bit moves if the buffer was
6 ; 32-bit aligned, else it does a byte copy. It also does a byte copy for
7 ; any trailing bytes. It was updated to do 32-byte copies using stm/ldm.
8 ;
9 ; Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
10 ; This program and the accompanying materials
11 ; are licensed and made available under the terms and conditions of the BSD License
12 ; which accompanies this distribution. The full text of the license may be found at
13 ; http://opensource.org/licenses/bsd-license.php
14 ;
15 ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
16 ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 ;
18 ;------------------------------------------------------------------------------
19
20 /**
21 Copy Length bytes from Source to Destination. Overlap is OK.
22
23 This implementation
24
25 @param Destination Target of copy
26 @param Source Place to copy from
27 @param Length Number of bytes to copy
28
29 @return Destination
30
31
32 VOID *
33 EFIAPI
34 InternalMemCopyMem (
35 OUT VOID *DestinationBuffer,
36 IN CONST VOID *SourceBuffer,
37 IN UINTN Length
38 )
39 **/
40 \s\sEXPORT InternalMemCopyMem
41
42 \s\sAREA AsmMemStuff, CODE, READONLY
43
44 InternalMemCopyMem
45 \s\sstmfd\s\ssp!, {r4-r11, lr}
46 \s\stst\s\sr0, #3
47 \s\smov\s\sr11, r0
48 \s\smov\s\sr10, r0
49 \s\smov\s\sip, r2
50 \s\smov\s\slr, r1
51 \s\smovne\s\sr0, #0
52 \s\sbne\s\sL4
53 \s\stst\s\sr1, #3
54 \s\smovne\s\sr3, #0
55 \s\smoveq\s\sr3, #1
56 \s\scmp\s\sr2, #31
57 \s\smovls\s\sr0, #0
58 \s\sandhi\s\sr0, r3, #1
59 L4
60 \s\scmp\s\sr11, r1
61 \s\sbcc\s\sL26
62 \s\sbls\s\sL7
63 \s\srsb\s\sr3, r1, r11
64 \s\scmp\s\sip, r3
65 \s\sbcc\s\sL26
66 \s\scmp\s\sip, #0
67 \s\sbeq\s\sL7
68 \s\sadd\s\sr10, r11, ip
69 \s\sadd\s\slr, ip, r1
70 \s\sb\s\sL16
71 L29
72 \s\ssub\s\sip, ip, #8
73 \s\scmp\s\sip, #7
74 \s\sldrd\s\sr2, [lr, #-8]!
75 \s\smovls\s\sr0, #0
76 \s\scmp\s\sip, #0
77 \s\sstrd\s\sr2, [r10, #-8]!
78 \s\sbeq\s\sL7
79 L16
80 \s\scmp\s\sr0, #0
81 \s\sbne\s\sL29
82 \s\ssub\s\sr3, lr, #1
83 \s\ssub\s\sip, ip, #1
84 \s\sldrb\s\sr3, [r3, #0]\s\s
85 \s\ssub\s\sr2, r10, #1
86 \s\scmp\s\sip, #0
87 \s\ssub\s\sr10, r10, #1
88 \s\ssub\s\slr, lr, #1
89 \s\sstrb\s\sr3, [r2, #0]
90 \s\sbne\s\sL16
91 \s\sb L7
92 L11
93 \s\sldrb\s\sr3, [lr], #1\s\s
94 \s\ssub\s\sip, ip, #1
95 \s\sstrb\s\sr3, [r10], #1
96 L26
97 \s\scmp\s\sip, #0
98 \s\sbeq\s\sL7
99 L30
100 \s\scmp\s\sr0, #0
101 \s\sbeq\s\sL11
102 \s\ssub\s\sip, ip, #32
103 \s\scmp\s\sip, #31
104 \s\sldmia\s\slr!, {r2-r9}
105 \s\smovls\s\sr0, #0
106 \s\scmp\s\sip, #0
107 \s\sstmia\s\sr10!, {r2-r9}
108 \s\sbne\s\sL30
109 L7
110 mov\s\sr0, r11
111 \s\sldmfd\s\ssp!, {r4-r11, pc}
112 \s\s
113 END
114