3 #Copyright (c) 2006, Intel Corporation
4 #All rights reserved. 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
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.
18 # This is the code that supports IA32-optimized SetMem service
22 #---------------------------------------------------------------------------
28 #---------------------------------------------------------------------------
29 .globl ASM_PFX(EfiCommonLibSetMem)
39 #Input: VOID *Buffer - Pointer to buffer to write
40 # UINTN Count - Number of bytes to write
41 # UINT8 Value - Value to write
49 #Description: This function is an optimized set-memory function.
51 #Notes: This function tries to set memory 8 bytes at a time. As a result,
52 # it first picks up any misaligned bytes, then words, before getting
53 # in the main loop that does the 8-byte clears.
56 ASM_PFX(EfiCommonLibSetMem):
60 subl $0x10, %esp # Reserve space for local variable UINT64 QWordValue @[ebp - 10H] & UINT64 MmxSave @[ebp - 18H]
64 movl 0xC(%ebp), %edx # Count
70 movl 8(%ebp), %eax # Buffer
71 movb 0x10(%ebp), %bl # Value
107 movw %bx, -0x10(%ebp) # QWordValue[0]
108 movw %bx, -0x10+2(%ebp) # QWordValue[2]
109 movw %bx, -0x10+4(%ebp) # QWordValue[4]
110 movw %bx, -0x10+6(%ebp) # QWordValue[6]
113 movq %mm0, -8(%ebp) # Save mm0 to MmxSave
114 movq -0x10(%ebp), %mm0 # Load QWordValue to mm0
117 movq %mm0, %ds:(%edi)
118 movq %mm0, %ds:8(%edi)
119 movq %mm0, %ds:16(%edi)
120 movq %mm0, %ds:24(%edi)
121 movq %mm0, %ds:32(%edi)
122 movq %mm0, %ds:40(%edi)
123 movq %mm0, %ds:48(%edi)
124 movq %mm0, %ds:56(%edi)
130 movq -8(%ebp), %mm0 # Restore MmxSave to mm0
131 emms # Exit MMX Instruction
157 #EfiCommonLibSetMem ENDP