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 ; SetMem.asm 15 ; 16 ; Abstract: 17 ; 18 ; SetMem function 19 ; 20 ; Notes: 21 ; 22 ;------------------------------------------------------------------------------ 23 24 .686 25 .model flat,C 26 .mmx 27 .code 28 29 ;------------------------------------------------------------------------------ 30 ; VOID * 31 ; EFIAPI 32 ; InternalMemSetMem ( 33 ; IN VOID *Buffer, 34 ; IN UINTN Count, 35 ; IN UINT8 Value 36 ; ) 37 ;------------------------------------------------------------------------------ 38 InternalMemSetMem PROC USES edi 39 mov al, [esp + 16] 40 mov ah, al 41 shrd edx, eax, 16 42 shld eax, edx, 16 43 mov ecx, [esp + 12] ; ecx <- Count 44 mov edi, [esp + 8] ; edi <- Buffer 45 mov edx, ecx 46 and edx, 7 47 shr ecx, 3 ; # of Qwords to set 48 jz @SetBytes 49 add esp, -10h 50 movq [esp], mm0 ; save mm0 51 movq [esp + 8], mm1 ; save mm1 52 movd mm0, eax 53 movd mm1, eax 54 psllq mm0, 32 55 por mm0, mm1 ; fill mm0 with 8 Value's 56 @@: 57 movq [edi], mm0 58 add edi, 8 59 loop @B 60 movq mm0, [esp] ; restore mm0 61 movq mm1, [esp + 8] ; restore mm1 62 add esp, 10h ; stack cleanup 63 @SetBytes: 64 mov ecx, edx 65 rep stosb 66 mov eax, [esp + 8] ; eax <- Buffer as return value 67 ret 68 InternalMemSetMem ENDP 69 70 END 71