From cf9530e6864f87e58c1c65b5a1198586700f7182 Mon Sep 17 00:00:00 2001 From: Olivier Martin Date: Wed, 15 Jan 2014 12:24:31 +0000 Subject: 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 git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15124 6f19259b-4bc3-4df7-8a09-765794883524 --- ArmPkg/Library/CompilerIntrinsicsLib/Arm/memcpy.S | 20 +++++++++---------- .../Library/CompilerIntrinsicsLib/Arm/memcpy.asm | 23 +++++++++++----------- 2 files changed, 21 insertions(+), 22 deletions(-) (limited to 'ArmPkg/Library/CompilerIntrinsicsLib') diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/memcpy.S b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/memcpy.S index 07e0cd6bb4..b68ed8a6ea 100644 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/memcpy.S +++ b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/memcpy.S @@ -1,4 +1,4 @@ -#------------------------------------------------------------------------------ +#------------------------------------------------------------------------------ # # Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
# @@ -14,21 +14,19 @@ .text .align 2 + GCC_ASM_EXPORT(__aeabi_memcpy) GCC_ASM_EXPORT(memcpy) +ASM_PFX(__aeabi_memcpy): ASM_PFX(memcpy): - stmfd sp!, {r7, lr} - mov ip, #0 - add r7, sp, #0 - mov lr, r0 - b L4 + cmp r2, #0 + bxeq lr + push {lr} + mov lr, r0 L5: ldrb r3, [r1], #1 @ zero_extendqisi2 - add ip, ip, #1 - and r3, r3, #255 strb r3, [lr], #1 -L4: - cmp ip, r2 + subs r2, r2, #1 bne L5 - ldmfd sp!, {r7, pc} + pop {pc} diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/memcpy.asm b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/memcpy.asm index e01b80d4bc..f81db28fba 100644 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/memcpy.asm +++ b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/memcpy.asm @@ -1,4 +1,4 @@ -//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ // // Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
// @@ -27,14 +27,15 @@ ; ); ; __aeabi_memcpy - CMP r2, #0 - BXEQ r14 -loop - LDRB r3, [r1], #1 - STRB r3, [r0], #1 - SUBS r2, r2, #1 - BXEQ r14 - B loop - - END + cmp r2, #0 + bxeq lr + push {lr} + mov lr, r0 +L5 + ldrb r3, [r1], #1 + strb r3, [lr], #1 + subs r2, r2, #1 + bne L5 + pop {pc} + END \ No newline at end of file -- cgit v1.2.3