]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPkg/Library/BaseMemoryLibStm/Arm/SetMem.S
Add some ldm/vldm optimized CopyMem routines. Add performance macros to BDS
[mirror_edk2.git] / ArmPkg / Library / BaseMemoryLibStm / Arm / SetMem.S
diff --git a/ArmPkg/Library/BaseMemoryLibStm/Arm/SetMem.S b/ArmPkg/Library/BaseMemoryLibStm/Arm/SetMem.S
new file mode 100755 (executable)
index 0000000..0c3697f
--- /dev/null
@@ -0,0 +1,82 @@
+#------------------------------------------------------------------------------ \r
+#\r
+# SemMem() worker for ARM\r
+#\r
+# This file started out as C code that did 64 bit moves if the buffer was\r
+# 32-bit aligned, else it does a byte copy. It also does a byte copy for\r
+# any trailing bytes. It was updated to do 32-byte at a time. \r
+#\r
+# Copyright (c) 2008-2010 Apple Inc. All rights reserved.<BR>\r
+# All rights reserved. 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
+  Set Buffer to Value for Size bytes.\r
+\r
+  @param  Buffer   Memory to set.\r
+  @param  Length   Number of bytes to set\r
+  @param  Value    Value of the set operation.\r
+\r
+  @return Buffer\r
+\r
+VOID *\r
+EFIAPI\r
+InternalMemSetMem (\r
+  OUT     VOID                      *Buffer,\r
+  IN      UINTN                     Length,\r
+  IN      UINT8                     Value\r
+  )\r
+**/\r
+       \r
+.text\r
+.align 2\r
+.globl ASM_PFX(InternalMemSetMem)\r
+\r
+ASM_PFX(InternalMemSetMem):\r
+       stmfd   sp!, {r4-r11, lr}\r
+       tst       r0, #3\r
+       movne   r3, #0\r
+       moveq   r3, #1\r
+       cmp       r1, #31\r
+       movls lr, #0\r
+       andhi   lr, r3, #1\r
+       cmp       lr, #0\r
+       mov       r12, r0\r
+       bne       L31\r
+L32:\r
+       mov       r3, #0\r
+       b           L43\r
+L31:\r
+  and   r4, r2, #0xff\r
+  orr   r4, r4, r4, LSL #8\r
+  orr   r4, r4, r4, LSL #16  \r
+       mov   r5, r4\r
+       mov   r5, r4\r
+       mov   r6, r4\r
+       mov   r7, r4 \r
+       mov   r8, r4 \r
+       mov   r9, r4 \r
+       mov   r10, r4 \r
+       mov   r11, r4 \r
+       b           L32\r
+L34:\r
+       cmp         lr, #0\r
+       streqb  r2, [r12], #1\r
+       subeq     r1, r1, #1\r
+       beq         L43\r
+       sub         r1, r1, #32\r
+       cmp         r1, #31\r
+       movls     lr, r3\r
+       stmia     r12!, {r4-r11}\r
+L43:\r
+       cmp         r1, #0\r
+       bne         L34\r
+       ldmfd     sp!, {r4-r11, pc}\r
+       
\ No newline at end of file