]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Library/UefiMemoryLib/MemLibInternals.h
Update copyright for files modified in this year
[mirror_edk2.git] / MdePkg / Library / UefiMemoryLib / MemLibInternals.h
... / ...
CommitLineData
1/** @file\r
2 Declaration of internal functions for Base Memory Library.\r
3\r
4 Copyright (c) 2006 - 2008, Intel Corporation<BR>\r
5 All rights reserved. This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13 The following BaseMemoryLib instances contain the same copy of this file:\r
14\r
15 BaseMemoryLib\r
16 BaseMemoryLibMmx\r
17 BaseMemoryLibSse2\r
18 BaseMemoryLibRepStr\r
19 BaseMemoryLibOptDxe\r
20 BaseMemoryLibOptPei\r
21 PeiMemoryLib\r
22 DxeMemoryLib\r
23\r
24**/\r
25\r
26#ifndef __MEM_LIB_INTERNALS__\r
27#define __MEM_LIB_INTERNALS__\r
28\r
29\r
30#include <Uefi.h>\r
31\r
32\r
33#include <Library/BaseMemoryLib.h>\r
34#include <Library/DebugLib.h>\r
35#include <Library/UefiBootServicesTableLib.h>\r
36#include <Library/BaseLib.h>\r
37\r
38/**\r
39 Copies a source buffer to a destination buffer, and returns the destination buffer.\r
40\r
41 This function wraps the gBS->CopyMem().\r
42\r
43 @param DestinationBuffer Pointer to the destination buffer of the memory copy.\r
44 @param SourceBuffer Pointer to the source buffer of the memory copy.\r
45 @param Length Number of bytes to copy from SourceBuffer to DestinationBuffer.\r
46\r
47 @return DestinationBuffer.\r
48\r
49**/\r
50VOID *\r
51EFIAPI\r
52InternalMemCopyMem (\r
53 OUT VOID *Destination,\r
54 IN CONST VOID *Source,\r
55 IN UINTN Length\r
56 );\r
57\r
58/**\r
59 Fills a target buffer with a byte value, and returns the target buffer.\r
60\r
61 This function wraps the gBS->SetMem().\r
62\r
63 @param Buffer Memory to set.\r
64 @param Size Number of bytes to set.\r
65 @param Value Value of the set operation.\r
66\r
67 @return Buffer.\r
68\r
69**/\r
70VOID *\r
71EFIAPI\r
72InternalMemSetMem (\r
73 OUT VOID *Buffer,\r
74 IN UINTN Size,\r
75 IN UINT8 Value\r
76 );\r
77\r
78/**\r
79 Fills a target buffer with a 16-bit value, and returns the target buffer.\r
80\r
81 @param Buffer Pointer to the target buffer to fill.\r
82 @param Length Number of bytes in Buffer to fill.\r
83 @param Value Value with which to fill Length bytes of Buffer.\r
84\r
85 @return Buffer\r
86\r
87**/\r
88VOID *\r
89EFIAPI\r
90InternalMemSetMem16 (\r
91 OUT VOID *Buffer,\r
92 IN UINTN Length,\r
93 IN UINT16 Value\r
94 );\r
95\r
96/**\r
97 Fills a target buffer with a 32-bit value, and returns the target buffer.\r
98\r
99 @param Buffer Pointer to the target buffer to fill.\r
100 @param Length Number of bytes in Buffer to fill.\r
101 @param Value Value with which to fill Length bytes of Buffer.\r
102\r
103 @return Buffer\r
104\r
105**/\r
106VOID *\r
107EFIAPI\r
108InternalMemSetMem32 (\r
109 OUT VOID *Buffer,\r
110 IN UINTN Length,\r
111 IN UINT32 Value\r
112 );\r
113\r
114/**\r
115 Fills a target buffer with a 64-bit value, and returns the target buffer.\r
116\r
117 @param Buffer Pointer to the target buffer to fill.\r
118 @param Length Number of bytes in Buffer to fill.\r
119 @param Value Value with which to fill Length bytes of Buffer.\r
120\r
121 @return Buffer\r
122\r
123**/\r
124VOID *\r
125EFIAPI\r
126InternalMemSetMem64 (\r
127 OUT VOID *Buffer,\r
128 IN UINTN Length,\r
129 IN UINT64 Value\r
130 );\r
131\r
132/**\r
133 Set Buffer to 0 for Size bytes.\r
134\r
135 @param Buffer Memory to set.\r
136 @param Length Number of bytes to set\r
137\r
138 @return Buffer\r
139\r
140**/\r
141VOID *\r
142EFIAPI\r
143InternalMemZeroMem (\r
144 OUT VOID *Buffer,\r
145 IN UINTN Length\r
146 );\r
147\r
148/**\r
149 Compares two memory buffers of a given length.\r
150\r
151 @param DestinationBuffer First memory buffer\r
152 @param SourceBuffer Second memory buffer\r
153 @param Length Length of DestinationBuffer and SourceBuffer memory\r
154 regions to compare. Must be non-zero.\r
155\r
156 @return 0 All Length bytes of the two buffers are identical.\r
157 @retval Non-zero The first mismatched byte in SourceBuffer subtracted from the first\r
158 mismatched byte in DestinationBuffer.\r
159\r
160**/\r
161INTN\r
162EFIAPI\r
163InternalMemCompareMem (\r
164 IN CONST VOID *DestinationBuffer,\r
165 IN CONST VOID *SourceBuffer,\r
166 IN UINTN Length\r
167 );\r
168\r
169/**\r
170 Scans a target buffer for an 8-bit value, and returns a pointer to the\r
171 matching 8-bit value in the target buffer.\r
172\r
173 @param Buffer Pointer to the target buffer to scan.\r
174 @param Length Number of bytes in Buffer to scan. Must be non-zero.\r
175 @param Value Value to search for in the target buffer.\r
176\r
177 @return Pointer to the first occurrence or NULL if not found.\r
178\r
179**/\r
180CONST VOID *\r
181EFIAPI\r
182InternalMemScanMem8 (\r
183 IN CONST VOID *Buffer,\r
184 IN UINTN Length,\r
185 IN UINT8 Value\r
186 );\r
187\r
188/**\r
189 Scans a target buffer for a 16-bit value, and returns a pointer to the\r
190 matching 16-bit value in the target buffer.\r
191\r
192 @param Buffer Pointer to the target buffer to scan.\r
193 @param Length Number of bytes in Buffer to scan. Must be non-zero.\r
194 @param Value Value to search for in the target buffer.\r
195\r
196 @return Pointer to the first occurrence or NULL if not found.\r
197\r
198**/\r
199CONST VOID *\r
200EFIAPI\r
201InternalMemScanMem16 (\r
202 IN CONST VOID *Buffer,\r
203 IN UINTN Length,\r
204 IN UINT16 Value\r
205 );\r
206\r
207/**\r
208 Scans a target buffer for a 32-bit value, and returns a pointer to the\r
209 matching 32-bit value in the target buffer.\r
210\r
211 @param Buffer Pointer to the target buffer to scan.\r
212 @param Length Number of bytes in Buffer to scan. Must be non-zero.\r
213 @param Value Value to search for in the target buffer.\r
214\r
215 @return Pointer to the first occurrence or NULL if not found.\r
216\r
217**/\r
218CONST VOID *\r
219EFIAPI\r
220InternalMemScanMem32 (\r
221 IN CONST VOID *Buffer,\r
222 IN UINTN Length,\r
223 IN UINT32 Value\r
224 );\r
225\r
226/**\r
227 Scans a target buffer for a 64-bit value, and returns a pointer to the\r
228 matching 64-bit value in the target buffer.\r
229\r
230 @param Buffer Pointer to the target buffer to scan.\r
231 @param Length Number of bytes in Buffer to scan. Must be non-zero.\r
232 @param Value Value to search for in the target buffer.\r
233\r
234 @return Pointer to the first occurrence or NULL if not found.\r
235\r
236**/\r
237CONST VOID *\r
238EFIAPI\r
239InternalMemScanMem64 (\r
240 IN CONST VOID *Buffer,\r
241 IN UINTN Length,\r
242 IN UINT64 Value\r
243 );\r
244\r
245#endif\r