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