]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPkg/Library/BaseMemoryLibStm/Arm/CopyMem.S
Remove tabs from all text files in the package.
[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
1bfda055 42GCC_ASM_EXPORT(InternalMemCopyMem)\r
d39eb83c 43\r
44ASM_PFX(InternalMemCopyMem):\r
58b5d037 45\s\sstmfd\s\ssp!, {r4-r11, lr}\r
46\s\stst\s\sr0, #3\r
47\s\smov\s\sr11, r0\r
48\s\smov\s\sr10, r0\r
49\s\smov\s\sip, r2\r
50\s\smov\s\slr, r1\r
51\s\smovne\s\sr0, #0\r
52\s\sbne\s\sL4\r
53\s\stst\s\sr1, #3\r
54\s\smovne\s\sr3, #0\r
55\s\smoveq\s\sr3, #1\r
56\s\scmp\s\sr2, #31\r
57\s\smovls\s\sr0, #0\r
58\s\sandhi\s\sr0, r3, #1\r
d39eb83c 59L4:\r
58b5d037 60\s\scmp\s\sr11, r1\r
61\s\sbcc\s\sL26\r
62\s\sbls\s\sL7\r
63\s\srsb\s\sr3, r1, r11\r
64\s\scmp\s\sip, r3\r
65\s\sbcc\s\sL26\r
66\s\scmp\s\sip, #0\r
67\s\sbeq\s\sL7\r
68\s\sadd\s\sr10, r11, ip\r
69\s\sadd\s\slr, ip, r1\r
70\s\sb\s\sL16\r
d39eb83c 71L29:\r
58b5d037 72\s\ssub\s\sip, ip, #8\r
73\s\scmp\s\sip, #7\r
74\s\sldrd\s\sr2, [lr, #-8]!\r
75\s\smovls\s\sr0, #0\r
76\s\scmp\s\sip, #0\r
77\s\sstrd\s\sr2, [r10, #-8]!\r
78\s\sbeq\s\sL7\r
d39eb83c 79L16:\r
58b5d037 80\s\scmp\s\sr0, #0\r
81\s\sbne\s\sL29\r
82\s\ssub\s\sr3, lr, #1\r
83\s\ssub\s\sip, ip, #1\r
84\s\sldrb\s\sr3, [r3, #0]\s\s\r
85\s\ssub\s\sr2, r10, #1\r
86\s\scmp\s\sip, #0\r
87\s\ssub\s\sr10, r10, #1\r
88\s\ssub\s\slr, lr, #1\r
89\s\sstrb\s\sr3, [r2, #0]\r
90\s\sbne\s\sL16\r
91\s\sb L7\r
d39eb83c 92L11:\r
58b5d037 93\s\sldrb\s\sr3, [lr], #1\s\s\r
94\s\ssub\s\sip, ip, #1\r
95\s\sstrb\s\sr3, [r10], #1\r
d39eb83c 96L26:\r
58b5d037 97\s\scmp\s\sip, #0\r
98\s\sbeq\s\sL7\r
d39eb83c 99L30:\r
58b5d037 100\s\scmp\s\sr0, #0\r
101\s\sbeq\s\sL11\r
102\s\ssub\s\sip, ip, #32\r
103\s\scmp\s\sip, #31\r
104\s\sldmia\s\slr!, {r2-r9}\r
105\s\smovls\s\sr0, #0\r
106\s\scmp\s\sip, #0\r
107\s\sstmia\s\sr10!, {r2-r9}\r
108\s\sbne\s\sL30\r
d39eb83c 109L7:\r
58b5d037 110 mov\s\sr0, r11\r
111\s\sldmfd\s\ssp!, {r4-r11, pc}\r
d39eb83c 112 \r