ArmPkg/CompilerIntrinsicsLib: Make __aeabi_memcpy the same as memcpy

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
This commit is contained in:
Olivier Martin 2014-01-15 12:24:31 +00:00 committed by oliviermartin
parent 92720fe9c9
commit cf9530e686
2 changed files with 21 additions and 22 deletions

View File

@ -1,4 +1,4 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR> # Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
# #
@ -14,21 +14,19 @@
.text .text
.align 2 .align 2
GCC_ASM_EXPORT(__aeabi_memcpy)
GCC_ASM_EXPORT(memcpy) GCC_ASM_EXPORT(memcpy)
ASM_PFX(__aeabi_memcpy):
ASM_PFX(memcpy): ASM_PFX(memcpy):
stmfd sp!, {r7, lr} cmp r2, #0
mov ip, #0 bxeq lr
add r7, sp, #0 push {lr}
mov lr, r0 mov lr, r0
b L4
L5: L5:
ldrb r3, [r1], #1 @ zero_extendqisi2 ldrb r3, [r1], #1 @ zero_extendqisi2
add ip, ip, #1
and r3, r3, #255
strb r3, [lr], #1 strb r3, [lr], #1
L4: subs r2, r2, #1
cmp ip, r2
bne L5 bne L5
ldmfd sp!, {r7, pc} pop {pc}

View File

@ -1,4 +1,4 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// //
// Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR> // Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
// //
@ -27,14 +27,15 @@
; ); ; );
; ;
__aeabi_memcpy __aeabi_memcpy
CMP r2, #0 cmp r2, #0
BXEQ r14 bxeq lr
loop push {lr}
LDRB r3, [r1], #1 mov lr, r0
STRB r3, [r0], #1 L5
SUBS r2, r2, #1 ldrb r3, [r1], #1
BXEQ r14 strb r3, [lr], #1
B loop subs r2, r2, #1
bne L5
END pop {pc}
END