1 #------------------------------------------------------------------------------ 2 # 3 # Copyright (c) 2006 - 2009, 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.S 15 # 16 # Abstract: 17 # 18 # SetMem function 19 # 20 # Notes: 21 # 22 #------------------------------------------------------------------------------ 23 #------------------------------------------------------------------------------ 24 # VOID * 25 # EFIAPI 26 # InternalMemSetMem ( 27 # IN VOID *Buffer, 28 # IN UINTN Count, 29 # IN UINT8 Value 30 # ) 31 #------------------------------------------------------------------------------ 32 ASM_GLOBAL ASM_PFX(InternalMemSetMem) 33 ASM_PFX(InternalMemSetMem): 34 pushq %rdi 35 pushq %rbx 36 pushq %rcx # push Buffer 37 movq %r8, %rax # rax = Value 38 andq $0xff, %rax # rax = lower 8 bits of r8, upper 56 bits are 0 39 movb %al, %ah # ah = al 40 movw %ax, %bx # bx = ax 41 shlq $0x10, %rax # rax = ax << 16 42 movw %bx, %ax # ax = bx 43 movq %rax, %rbx # ebx = eax 44 shlq $0x20, %rax # rax = rax << 32 45 orq %rbx, %rax # eax = ebx 46 movq %rcx, %rdi # rdi = Buffer 47 movq %rdx, %rcx # rcx = Count 48 shrq $3, %rcx # rcx = rcx / 8 49 cld 50 rep stosq 51 movq %rdx, %rcx # rcx = rdx 52 andq $7, %rcx # rcx = rcx & 7 53 rep stosb 54 popq %rax # rax = Buffer 55 popq %rbx 56 popq %rdi 57 ret 58