]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPkg/Library/BaseMemoryLibVstm/Arm/SetMem.S
ArmPkg/CompilerIntrinsicsLib: replace memcpy and memset with C code
[mirror_edk2.git] / ArmPkg / Library / BaseMemoryLibVstm / Arm / SetMem.S
CommitLineData
3402aac7 1#------------------------------------------------------------------------------\r
d39eb83c 2#\r
3# SemMem() worker for ARM\r
4#\r
5# This file started out as C code that did 64 bit moves if the buffer was\r
6# 32-bit aligned, else it does a byte copy. It also does a byte copy for\r
7# any trailing bytes. Update to use VSTM/VLDM to do 128 byte writes.\r
8#\r
d6ebcab7
HT
9# Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>\r
10# This program and the accompanying materials\r
d39eb83c 11# are licensed and made available under the terms and conditions of the BSD License\r
12# which accompanies this distribution. The full text of the license may be found at\r
13# http://opensource.org/licenses/bsd-license.php\r
14#\r
15# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
16# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
17#\r
18#------------------------------------------------------------------------------\r
19\r
7589d9db
AB
20#include <AsmMacroIoLib.h>\r
21\r
d39eb83c 22/**\r
23 Set Buffer to Value for Size bytes.\r
24\r
25 @param Buffer Memory to set.\r
26 @param Length Number of bytes to set\r
27 @param Value Value of the set operation.\r
28\r
29 @return Buffer\r
30\r
31VOID *\r
32EFIAPI\r
33InternalMemSetMem (\r
34 OUT VOID *Buffer,\r
35 IN UINTN Length,\r
36 IN UINT8 Value\r
37 )\r
38**/\r
7589d9db 39ASM_FUNC(InternalMemSetMem)\r
2ac288f9 40 stmfd sp!, {r4-r7, lr}\r
41 tst r0, #3\r
42 movne r3, #0\r
43 moveq r3, #1\r
44 cmp r1, #127\r
45 movls lr, #0\r
46 andhi lr, r3, #1\r
47 cmp lr, #0\r
48 mov r12, r0\r
49 bne L31\r
d39eb83c 50L32:\r
2ac288f9 51 mov r3, #0\r
52 b L43\r
d39eb83c 53L31:\r
54 vdup.8 q0,r2\r
55 vmov q1,q0\r
56 vmov q2,q0\r
57 vmov q3,q0\r
58 vmov q4,q0\r
59 vmov q5,q0\r
60 vmov q6,q0\r
61 vmov q7,q0\r
2ac288f9 62 b L32\r
d39eb83c 63L34:\r
2ac288f9 64 cmp lr, #0\r
65 streqb r2, [r12], #1\r
66 subeq r1, r1, #1\r
67 beq L43\r
68 sub r1, r1, #128\r
69 cmp r1, #127\r
70 cmp r1, #31\r
71 movls lr, r3\r
72 vstm r12!, {d0-d15}\r
d39eb83c 73L43:\r
2ac288f9 74 cmp r1, #0\r
75 bne L34\r
76 ldmfd sp!, {pc}\r