1 ;------------------------------------------------------------------------------
3 ; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
4 ; SPDX-License-Identifier: BSD-2-Clause-Patent
16 ;------------------------------------------------------------------------------
20 ;------------------------------------------------------------------------------
28 ;------------------------------------------------------------------------------
29 global ASM_PFX(InternalMemSetMem)
30 ASM_PFX(InternalMemSetMem):
32 mov edx, [esp + 12] ; edx <- Count
33 mov edi, [esp + 8] ; edi <- Buffer
34 mov al, [esp + 16] ; al <- Value
37 and ecx, 15 ; ecx + edi aligns on 16-byte boundary
46 shr ecx, 4 ; ecx <- # of DQwords to set
48 mov ah, al ; ax <- Value | (Value << 8)
50 movdqu [esp], xmm0 ; save xmm0
52 pshuflw xmm0, xmm0, 0 ; xmm0[0..63] <- Value repeats 8 times
53 movlhps xmm0, xmm0 ; xmm0 <- Value repeats 16 times
55 movntdq [edi], xmm0 ; edi should be 16-byte aligned
59 movdqu xmm0, [esp] ; restore xmm0
60 add esp, 16 ; stack cleanup
64 mov eax, [esp + 8] ; eax <- Buffer as return value