]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg/CompilerIntrinsicsLib: Make __aeabi_memcpy the same as memcpy
authorOlivier Martin <olivier.martin@arm.com>
Wed, 15 Jan 2014 12:24:31 +0000 (12:24 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 15 Jan 2014 12:24:31 +0000 (12:24 +0000)
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

ArmPkg/Library/CompilerIntrinsicsLib/Arm/memcpy.S
ArmPkg/Library/CompilerIntrinsicsLib/Arm/memcpy.asm

index 07e0cd6bb4f0e105c4811c4322e127e718aa4db9..b68ed8a6ea6b701652944bfce063ccb2ce672b11 100644 (file)
@@ -1,4 +1,4 @@
-#------------------------------------------------------------------------------ \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
index e01b80d4bcaffc151220bc1a7556f8de8ddb951d..f81db28fba6b7bd1e75d3937ea7324319927eb6d 100644 (file)
@@ -1,4 +1,4 @@
-//------------------------------------------------------------------------------ \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