]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseMemoryLibOptDxe/Arm/SetMem.asm
MdePkg/BaseMemoryLibOptDxe: replace deprecated uses of IT blocks
[mirror_edk2.git] / MdePkg / Library / BaseMemoryLibOptDxe / Arm / SetMem.asm
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 EXPORT InternalMemZeroMem\r
16 EXPORT InternalMemSetMem\r
17 EXPORT InternalMemSetMem16\r
18 EXPORT InternalMemSetMem32\r
19 EXPORT InternalMemSetMem64\r
20\r
21 AREA SetMem, CODE, READONLY, CODEALIGN, ALIGN=5\r
22 THUMB\r
23\r
8b4ca351
AB
24InternalMemSetMem16\r
25 uxth r2, r2\r
26 lsl r1, r1, #1\r
27 orr r2, r2, r2, lsl #16\r
28 b B0\r
29\r
30InternalMemSetMem32\r
31 lsl r1, r1, #2\r
32 b B0\r
33\r
34InternalMemSetMem64\r
35 lsl r1, r1, #3\r
36 b B1\r
a37f6605 37\r
8b4ca351 38 ALIGN 32\r
a37f6605
AB
39InternalMemSetMem\r
40 uxtb r2, r2\r
41 orr r2, r2, r2, lsl #8\r
8b4ca351
AB
42 orr r2, r2, r2, lsl #16\r
43 b B0\r
a37f6605 44\r
8b4ca351
AB
45InternalMemZeroMem\r
46 movs r2, #0\r
47B0\r
a37f6605
AB
48 mov r3, r2\r
49\r
8b4ca351 50B1\r
a37f6605
AB
51 push {r4, lr}\r
52 cmp r1, #16 ; fewer than 16 bytes of input?\r
53 add r1, r1, r0 ; r1 := dst + length\r
54 add lr, r0, #16\r
55 blt L2\r
56 bic lr, lr, #15 ; align output pointer\r
57\r
58 str r2, [r0] ; potentially unaligned store of 4 bytes\r
59 str r3, [r0, #4] ; potentially unaligned store of 4 bytes\r
60 str r2, [r0, #8] ; potentially unaligned store of 4 bytes\r
61 str r3, [r0, #12] ; potentially unaligned store of 4 bytes\r
62 beq L1\r
63\r
64L0\r
65 add lr, lr, #16 ; advance the output pointer by 16 bytes\r
66 subs r4, r1, lr ; past the output?\r
67 blt L3 ; break out of the loop\r
68 strd r2, r3, [lr, #-16] ; aligned store of 16 bytes\r
69 strd r2, r3, [lr, #-8]\r
70 bne L0 ; goto beginning of loop\r
71L1\r
72 pop {r4, pc}\r
73\r
74L2\r
75 subs r4, r1, lr\r
76L3\r
77 adds r4, r4, #16\r
78 subs r1, r1, #8\r
79 cmp r4, #4 ; between 4 and 15 bytes?\r
80 blt L4\r
81 cmp r4, #8 ; between 8 and 15 bytes?\r
82 str r2, [lr, #-16] ; overlapping store of 4 + (4 + 4) + 4 bytes\r
83 itt gt\r
84 strgt r3, [lr, #-12]\r
85 strgt r2, [r1]\r
86 str r3, [r1, #4]\r
87 pop {r4, pc}\r
88\r
89L4\r
90 cmp r4, #2 ; 2 or 3 bytes?\r
91 strb r2, [lr, #-16] ; store 1 byte\r
92 it ge\r
93 strhge r2, [r1, #6] ; store 2 bytes\r
94 pop {r4, pc}\r
95\r
96 END\r