]>
Commit | Line | Data |
---|---|---|
d39eb83c | 1 | /** @file\r |
2 | Implementation of the EfiSetMem routine. This function is broken\r | |
3 | out into its own source file so that it can be excluded from a\r | |
4 | build for a particular platform easily if an optimized version\r | |
5 | is desired.\r | |
6 | \r | |
d6ebcab7 HT |
7 | Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r |
8 | This program and the accompanying materials\r | |
d39eb83c | 9 | are licensed and made available under the terms and conditions of the BSD License\r |
10 | which accompanies this distribution. The full text of the license may be found at\r | |
11 | http://opensource.org/licenses/bsd-license.php\r | |
12 | \r | |
13 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
14 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
15 | \r | |
16 | **/\r | |
17 | \r | |
18 | \r | |
19 | \r | |
20 | \r | |
21 | #include "MemLibInternals.h"\r | |
22 | \r | |
23 | /**\r | |
24 | Set Buffer to Value for Size bytes.\r | |
25 | \r | |
26 | @param Buffer Memory to set.\r | |
27 | @param Length Number of bytes to set\r | |
28 | @param Value Value of the set operation.\r | |
29 | \r | |
30 | @return Buffer\r | |
31 | \r | |
32 | **/\r | |
33 | VOID *\r | |
34 | EFIAPI\r | |
35 | InternalMemSetMem (\r | |
36 | OUT VOID *Buffer,\r | |
37 | IN UINTN Length,\r | |
38 | IN UINT8 Value\r | |
39 | )\r | |
40 | {\r | |
41 | //\r | |
42 | // Declare the local variables that actually move the data elements as\r | |
43 | // volatile to prevent the optimizer from replacing this function with\r | |
44 | // the intrinsic memset()\r | |
45 | //\r | |
46 | volatile UINT8 *Pointer;\r | |
47 | \r | |
48 | Pointer = (UINT8*)Buffer;\r | |
49 | while (Length-- > 0) {\r | |
50 | *(Pointer++) = Value;\r | |
51 | }\r | |
52 | return Buffer;\r | |
53 | }\r |