]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem16.nasm
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Library / BaseMemoryLibSse2 / Ia32 / SetMem16.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 ; SetMem16.nasm
9 ;
10 ; Abstract:
11 ;
12 ; SetMem16 function
13 ;
14 ; Notes:
15 ;
16 ;------------------------------------------------------------------------------
17
18 SECTION .text
19
20 ;------------------------------------------------------------------------------
21 ; VOID *
22 ; EFIAPI
23 ; InternalMemSetMem16 (
24 ; IN VOID *Buffer,
25 ; IN UINTN Count,
26 ; IN UINT16 Value
27 ; );
28 ;------------------------------------------------------------------------------
29 global ASM_PFX(InternalMemSetMem16)
30 ASM_PFX(InternalMemSetMem16):
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, 1
40 cmp ecx, edx
41 cmova ecx, edx
42 sub edx, ecx
43 rep stosw
44 .0:
45 mov ecx, edx
46 and edx, 7
47 shr ecx, 3
48 jz @SetWords
49 movd xmm0, eax
50 pshuflw xmm0, xmm0, 0
51 movlhps xmm0, xmm0
52 .1:
53 movntdq [edi], xmm0 ; edi should be 16-byte aligned
54 add edi, 16
55 loop .1
56 mfence
57 @SetWords:
58 mov ecx, edx
59 rep stosw
60 mov eax, [esp + 8]
61 pop edi
62 ret
63