]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseMemoryLibSse2/Ia32/ZeroMem.S
Import some basic libraries instances for Mde Packages.
[mirror_edk2.git] / MdePkg / Library / BaseMemoryLibSse2 / Ia32 / ZeroMem.S
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 .globl _InternalMemZeroMem
30
31 #------------------------------------------------------------------------------
32 # VOID *
33 # EFIAPI
34 # InternalMemZeroMem (
35 # IN VOID *Buffer,
36 # IN UINTN Count
37 # );
38 #------------------------------------------------------------------------------
39 _InternalMemZeroMem:
40 push %edi
41 movl 8(%esp), %edi
42 movl 12(%esp), %edx
43 xorl %ecx, %ecx
44 subl %edi, %ecx
45 xorl %eax, %eax
46 andl $15, %ecx
47 jz L0
48 cmpl %edx, %ecx
49 cmova %edx, %ecx
50 subl %ecx, %edx
51 rep
52 stosb
53 L0:
54 movl %edx, %ecx
55 andl $15, %edx
56 shrl $4, %ecx
57 jz L_ZeroBytes
58 pxor %xmm0, %xmm0
59 L1:
60 movntdq %xmm0, (%edi)
61 addl $16, %edi
62 loop L1
63 mfence
64 L_ZeroBytes:
65 movl %edx, %ecx
66 rep
67 stosb
68 movl 8(%esp), %eax
69 pop %edi
70 ret