]>
Commit | Line | Data |
---|---|---|
e1f414b6 | 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 | |
2fcf0abf HT |
7 | Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r |
8 | This program and the accompanying materials\r | |
e1f414b6 | 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 | |
15c952e7 | 11 | http://opensource.org/licenses/bsd-license.php.\r |
e1f414b6 | 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 | |
e1f414b6 | 16 | **/\r |
17 | \r | |
1efcc4ae | 18 | \r |
f734a10a | 19 | \r |
e1f414b6 | 20 | \r |
21 | #include "MemLibInternals.h"\r | |
22 | \r | |
23 | /**\r | |
24 | Set Buffer to Value for Size bytes.\r | |
25 | \r | |
15c952e7 | 26 | @param Buffer The memory to set.\r |
27 | @param Length The number of bytes to set.\r | |
28 | @param Value The value of the set operation.\r | |
e1f414b6 | 29 | \r |
30 | @return Buffer\r | |
31 | \r | |
32 | **/\r | |
33 | VOID *\r | |
34 | EFIAPI\r | |
35 | InternalMemSetMem (\r | |
ea6898b9 | 36 | OUT VOID *Buffer,\r |
0827d304 | 37 | IN UINTN Length,\r |
e1f414b6 | 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 | |
7efb1d89 | 49 | while (Length-- > 0) {\r |
e1f414b6 | 50 | *(Pointer++) = Value;\r |
51 | }\r | |
52 | return Buffer;\r | |
53 | }\r |