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