]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseMemoryLibSse2/X64/SetMem16.nasm
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Library / BaseMemoryLibSse2 / X64 / 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 DEFAULT REL
19 SECTION .text
20
21 ;------------------------------------------------------------------------------
22 ; VOID *
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 rdi
32 mov rdi, rcx
33 mov r9, rdi
34 xor rcx, rcx
35 sub rcx, rdi
36 and rcx, 15
37 mov rax, r8
38 jz .0
39 shr rcx, 1
40 cmp rcx, rdx
41 cmova rcx, rdx
42 sub rdx, rcx
43 rep stosw
44 .0:
45 mov rcx, rdx
46 and edx, 7
47 shr rcx, 3
48 jz @SetWords
49 movd xmm0, eax
50 pshuflw xmm0, xmm0, 0
51 movlhps xmm0, xmm0
52 .1:
53 movntdq [rdi], xmm0
54 add rdi, 16
55 loop .1
56 mfence
57 @SetWords:
58 mov ecx, edx
59 rep stosw
60 mov rax, r9
61 pop rdi
62 ret
63