]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseMemoryLibSse2/x64/SetMem64.asm
8b33386ad0bfbd90fd33bed224653f283574c8f6
[mirror_edk2.git] / MdePkg / Library / BaseMemoryLibSse2 / x64 / SetMem64.asm
1 ;------------------------------------------------------------------------------
2 ;
3 ; Copyright (c) 2006, Intel Corporation
4 ; All rights reserved. This program and the accompanying materials
5 ; are licensed and made available under the terms and conditions of the BSD License
6 ; which accompanies this distribution. The full text of the license may be found at
7 ; http://opensource.org/licenses/bsd-license.php
8 ;
9 ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11 ;
12 ; Module Name:
13 ;
14 ; SetMem64.asm
15 ;
16 ; Abstract:
17 ;
18 ; SetMem64 function
19 ;
20 ; Notes:
21 ;
22 ;------------------------------------------------------------------------------
23
24 .code
25
26 ;------------------------------------------------------------------------------
27 ; VOID *
28 ; _mem_SetMem64 (
29 ; IN VOID *Buffer,
30 ; IN UINTN Count,
31 ; IN UINT8 Value
32 ; )
33 ;------------------------------------------------------------------------------
34 InternalMemSetMem64 PROC USES rdi
35 mov rdi, rcx
36 mov r9, rcx
37 test cl, 8
38 jz @F
39 mov [rdi], r8
40 add rdi, 8
41 dec rdx
42 @@:
43 mov rcx, rdx
44 shr rcx, 1
45 jz @SetQwords
46 movd xmm0, r8
47 movlhps xmm0, xmm0
48 @@:
49 movntdq [rdi], xmm0
50 add rdi, 16
51 loop @B
52 mfence
53 @SetQwords:
54 test dl, 1
55 jz @F
56 mov [rdi], r8
57 @@:
58 ret
59 InternalMemSetMem64 ENDP
60
61 END