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 ZeroMem service
31 Input: VOID *Buffer - Pointer to buffer to clear
32 UINTN Count - Number of bytes to clear
40 Description: This function is an optimized zero-memory function.
42 Notes: This function tries to zero memory 8 bytes at a time. As a result,
43 it first picks up any misaligned bytes, then words, before getting
44 in the main loop that does the 8-byte clears.
52 ; Pick up misaligned start
bytes (get pointer
4-byte aligned
)
55 and al
, 3 ; check lower
2 bits of address
57 je _ZeroBlocks
; already aligned
?
61 ; Clear the byte memory location
67 jmp _StartByteZero
; back to top of loop
71 ; Compute how many
64-byte blocks we can clear
73 shr ecx
, 6 ; convert to
64-byte count
74 shl ecx
, 6 ; convert back to bytes
75 sub edx
, ecx
; subtract from the original count
76 shr ecx
, 6 ; and this is how many
64-byte blocks
78 ; If no
64-byte blocks
, then skip
85 movdqu OWORD PTR ds
:[edi
], xmm1
86 movdqu OWORD PTR ds
:[edi
+16], xmm1
87 movdqu OWORD PTR ds
:[edi
+32], xmm1
88 movdqu OWORD PTR ds
:[edi
+48], xmm1
96 ; Zero out as many DWORDS as possible
103 ; Zero out remaining as bytes