]>
Commit | Line | Data |
---|---|---|
9692aa20 JJ |
1 | ;------------------------------------------------------------------------------\r |
2 | ;\r | |
3 | ; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>\r | |
9344f092 | 4 | ; SPDX-License-Identifier: BSD-2-Clause-Patent\r |
9692aa20 JJ |
5 | ;\r |
6 | ; Module Name:\r | |
7 | ;\r | |
8 | ; SetMem.nasm\r | |
9 | ;\r | |
10 | ; Abstract:\r | |
11 | ;\r | |
12 | ; SetMem function\r | |
13 | ;\r | |
14 | ; Notes:\r | |
15 | ;\r | |
16 | ;------------------------------------------------------------------------------\r | |
17 | \r | |
18 | DEFAULT REL\r | |
19 | SECTION .text\r | |
20 | \r | |
21 | ;------------------------------------------------------------------------------\r | |
22 | ; VOID *\r | |
23 | ; EFIAPI\r | |
24 | ; InternalMemSetMem (\r | |
25 | ; OUT VOID *Buffer,\r | |
26 | ; IN UINTN Length,\r | |
27 | ; IN UINT8 Value\r | |
28 | ; );\r | |
29 | ;------------------------------------------------------------------------------\r | |
30 | global ASM_PFX(InternalMemSetMem)\r | |
31 | ASM_PFX(InternalMemSetMem):\r | |
32 | push rdi\r | |
33 | mov rax, r8\r | |
34 | mov ah, al\r | |
35 | DB 0x48, 0xf, 0x6e, 0xc0 ; movd mm0, rax\r | |
36 | mov r8, rcx\r | |
37 | mov rdi, r8 ; rdi <- Buffer\r | |
38 | mov rcx, rdx\r | |
39 | and edx, 7\r | |
40 | shr rcx, 3\r | |
41 | jz @SetBytes\r | |
42 | DB 0xf, 0x70, 0xC0, 0x0 ; pshufw mm0, mm0, 0h\r | |
43 | .0:\r | |
44 | DB 0xf, 0xe7, 0x7 ; movntq [rdi], mm0\r | |
45 | add rdi, 8\r | |
46 | loop .0\r | |
47 | mfence\r | |
48 | @SetBytes:\r | |
49 | mov ecx, edx\r | |
50 | rep stosb\r | |
51 | mov rax, r8\r | |
52 | pop rdi\r | |
53 | ret\r | |
54 | \r |