This code also removed some redundant instructions.
__aeabi_memcpy doesn't require preservation of r0 (as memcpy does),
which could save a push, but the code has been left to keep things consistent.
The reason __aeabi_memcpy has been added to the .S file is so it will be available
to toolchains that use the GCC assembler but the full ARM EABI (i.e. current LLVM)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15124
6f19259b-4bc3-4df7-8a09-
765794883524
-#------------------------------------------------------------------------------ \r
+#------------------------------------------------------------------------------\r
#\r
# Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
#\r
\r
.text\r
.align 2\r
+ GCC_ASM_EXPORT(__aeabi_memcpy)\r
GCC_ASM_EXPORT(memcpy)\r
\r
+ASM_PFX(__aeabi_memcpy):\r
ASM_PFX(memcpy):\r
- stmfd sp!, {r7, lr}\r
- mov ip, #0\r
- add r7, sp, #0\r
- mov lr, r0\r
- b L4\r
+ cmp r2, #0\r
+ bxeq lr\r
+ push {lr}\r
+ mov lr, r0\r
L5:\r
ldrb r3, [r1], #1 @ zero_extendqisi2\r
- add ip, ip, #1\r
- and r3, r3, #255\r
strb r3, [lr], #1\r
-L4:\r
- cmp ip, r2\r
+ subs r2, r2, #1\r
bne L5\r
- ldmfd sp!, {r7, pc}\r
+ pop {pc}\r
\r
-//------------------------------------------------------------------------------ \r
+//------------------------------------------------------------------------------\r
//\r
// Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
//\r
; );\r
;\r
__aeabi_memcpy\r
- CMP r2, #0\r
- BXEQ r14\r
-loop\r
- LDRB r3, [r1], #1\r
- STRB r3, [r0], #1\r
- SUBS r2, r2, #1\r
- BXEQ r14\r
- B loop\r
- \r
- END\r
+ cmp r2, #0\r
+ bxeq lr\r
+ push {lr}\r
+ mov lr, r0\r
+L5\r
+ ldrb r3, [r1], #1\r
+ strb r3, [lr], #1\r
+ subs r2, r2, #1\r
+ bne L5\r
+ pop {pc}\r
\r
+ END
\ No newline at end of file