]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem32.nasm
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Library / BaseMemoryLibSse2 / Ia32 / SetMem32.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 ; SetMem32.nasm
9 ;
10 ; Abstract:
11 ;
12 ; SetMem32 function
13 ;
14 ; Notes:
15 ;
16 ;------------------------------------------------------------------------------
17
18 SECTION .text
19
20 ;------------------------------------------------------------------------------
21 ; VOID *
22 ; EFIAPI
23 ; InternalMemSetMem32 (
24 ; IN VOID *Buffer,
25 ; IN UINTN Count,
26 ; IN UINT32 Value
27 ; );
28 ;------------------------------------------------------------------------------
29 global ASM_PFX(InternalMemSetMem32)
30 ASM_PFX(InternalMemSetMem32):
31 push edi
32 mov edx, [esp + 12]
33 mov edi, [esp + 8]
34 xor ecx, ecx
35 sub ecx, edi
36 and ecx, 15 ; ecx + edi aligns on 16-byte boundary
37 mov eax, [esp + 16]
38 jz .0
39 shr ecx, 2
40 cmp ecx, edx
41 cmova ecx, edx
42 sub edx, ecx
43 rep stosd
44 .0:
45 mov ecx, edx
46 and edx, 3
47 shr ecx, 2
48 jz @SetDwords
49 movd xmm0, eax
50 pshufd xmm0, xmm0, 0
51 .1:
52 movntdq [edi], xmm0
53 add edi, 16
54 loop .1
55 mfence
56 @SetDwords:
57 mov ecx, edx
58 rep stosd
59 mov eax, [esp + 8]
60 pop edi
61 ret
62