]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseMemoryLibSse2/Ia32/ZeroMem.asm
Import some basic libraries instances for Mde Packages.
[mirror_edk2.git] / MdePkg / Library / BaseMemoryLibSse2 / Ia32 / ZeroMem.asm
1 //
2 // Include common header file for this module.
3 //
4 #include "CommonHeader.h"
5
6 ;------------------------------------------------------------------------------
7 ;
8 ; Copyright (c) 2006, Intel Corporation
9 ; All rights reserved. This program and the accompanying materials
10 ; are licensed and made available under the terms and conditions of the BSD License
11 ; which accompanies this distribution. The full text of the license may be found at
12 ; http://opensource.org/licenses/bsd-license.php
13 ;
14 ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15 ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 ;
17 ; Module Name:
18 ;
19 ; ZeroMem.asm
20 ;
21 ; Abstract:
22 ;
23 ; ZeroMem function
24 ;
25 ; Notes:
26 ;
27 ;------------------------------------------------------------------------------
28
29 .686
30 .model flat,C
31 .xmm
32 .code
33
34 ;------------------------------------------------------------------------------
35 ; VOID *
36 ; EFIAPI
37 ; InternalMemZeroMem (
38 ; IN VOID *Buffer,
39 ; IN UINTN Count
40 ; );
41 ;------------------------------------------------------------------------------
42 InternalMemZeroMem PROC USES edi
43 mov edi, [esp + 8]
44 mov edx, [esp + 12]
45 xor ecx, ecx
46 sub ecx, edi
47 xor eax, eax
48 and ecx, 15
49 jz @F
50 cmp ecx, edx
51 cmova ecx, edx
52 sub edx, ecx
53 rep stosb
54 @@:
55 mov ecx, edx
56 and edx, 15
57 shr ecx, 4
58 jz @ZeroBytes
59 pxor xmm0, xmm0
60 @@:
61 movntdq [edi], xmm0
62 add edi, 16
63 loop @B
64 mfence
65 @ZeroBytes:
66 mov ecx, edx
67 rep stosb
68 mov eax, [esp + 8]
69 ret
70 InternalMemZeroMem ENDP
71
72 END