]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseMemoryLibSse2/X64/SetMem32.nasm
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Library / BaseMemoryLibSse2 / X64 / 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 DEFAULT REL
19 SECTION .text
20
21 ;------------------------------------------------------------------------------
22 ; VOID *
23 ; InternalMemSetMem32 (
24 ; IN VOID *Buffer,
25 ; IN UINTN Count,
26 ; IN UINT8 Value
27 ; )
28 ;------------------------------------------------------------------------------
29 global ASM_PFX(InternalMemSetMem32)
30 ASM_PFX(InternalMemSetMem32):
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, 2
40 cmp rcx, rdx
41 cmova rcx, rdx
42 sub rdx, rcx
43 rep stosd
44 .0:
45 mov rcx, rdx
46 and edx, 3
47 shr rcx, 2
48 jz @SetDwords
49 movd xmm0, eax
50 pshufd xmm0, xmm0, 0
51 .1:
52 movntdq [rdi], xmm0
53 add rdi, 16
54 loop .1
55 mfence
56 @SetDwords:
57 mov ecx, edx
58 rep stosd
59 mov rax, r9
60 pop rdi
61 ret
62