]>
Commit | Line | Data |
---|---|---|
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 | |
3402aac7 | 7 | # any trailing bytes. It was updated to do 32-byte at a time.\r |
d39eb83c | 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 | |
20 | /**\r | |
21 | Set Buffer to Value for Size bytes.\r | |
22 | \r | |
23 | @param Buffer Memory to set.\r | |
24 | @param Length Number of bytes to set\r | |
25 | @param Value Value of the set operation.\r | |
26 | \r | |
27 | @return Buffer\r | |
28 | \r | |
29 | VOID *\r | |
30 | EFIAPI\r | |
31 | InternalMemSetMem (\r | |
32 | OUT VOID *Buffer,\r | |
33 | IN UINTN Length,\r | |
34 | IN UINT8 Value\r | |
35 | )\r | |
36 | **/\r | |
3402aac7 | 37 | \r |
d39eb83c | 38 | .text\r |
39 | .align 2\r | |
1bfda055 | 40 | GCC_ASM_EXPORT(InternalMemSetMem)\r |
d39eb83c | 41 | \r |
42 | ASM_PFX(InternalMemSetMem):\r | |
2ac288f9 | 43 | stmfd sp!, {r4-r11, lr}\r |
44 | tst r0, #3\r | |
45 | movne r3, #0\r | |
46 | moveq r3, #1\r | |
47 | cmp r1, #31\r | |
48 | movls lr, #0\r | |
49 | andhi lr, r3, #1\r | |
50 | cmp lr, #0\r | |
51 | mov r12, r0\r | |
52 | bne L31\r | |
d39eb83c | 53 | L32:\r |
2ac288f9 | 54 | mov r3, #0\r |
55 | b L43\r | |
d39eb83c | 56 | L31:\r |
57 | and r4, r2, #0xff\r | |
58 | orr r4, r4, r4, LSL #8\r | |
3402aac7 | 59 | orr r4, r4, r4, LSL #16\r |
2ac288f9 | 60 | mov r5, r4\r |
2ac288f9 | 61 | mov r6, r4\r |
3402aac7 RC |
62 | mov r7, r4\r |
63 | mov r8, r4\r | |
64 | mov r9, r4\r | |
65 | mov r10, r4\r | |
66 | mov r11, r4\r | |
2ac288f9 | 67 | b L32\r |
d39eb83c | 68 | L34:\r |
2ac288f9 | 69 | cmp lr, #0\r |
70 | streqb r2, [r12], #1\r | |
71 | subeq r1, r1, #1\r | |
72 | beq L43\r | |
73 | sub r1, r1, #32\r | |
74 | cmp r1, #31\r | |
75 | movls lr, r3\r | |
76 | stmia r12!, {r4-r11}\r | |
d39eb83c | 77 | L43:\r |
2ac288f9 | 78 | cmp r1, #0\r |
79 | bne L34\r | |
80 | ldmfd sp!, {r4-r11, pc}\r | |
3402aac7 | 81 | \r |