]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPkg/Library/CompilerIntrinsicsLib/Arm/memset.asm
ArmPkg/CompilerIntrinsicesLib: Fixed memmove() and memset()
[mirror_edk2.git] / ArmPkg / Library / CompilerIntrinsicsLib / Arm / memset.asm
index 74e02430483cf0c090cd8e09350f19fa58b5c904..bae3c1fada11a4176dbeaaaf86edbf19690bb1dd 100755 (executable)
@@ -1,6 +1,7 @@
 //------------------------------------------------------------------------------\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
 \r
     AREA    Memset, CODE, READONLY\r
 \r
+; void __aeabi_memclr4(void *dest, size_t n);\r
+; void __aeabi_memclr(void *dest, size_t n);\r
+__aeabi_memclr\r
+__aeabi_memclr4\r
+  mov   r2, #0\r
+\r
 ;\r
 ;VOID\r
 ;EFIAPI\r
 ;__aeabi_memset (\r
 ; IN  VOID    *Destination,\r
-; IN  UINT32  Character,\r
-; IN  UINT32  Size\r
+; IN  UINT32  Size,\r
+; IN  UINT32  Character\r
 ; );\r
 ;\r
 __aeabi_memset\r
-\r
+  cmp  r1, #0\r
+  bxeq lr\r
   ; args = 0, pretend = 0, frame = 0\r
   ; frame_needed = 1, uses_anonymous_args = 0\r
-  stmfd  sp!, {r7, lr}\r
-  mov  ip, #0\r
-  add  r7, sp, #0\r
-  mov  lr, r0\r
-  b  L9\r
 L10\r
-  and  r3, r1, #255\r
-  add  ip, ip, #1\r
-  strb  r3, [lr], #1\r
-L9\r
-  cmp  ip, r2\r
+  strb  r2, [r0], #1\r
+  subs  r1, r1, #1\r
+  ; While size is not 0\r
   bne  L10\r
-  ldmfd  sp!, {r7, pc}\r
-\r
-__aeabi_memclr\r
-  mov   r2, r1\r
-  mov   r1, #0\r
-  b     __aeabi_memset\r
-\r
-__aeabi_memclr4\r
-  mov   r2, r1\r
-  mov   r1, #0\r
-  b     __aeabi_memset\r
+  bx   lr\r
 \r
   END\r