-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#------------------------------------------------------------------------------
-
-
- .text
- .align 2
- .globl ASM_PFX(memset)
- INTERWORK_FUNC(memset)\r
+#------------------------------------------------------------------------------\r
+#\r
+# Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
+# Copyright (c) 2014, ARM Ltd. All rights reserved.<BR>\r
+#\r
+# This program and the accompanying materials\r
+# are licensed and made available under the terms and conditions of the BSD License\r
+# which accompanies this distribution. The full text of the license may be found at\r
+# http://opensource.org/licenses/bsd-license.php\r
+#\r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+#------------------------------------------------------------------------------\r
\r
+\r
+ .text\r
+ .syntax unified\r
+ .align 2\r
+ GCC_ASM_EXPORT (memset)\r
+ GCC_ASM_EXPORT (__aeabi_memset)\r
+\r
+# VOID\r
+# EFIAPI\r
+# __aeabi_memset (\r
+# IN VOID *Destination,\r
+# IN UINT32 Size\r
+# IN UINT32 Character,\r
+# );\r
+ASM_PFX(__aeabi_memset):\r
+ subs ip, r1, #0\r
+ bxeq lr\r
+ mov r1, r2\r
+ b L10\r
+\r
+# VOID\r
+# EFIAPI\r
+# memset (\r
+# IN VOID *Destination,\r
+# IN UINT32 Character,\r
+# IN UINT32 Size\r
+# );\r
+ //\r
+ // This object may be pulled in to satisfy an undefined reference to\r
+ // __aeabi_memset above, but in some cases, memset() is already provided\r
+ // by another library (i.e., CryptoPkg/IntrinsicLib), in which case we\r
+ // prefer the other version. So allow this one to be overridden by\r
+ // giving it weak linkage.\r
+ //\r
+ .weak memset\r
ASM_PFX(memset):\r
- @ args = 0, pretend = 0, frame = 0
- @ frame_needed = 1, uses_anonymous_args = 0
- stmfd sp!, {r7, lr}
- mov ip, #0
- add r7, sp, #0
- mov lr, r0
- b L9
-L10:
- and r3, r1, #255
- add ip, ip, #1
- strb r3, [lr], #1
-L9:
- cmp ip, r2
- bne L10
- ldmfd sp!, {r7, pc}
-
+ subs ip, r2, #0\r
+ bxeq lr\r
+ @ args = 0, pretend = 0, frame = 0\r
+ @ frame_needed = 1, uses_anonymous_args = 0\r
+L10:\r
+ strb r1, [r0], #1\r
+ subs ip, ip, #1\r
+ @ While size is not 0\r
+ bne L10\r
+ bx lr\r