]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/UefiMemoryLib/MemLibInternals.h
Update copyright for files modified in this year
[mirror_edk2.git] / MdePkg / Library / UefiMemoryLib / MemLibInternals.h
CommitLineData
dd51a993 1/** @file\r
2 Declaration of internal functions for Base Memory Library.\r
3\r
373ade0e 4 Copyright (c) 2006 - 2008, Intel Corporation<BR>\r
dd51a993 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
2bfb6009 13 The following BaseMemoryLib instances contain the same copy of this file:\r
dd51a993 14\r
15 BaseMemoryLib\r
16 BaseMemoryLibMmx\r
17 BaseMemoryLibSse2\r
18 BaseMemoryLibRepStr\r
2bfb6009
LG
19 BaseMemoryLibOptDxe\r
20 BaseMemoryLibOptPei\r
dd51a993 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
c892d846 29\r
1ece02b5 30#include <Uefi.h>\r
c892d846 31\r
32\r
1ece02b5 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
dd51a993 38/**\r
070a76b1 39 Copies a source buffer to a destination buffer, and returns the destination buffer.\r
dd51a993 40\r
070a76b1 41 This function wraps the gBS->CopyMem().\r
dd51a993 42\r
070a76b1 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
dd51a993 48\r
49**/\r
50VOID *\r
51EFIAPI\r
52InternalMemCopyMem (\r
070a76b1 53 OUT VOID *Destination,\r
54 IN CONST VOID *Source,\r
dd51a993 55 IN UINTN Length\r
56 );\r
57\r
58/**\r
070a76b1 59 Fills a target buffer with a byte value, and returns the target buffer.\r
dd51a993 60\r
070a76b1 61 This function wraps the gBS->SetMem().\r
dd51a993 62\r
070a76b1 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
dd51a993 68\r
69**/\r
70VOID *\r
71EFIAPI\r
72InternalMemSetMem (\r
73 OUT VOID *Buffer,\r
070a76b1 74 IN UINTN Size,\r
dd51a993 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
42eedea9 136 @param Length Number of bytes to set\r
dd51a993 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
d531bfee 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
dd51a993 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