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