]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseMemoryLibSse2/X64/SetMem32.asm
ArmPkg/ArmDisassemblerLib: fix check for MSR instruction
[mirror_edk2.git] / MdePkg / Library / BaseMemoryLibSse2 / X64 / SetMem32.asm
1 ;------------------------------------------------------------------------------
2 ;
3 ; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
4 ; 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 ; SetMem32.asm
15 ;
16 ; Abstract:
17 ;
18 ; SetMem32 function
19 ;
20 ; Notes:
21 ;
22 ;------------------------------------------------------------------------------
23
24 .code
25
26 ;------------------------------------------------------------------------------
27 ; VOID *
28 ; InternalMemSetMem32 (
29 ; IN VOID *Buffer,
30 ; IN UINTN Count,
31 ; IN UINT8 Value
32 ; )
33 ;------------------------------------------------------------------------------
34 InternalMemSetMem32 PROC USES rdi
35 mov rdi, rcx
36 mov r9, rdi
37 xor rcx, rcx
38 sub rcx, rdi
39 and rcx, 15
40 mov rax, r8
41 jz @F
42 shr rcx, 2
43 cmp rcx, rdx
44 cmova rcx, rdx
45 sub rdx, rcx
46 rep stosd
47 @@:
48 mov rcx, rdx
49 and edx, 3
50 shr rcx, 2
51 jz @SetDwords
52 movd xmm0, eax
53 pshufd xmm0, xmm0, 0
54 @@:
55 movntdq [rdi], xmm0
56 add rdi, 16
57 loop @B
58 mfence
59 @SetDwords:
60 mov ecx, edx
61 rep stosd
62 mov rax, r9
63 ret
64 InternalMemSetMem32 ENDP
65
66 END