]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem32.S
Import some basic libraries instances for Mde Packages.
[mirror_edk2.git] / MdePkg / Library / BaseMemoryLibSse2 / Ia32 / SetMem32.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 # SetMem32.asm
20 #
21 # Abstract:
22 #
23 # SetMem32 function
24 #
25 # Notes:
26 #
27 #------------------------------------------------------------------------------
28
29 .globl _InternalMemSetMem32
30
31 #------------------------------------------------------------------------------
32 # VOID *
33 # EFIAPI
34 # InternalMemSetMem32 (
35 # IN VOID *Buffer,
36 # IN UINTN Count,
37 # IN UINT32 Value
38 # );
39 #------------------------------------------------------------------------------
40 _InternalMemSetMem32:
41 push %edi
42 movl 12(%esp), %edx
43 movl 8(%esp), %edi
44 xorl %ecx, %ecx
45 subl %edi, %ecx
46 andl $15, %ecx # ecx + edi aligns on 16-byte boundary
47 movl 16(%esp), %eax
48 jz L0
49 shrl $2, %ecx
50 cmpl %edx, %ecx
51 cmova %edx, %ecx
52 subl %ecx, %edx
53 rep
54 stosl
55 L0:
56 movl %edx, %ecx
57 andl $3, %edx
58 shrl $2, %ecx
59 jz L_SetDwords
60 movd %eax, %xmm0
61 pshufd $0, %xmm0, %xmm0
62 L1:
63 movntdq %xmm0, (%edi)
64 addl $16, %edi
65 loop L1
66 mfence
67 L_SetDwords:
68 movl %edx, %ecx
69 rep
70 stosl
71 movl 8(%esp), %eax
72 pop %edi
73 ret