]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseMemoryLibMmx/X64/SetMem16.nasm
MdePkg: Replace Opcode with the corresponding instructions.
[mirror_edk2.git] / MdePkg / Library / BaseMemoryLibMmx / X64 / SetMem16.nasm
CommitLineData
24502d71
JJ
1;------------------------------------------------------------------------------\r
2;\r
d3febfd9 3; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>\r
9344f092 4; SPDX-License-Identifier: BSD-2-Clause-Patent\r
24502d71
JJ
5;\r
6; Module Name:\r
7;\r
8; SetMem16.nasm\r
9;\r
10; Abstract:\r
11;\r
12; SetMem16 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; InternalMemSetMem16 (\r
25; OUT VOID *Buffer,\r
26; IN UINTN Length,\r
27; IN UINT16 Value\r
28; );\r
29;------------------------------------------------------------------------------\r
30global ASM_PFX(InternalMemSetMem16)\r
31ASM_PFX(InternalMemSetMem16):\r
32 push rdi\r
33 mov rax, r8\r
d3febfd9 34 movq mm0, rax\r
24502d71
JJ
35 mov r8, rcx\r
36 mov rdi, r8\r
37 mov rcx, rdx\r
38 and edx, 3\r
39 shr rcx, 2\r
40 jz @SetWords\r
d3febfd9 41 pshufw mm0, mm0, 0\r
24502d71 42.0:\r
d3febfd9 43 movntq [rdi], mm0\r
24502d71
JJ
44 add rdi, 8\r
45 loop .0\r
46 mfence\r
47@SetWords:\r
48 mov ecx, edx\r
49 rep stosw\r
50 mov rax, r8\r
51 pop rdi\r
52 ret\r
53\r