• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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   EfiSetMemRep4.c
15 
16 Abstract:
17 
18   This is the code that uses rep stosd SetMem service
19 
20 --*/
21 
22 #include "Tiano.h"
23 
24 VOID
EfiCommonLibSetMem(IN VOID * Buffer,IN UINTN Count,IN UINT8 Value)25 EfiCommonLibSetMem (
26   IN VOID   *Buffer,
27   IN UINTN  Count,
28   IN UINT8  Value
29   )
30 /*++
31 
32 Input:  VOID   *Buffer - Pointer to buffer to write
33         UINTN  Count   - Number of bytes to write
34         UINT8  Value   - Value to write
35 
36 Output: None.
37 
38 Saves:
39 
40 Modifies:
41 
42 Description:  This function uses rep stosd to set memory.
43 
44 --*/
45 {
46   __asm {
47     mov         ecx, Count
48     test        ecx, ecx
49     je          Exit
50     mov         al,  Value
51     mov         ah,  al
52     shrd        edx, eax, 16
53     shld        eax, edx, 16
54     mov         edx, ecx
55     mov         edi, Buffer
56     shr         ecx, 2
57     rep stosd
58     mov         ecx, edx
59     and         ecx, 3
60     rep stosb
61 Exit:
62   }
63 }
64 
65