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