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
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
21 ;---------------------------------------------------------------------------
27 ;---------------------------------------------------------------------------
36 ;Input: VOID *Buffer - Pointer to buffer to write
37 ; UINTN Count - Number of bytes to write
38 ; UINT8 Value - Value to write
46 ;Description: This function is an optimized set-memory function.
48 ;Notes: This function tries to set memory 8 bytes at a time. As a result,
49 ; it first picks up any misaligned bytes, then words, before getting
50 ; in the main loop that does the 8-byte clears.
53 EfiCommonLibSetMem PROC
57 sub esp, 10h; Reserve space for local variable UINT64 QWordValue @[ebp - 10H] & UINT64 MmxSave @[ebp - 18H]
61 mov edx, [ebp + 0Ch] ; Count
67 mov eax, [ebp + 8] ; Buffer
68 mov bl, [ebp + 10h] ; Value
103 mov WORD PTR [ebp - 10H], bx ; QWordValue[0]
104 mov WORD PTR [ebp - 10H + 2], bx ; QWordValue[2]
105 mov WORD PTR [ebp - 10H + 4], bx ; QWordValue[4]
106 mov WORD PTR [ebp - 10H + 6], bx ; QWordValue[6]
109 movq [ebp - 8], mm0 ; Save mm0 to MmxSave
110 movq mm0, [ebp - 10H] ; Load QWordValue to mm0
113 movq QWORD PTR ds:[edi], mm0
114 movq QWORD PTR ds:[edi+8], mm0
115 movq QWORD PTR ds:[edi+16], mm0
116 movq QWORD PTR ds:[edi+24], mm0
117 movq QWORD PTR ds:[edi+32], mm0
118 movq QWORD PTR ds:[edi+40], mm0
119 movq QWORD PTR ds:[edi+48], mm0
120 movq QWORD PTR ds:[edi+56], mm0
126 movq mm0, [ebp - 8] ; Restore MmxSave to mm0
127 emms ; Exit MMX Instruction
151 EfiCommonLibSetMem ENDP