1# 2# ConvertAsm.py: Automatically generated from SetMem.asm 3# 4#------------------------------------------------------------------------------ 5# 6# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR> 7# This program and the accompanying materials 8# are licensed and made available under the terms and conditions of the BSD License 9# which accompanies this distribution. The full text of the license may be found at 10# http://opensource.org/licenses/bsd-license.php. 11# 12# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 13# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 14# 15# Module Name: 16# 17# SetMem.S 18# 19# Abstract: 20# 21# SetMem function 22# 23# Notes: 24# 25#------------------------------------------------------------------------------ 26 27 28#------------------------------------------------------------------------------ 29# VOID * 30# EFIAPI 31# InternalMemSetMem ( 32# IN VOID *Buffer, 33# IN UINTN Count, 34# IN UINT8 Value 35# ) 36#------------------------------------------------------------------------------ 37ASM_GLOBAL ASM_PFX(InternalMemSetMem) 38ASM_PFX(InternalMemSetMem): 39 pushq %rdi 40 movq %rcx, %rdi # rdi <- Buffer 41 movb %r8b, %al # al <- Value 42 movq %rdi, %r9 # r9 <- Buffer as return value 43 xorq %rcx, %rcx 44 subq %rdi, %rcx 45 andq $15, %rcx # rcx + rdi aligns on 16-byte boundary 46 jz L0 47 cmpq %rdx, %rcx 48 cmova %rdx, %rcx 49 subq %rcx, %rdx 50 rep stosb 51L0: 52 movq %rdx, %rcx 53 andq $15, %rdx 54 shrq $4, %rcx 55 jz L_SetBytes 56 movb %al, %ah # ax <- Value repeats twice 57 movdqa %xmm0, 0x10(%rsp) # save xmm0 58 movd %eax, %xmm0 # xmm0[0..16] <- Value repeats twice 59 pshuflw $0, %xmm0, %xmm0 # xmm0[0..63] <- Value repeats 8 times 60 movlhps %xmm0, %xmm0 # xmm0 <- Value repeats 16 times 61L1: 62 movntdq %xmm0, (%rdi) # rdi should be 16-byte aligned 63 add $16, %rdi 64 loop L1 65 mfence 66 movdqa 0x10(%rsp), %xmm0 # restore xmm0 67L_SetBytes: 68 movl %edx, %ecx # high 32 bits of rcx are always zero 69 rep stosb 70 movq %r9, %rax # rax <- Return value 71 popq %rdi 72 ret 73