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