]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseMemoryLibSse2/Ia32/ZeroMem.nasm
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Library / BaseMemoryLibSse2 / Ia32 / ZeroMem.nasm
1 ;------------------------------------------------------------------------------
2 ;
3 ; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
4 ; SPDX-License-Identifier: BSD-2-Clause-Patent
5 ;
6 ; Module Name:
7 ;
8 ; ZeroMem.nasm
9 ;
10 ; Abstract:
11 ;
12 ; ZeroMem function
13 ;
14 ; Notes:
15 ;
16 ;------------------------------------------------------------------------------
17
18 SECTION .text
19
20 ;------------------------------------------------------------------------------
21 ; VOID *
22 ; EFIAPI
23 ; InternalMemZeroMem (
24 ; IN VOID *Buffer,
25 ; IN UINTN Count
26 ; );
27 ;------------------------------------------------------------------------------
28 global ASM_PFX(InternalMemZeroMem)
29 ASM_PFX(InternalMemZeroMem):
30 push edi
31 mov edi, [esp + 8]
32 mov edx, [esp + 12]
33 xor ecx, ecx
34 sub ecx, edi
35 xor eax, eax
36 and ecx, 15
37 jz .0
38 cmp ecx, edx
39 cmova ecx, edx
40 sub edx, ecx
41 rep stosb
42 .0:
43 mov ecx, edx
44 and edx, 15
45 shr ecx, 4
46 jz @ZeroBytes
47 pxor xmm0, xmm0
48 .1:
49 movntdq [edi], xmm0
50 add edi, 16
51 loop .1
52 mfence
53 @ZeroBytes:
54 mov ecx, edx
55 rep stosb
56 mov eax, [esp + 8]
57 pop edi
58 ret
59