X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdePkg%2FLibrary%2FBaseMemoryLibMmx%2FX64%2FSetMem32.asm;h=8900c680529a25f509f202d509c8643eac441d3e;hp=d835543767d0613176820be4e3908d9f884122f3;hb=085c39686cda99363262180e870135c9a80d8a4e;hpb=ab1096fdf6d3e2d6acb67e8bdf884af8bbc2d8fe diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem32.asm b/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem32.asm index d835543767..8900c68052 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem32.asm +++ b/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem32.asm @@ -1,7 +1,7 @@ ;------------------------------------------------------------------------------ ; -; Copyright (c) 2006, Intel Corporation -; All rights reserved. This program and the accompanying materials +; Copyright (c) 2006, Intel Corporation. All rights reserved.
+; This program and the accompanying materials ; are licensed and made available under the terms and conditions of the BSD License ; which accompanies this distribution. The full text of the license may be found at ; http://opensource.org/licenses/bsd-license.php @@ -23,23 +23,29 @@ .code -InternalMemSetMem32 PROC USES rdi - DB 49h, 0fh, 6eh, 0c0h ; movq mm0, r8 ; mm0 <- Value - mov rax, rcx ; rax <- Buffer - mov rdi, rax - mov rcx, rdx - shr rcx, 1 +;------------------------------------------------------------------------------ +; VOID * +; InternalMemSetMem32 ( +; IN VOID *Buffer, +; IN UINTN Count, +; IN UINT32 Value +; ) +;------------------------------------------------------------------------------ +InternalMemSetMem32 PROC + DB 49h, 0fh, 6eh, 0c0h ; movd mm0, r8 (Value) + mov rax, rcx ; rax <- Buffer + xchg rcx, rdx ; rcx <- Count rdx <- Buffer + shr rcx, 1 ; rcx <- # of qwords to set jz @SetDwords - DB 0fh, 70h, 0C0h, 44h ; pshufw mm0, mm0, 44h + DB 0fh, 70h, 0C0h, 44h ; pshufw mm0, mm0, 44h @@: - DB 48h, 0fh, 0e7h, 07h ; movntq [rdi], mm0 - add rdi, 8 + DB 0fh, 0e7h, 02h ; movntq [rdx], mm0 + lea rdx, [rdx + 8] ; use "lea" to avoid flag changes loop @B mfence @SetDwords: - test dl, 1 - jz @F - DB 0fh, 7eh, 07h ; movd [rdi], mm0 + jnc @F + DB 0fh, 7eh, 02h ; movd [rdx], mm0 @@: ret InternalMemSetMem32 ENDP