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