]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseMemoryLibOptDxe/Arm/SetMem.S
MdePkg/BaseMemoryLibOptDxe ARM: add missing function annotations
[mirror_edk2.git] / MdePkg / Library / BaseMemoryLibOptDxe / Arm / SetMem.S
CommitLineData
a37f6605
AB
1#------------------------------------------------------------------------------\r
2#\r
3# Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>\r
4#\r
5# This program and the accompanying materials are licensed and made available\r
6# under the terms and conditions of the BSD License which accompanies this\r
7# distribution. The full text of the license may be found at\r
8# http://opensource.org/licenses/bsd-license.php\r
9#\r
10# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12#\r
13#------------------------------------------------------------------------------\r
14\r
15 .text\r
16 .thumb\r
17 .syntax unified\r
18 .align 5\r
decaac5d 19 .type ASM_PFX(InternalMemSetMem16), %function\r
a37f6605
AB
20ASM_GLOBAL ASM_PFX(InternalMemSetMem16)\r
21ASM_PFX(InternalMemSetMem16):\r
22 uxth r2, r2\r
8b4ca351 23 lsl r1, r1, #1\r
a37f6605 24 orr r2, r2, r2, lsl #16\r
8b4ca351 25 b 0f\r
a37f6605 26\r
decaac5d 27 .type ASM_PFX(InternalMemSetMem32), %function\r
a37f6605
AB
28ASM_GLOBAL ASM_PFX(InternalMemSetMem32)\r
29ASM_PFX(InternalMemSetMem32):\r
8b4ca351
AB
30 lsl r1, r1, #2\r
31 b 0f\r
a37f6605 32\r
decaac5d 33 .type ASM_PFX(InternalMemSetMem64), %function\r
a37f6605
AB
34ASM_GLOBAL ASM_PFX(InternalMemSetMem64)\r
35ASM_PFX(InternalMemSetMem64):\r
8b4ca351
AB
36 lsl r1, r1, #3\r
37 b 1f\r
38\r
39 .align 5\r
decaac5d 40 .type ASM_PFX(InternalMemSetMem), %function\r
8b4ca351
AB
41ASM_GLOBAL ASM_PFX(InternalMemSetMem)\r
42ASM_PFX(InternalMemSetMem):\r
43 uxtb r2, r2\r
44 orr r2, r2, r2, lsl #8\r
45 orr r2, r2, r2, lsl #16\r
46 b 0f\r
47\r
decaac5d 48 .type ASM_PFX(InternalMemZeroMem), %function\r
8b4ca351
AB
49ASM_GLOBAL ASM_PFX(InternalMemZeroMem)\r
50ASM_PFX(InternalMemZeroMem):\r
51 movs r2, #0\r
520: mov r3, r2\r
53\r
541: push {r4, lr}\r
a37f6605
AB
55 cmp r1, #16 // fewer than 16 bytes of input?\r
56 add r1, r1, r0 // r1 := dst + length\r
57 add lr, r0, #16\r
58 blt 2f\r
59 bic lr, lr, #15 // align output pointer\r
60\r
61 str r2, [r0] // potentially unaligned store of 4 bytes\r
62 str r3, [r0, #4] // potentially unaligned store of 4 bytes\r
63 str r2, [r0, #8] // potentially unaligned store of 4 bytes\r
64 str r3, [r0, #12] // potentially unaligned store of 4 bytes\r
65 beq 1f\r
66\r
670: add lr, lr, #16 // advance the output pointer by 16 bytes\r
68 subs r4, r1, lr // past the output?\r
69 blt 3f // break out of the loop\r
70 strd r2, r3, [lr, #-16] // aligned store of 16 bytes\r
71 strd r2, r3, [lr, #-8]\r
72 bne 0b // goto beginning of loop\r
731: pop {r4, pc}\r
74\r
752: subs r4, r1, lr\r
763: adds r4, r4, #16\r
77 subs r1, r1, #8\r
78 cmp r4, #4 // between 4 and 15 bytes?\r
79 blt 4f\r
80 cmp r4, #8 // between 8 and 15 bytes?\r
eab26788
AB
81 sub r4, lr, #16\r
82 str r2, [r4] // overlapping store of 4 + (4 + 4) + 4 bytes\r
83 it gt\r
84 strgt.n r3, [r4, #4]\r
85 it gt\r
86 strgt.n r2, [r1]\r
a37f6605
AB
87 str r3, [r1, #4]\r
88 pop {r4, pc}\r
89\r
904: cmp r4, #2 // 2 or 3 bytes?\r
91 strb r2, [lr, #-16] // store 1 byte\r
92 it ge\r
eab26788 93 strhge.n r2, [r1, #6] // store 2 bytes\r
a37f6605 94 pop {r4, pc}\r