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