]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseMemoryLibSse2/X64/ZeroMem.asm
ArmPkg/ArmDisassemblerLib: fix check for MSR instruction
[mirror_edk2.git] / MdePkg / Library / BaseMemoryLibSse2 / X64 / ZeroMem.asm
CommitLineData
f1baef62 1;------------------------------------------------------------------------------\r
2;\r
c33c6476
HT
3; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>\r
4; This program and the accompanying materials\r
f1baef62 5; are licensed and made available under the terms and conditions of the BSD License\r
6; which accompanies this distribution. The full text of the license may be found at\r
2fc59a00 7; http://opensource.org/licenses/bsd-license.php.\r
f1baef62 8;\r
9; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11;\r
12; Module Name:\r
13;\r
14; ZeroMem.asm\r
15;\r
16; Abstract:\r
17;\r
18; ZeroMem function\r
19;\r
20; Notes:\r
21;\r
22;------------------------------------------------------------------------------\r
23\r
24 .code\r
25\r
26;------------------------------------------------------------------------------\r
27; VOID *\r
28; InternalMemZeroMem (\r
29; IN VOID *Buffer,\r
30; IN UINTN Count\r
31; )\r
32;------------------------------------------------------------------------------\r
33InternalMemZeroMem PROC USES rdi\r
34 mov rdi, rcx\r
35 xor rcx, rcx\r
36 xor eax, eax\r
37 sub rcx, rdi\r
38 and rcx, 15\r
39 mov r8, rdi\r
40 jz @F\r
41 cmp rcx, rdx\r
42 cmova rcx, rdx\r
43 sub rdx, rcx\r
44 rep stosb\r
45@@:\r
46 mov rcx, rdx\r
47 and edx, 15\r
48 shr rcx, 4\r
49 jz @ZeroBytes\r
50 pxor xmm0, xmm0\r
51@@:\r
52 movntdq [rdi], xmm0 ; rdi should be 16-byte aligned\r
53 add rdi, 16\r
54 loop @B\r
55 mfence\r
56@ZeroBytes:\r
57 mov ecx, edx\r
58 rep stosb\r
59 mov rax, r8\r
60 ret\r
61InternalMemZeroMem ENDP\r
62\r
63 END\r