]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.nasm
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Library / BaseMemoryLibMmx / X64 / SetMem.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 ; SetMem.nasm
9 ;
10 ; Abstract:
11 ;
12 ; SetMem function
13 ;
14 ; Notes:
15 ;
16 ;------------------------------------------------------------------------------
17
18 DEFAULT REL
19 SECTION .text
20
21 ;------------------------------------------------------------------------------
22 ; VOID *
23 ; EFIAPI
24 ; InternalMemSetMem (
25 ; OUT VOID *Buffer,
26 ; IN UINTN Length,
27 ; IN UINT8 Value
28 ; );
29 ;------------------------------------------------------------------------------
30 global ASM_PFX(InternalMemSetMem)
31 ASM_PFX(InternalMemSetMem):
32 push rdi
33 mov rax, r8
34 mov ah, al
35 DB 0x48, 0xf, 0x6e, 0xc0 ; movd mm0, rax
36 mov r8, rcx
37 mov rdi, r8 ; rdi <- Buffer
38 mov rcx, rdx
39 and edx, 7
40 shr rcx, 3
41 jz @SetBytes
42 DB 0xf, 0x70, 0xC0, 0x0 ; pshufw mm0, mm0, 0h
43 .0:
44 DB 0xf, 0xe7, 0x7 ; movntq [rdi], mm0
45 add rdi, 8
46 loop .0
47 mfence
48 @SetBytes:
49 mov ecx, edx
50 rep stosb
51 mov rax, r8
52 pop rdi
53 ret
54