]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Library/BaseMemoryLibStm/Arm/SetMem.S
BeagleBoardPkg: remove dependency on ArmPkg/BaseMemoryLibStm
[mirror_edk2.git] / ArmPkg / Library / BaseMemoryLibStm / 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. It was updated to do 32-byte at a time.
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 #include <AsmMacroIoLib.h>
21
22 /**
23 Set Buffer to Value for Size bytes.
24
25 @param Buffer Memory to set.
26 @param Length Number of bytes to set
27 @param Value Value of the set operation.
28
29 @return Buffer
30
31 VOID *
32 EFIAPI
33 InternalMemSetMem (
34 OUT VOID *Buffer,
35 IN UINTN Length,
36 IN UINT8 Value
37 )
38 **/
39
40 .syntax unified
41
42 ASM_FUNC(InternalMemSetMem)
43 stmfd sp!, {r4-r11, lr}
44 tst r0, #3
45 movne r3, #0
46 moveq r3, #1
47 cmp r1, #31
48 movls lr, #0
49 andhi lr, r3, #1
50 cmp lr, #0
51 mov r12, r0
52 bne L31
53 L32:
54 mov r3, #0
55 b L43
56 L31:
57 and r4, r2, #0xff
58 orr r4, r4, r4, LSL #8
59 orr r4, r4, r4, LSL #16
60 mov r5, r4
61 mov r6, r4
62 mov r7, r4
63 mov r8, r4
64 mov r9, r4
65 mov r10, r4
66 mov r11, r4
67 b L32
68 L34:
69 cmp lr, #0
70 strbeq r2, [r12], #1
71 subeq r1, r1, #1
72 beq L43
73 sub r1, r1, #32
74 cmp r1, #31
75 movls lr, r3
76 stmia r12!, {r4-r11}
77 L43:
78 cmp r1, #0
79 bne L34
80 ldmfd sp!, {r4-r11, pc}
81