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