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