]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/PeiMemoryLib/MemLibInternals.h
1. Change 0 == Length style to Length == 0
[mirror_edk2.git] / MdePkg / Library / PeiMemoryLib / MemLibInternals.h
CommitLineData
dd51a993 1/** @file\r
2 Declaration of internal functions for Base Memory Library.\r
3\r
4 Copyright (c) 2006, 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
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
bad46384 30#include <PiPei.h>\r
c892d846 31\r
bad46384 32#include <Library/BaseMemoryLib.h>\r
33#include <Library/PeiServicesTablePointerLib.h>\r
34#include <Library/DebugLib.h>\r
35#include <Library/BaseLib.h>\r
36\r
dd51a993 37/**\r
38 Copy Length bytes from Source to Destination.\r
39\r
42eedea9 40 @param DestinationBuffer Target of copy\r
41 @param SourceBuffer Place to copy from\r
42 @param Length Number of bytes to copy\r
dd51a993 43\r
44 @return Destination\r
45\r
46**/\r
47VOID *\r
48EFIAPI\r
49InternalMemCopyMem (\r
50 OUT VOID *DestinationBuffer,\r
51 IN CONST VOID *SourceBuffer,\r
52 IN UINTN Length\r
53 );\r
54\r
55/**\r
56 Set Buffer to Value for Size bytes.\r
57\r
58 @param Buffer Memory to set.\r
42eedea9 59 @param Length Number of bytes to set\r
dd51a993 60 @param Value Value of the set operation.\r
61\r
62 @return Buffer\r
63\r
64**/\r
65VOID *\r
66EFIAPI\r
67InternalMemSetMem (\r
68 OUT VOID *Buffer,\r
69 IN UINTN Length,\r
70 IN UINT8 Value\r
71 );\r
72\r
73/**\r
74 Fills a target buffer with a 16-bit value, and returns the target buffer.\r
75\r
76 @param Buffer Pointer to the target buffer to fill.\r
77 @param Length Number of bytes in Buffer to fill.\r
78 @param Value Value with which to fill Length bytes of Buffer.\r
79\r
80 @return Buffer\r
81\r
82**/\r
83VOID *\r
84EFIAPI\r
85InternalMemSetMem16 (\r
86 OUT VOID *Buffer,\r
87 IN UINTN Length,\r
88 IN UINT16 Value\r
89 );\r
90\r
91/**\r
92 Fills a target buffer with a 32-bit value, and returns the target buffer.\r
93\r
94 @param Buffer Pointer to the target buffer to fill.\r
95 @param Length Number of bytes in Buffer to fill.\r
96 @param Value Value with which to fill Length bytes of Buffer.\r
97\r
98 @return Buffer\r
99\r
100**/\r
101VOID *\r
102EFIAPI\r
103InternalMemSetMem32 (\r
104 OUT VOID *Buffer,\r
105 IN UINTN Length,\r
106 IN UINT32 Value\r
107 );\r
108\r
109/**\r
110 Fills a target buffer with a 64-bit value, and returns the target buffer.\r
111\r
112 @param Buffer Pointer to the target buffer to fill.\r
113 @param Length Number of bytes in Buffer to fill.\r
114 @param Value Value with which to fill Length bytes of Buffer.\r
115\r
116 @return Buffer\r
117\r
118**/\r
119VOID *\r
120EFIAPI\r
121InternalMemSetMem64 (\r
122 OUT VOID *Buffer,\r
123 IN UINTN Length,\r
124 IN UINT64 Value\r
125 );\r
126\r
127/**\r
128 Set Buffer to 0 for Size bytes.\r
129\r
130 @param Buffer Memory to set.\r
42eedea9 131 @param Length Number of bytes to set\r
dd51a993 132\r
133 @return Buffer\r
134\r
135**/\r
136VOID *\r
137EFIAPI\r
138InternalMemZeroMem (\r
139 OUT VOID *Buffer,\r
140 IN UINTN Length\r
141 );\r
142\r
143/**\r
144 Compares two memory buffers of a given length.\r
145\r
146 @param DestinationBuffer First memory buffer\r
147 @param SourceBuffer Second memory buffer\r
148 @param Length Length of DestinationBuffer and SourceBuffer memory\r
149 regions to compare. Must be non-zero.\r
150\r
151 @retval 0 if MemOne == MemTwo\r
152\r
153**/\r
154INTN\r
155EFIAPI\r
156InternalMemCompareMem (\r
157 IN CONST VOID *DestinationBuffer,\r
158 IN CONST VOID *SourceBuffer,\r
159 IN UINTN Length\r
160 );\r
161\r
162/**\r
163 Scans a target buffer for an 8-bit value, and returns a pointer to the\r
164 matching 8-bit value in the target buffer.\r
165\r
166 @param Buffer Pointer to the target buffer to scan.\r
167 @param Length Number of bytes in Buffer to scan. Must be non-zero.\r
168 @param Value Value to search for in the target buffer.\r
169\r
170 @return Pointer to the first occurrence or NULL if not found.\r
171\r
172**/\r
173CONST VOID *\r
174EFIAPI\r
175InternalMemScanMem8 (\r
176 IN CONST VOID *Buffer,\r
177 IN UINTN Length,\r
178 IN UINT8 Value\r
179 );\r
180\r
181/**\r
182 Scans a target buffer for a 16-bit value, and returns a pointer to the\r
183 matching 16-bit value in the target buffer.\r
184\r
185 @param Buffer Pointer to the target buffer to scan.\r
186 @param Length Number of bytes in Buffer to scan. Must be non-zero.\r
187 @param Value Value to search for in the target buffer.\r
188\r
189 @return Pointer to the first occurrence or NULL if not found.\r
190\r
191**/\r
192CONST VOID *\r
193EFIAPI\r
194InternalMemScanMem16 (\r
195 IN CONST VOID *Buffer,\r
196 IN UINTN Length,\r
197 IN UINT16 Value\r
198 );\r
199\r
200/**\r
201 Scans a target buffer for a 32-bit value, and returns a pointer to the\r
202 matching 32-bit value in the target buffer.\r
203\r
204 @param Buffer Pointer to the target buffer to scan.\r
205 @param Length Number of bytes in Buffer to scan. Must be non-zero.\r
206 @param Value Value to search for in the target buffer.\r
207\r
208 @return Pointer to the first occurrence or NULL if not found.\r
209\r
210**/\r
211CONST VOID *\r
212EFIAPI\r
213InternalMemScanMem32 (\r
214 IN CONST VOID *Buffer,\r
215 IN UINTN Length,\r
216 IN UINT32 Value\r
217 );\r
218\r
219/**\r
220 Scans a target buffer for a 64-bit value, and returns a pointer to the\r
221 matching 64-bit value in the target buffer.\r
222\r
223 @param Buffer Pointer to the target buffer to scan.\r
224 @param Length Number of bytes in Buffer to scan. Must be non-zero.\r
225 @param Value Value to search for in the target buffer.\r
226\r
227 @return Pointer to the first occurrence or NULL if not found.\r
228\r
229**/\r
230CONST VOID *\r
231EFIAPI\r
232InternalMemScanMem64 (\r
233 IN CONST VOID *Buffer,\r
234 IN UINTN Length,\r
235 IN UINT64 Value\r
236 );\r
237\r
238#endif\r