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