1 /*++
2 
3 Copyright (c) 2007, 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   EfiZeroMemRep4.c
15 
16 Abstract:
17 
18   This is the code that uses rep stosd ZeroMem service
19 
20 --*/
21 
22 #include "Tiano.h"
23 
24 VOID
EfiCommonLibZeroMem(IN VOID * Buffer,IN UINTN Count)25 EfiCommonLibZeroMem (
26   IN VOID   *Buffer,
27   IN UINTN  Count
28   )
29 /*++
30 
31 Input:  VOID   *Buffer - Pointer to buffer to clear
32         UINTN  Count  - Number of bytes to clear
33 
34 Output: None.
35 
36 Saves:
37 
38 Modifies:
39 
40 Description:  This function uses rep stosd to zero memory.
41 
42 --*/
43 {
44   __asm {
45     mov         ecx, Count
46     test        ecx, ecx
47     je          Exit
48     xor         eax, eax
49     mov         edi, Buffer
50     mov         edx, ecx
51     shr         ecx, 2
52     and         edx, 3
53     rep         stosd
54     mov         ecx, edx
55     rep         stosb
56 Exit:
57   }
58 }
59 
60