]>
Commit | Line | Data |
---|---|---|
24dbeca9 AB |
1 | /** @file\r |
2 | Dummy support routines for memory allocation\r | |
3 | \r | |
4 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r | |
5 | Copyright (c) 2018, Linaro, Ltd. All rights reserved.<BR>\r | |
6 | This program and the accompanying materials\r | |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php.\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | \r | |
16 | \r | |
17 | #include <Uefi/UefiBaseType.h>\r | |
18 | \r | |
19 | #include <Library/DebugLib.h>\r | |
20 | #include <Library/MemoryAllocationLib.h>\r | |
21 | \r | |
22 | \r | |
23 | /**\r | |
24 | Allocates one or more 4KB pages of type EfiBootServicesData.\r | |
25 | \r | |
26 | Allocates the number of 4KB pages of type EfiBootServicesData and returns a pointer to the\r | |
27 | allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL\r | |
28 | is returned. If there is not enough memory remaining to satisfy the request, then NULL is\r | |
29 | returned.\r | |
30 | \r | |
31 | @param Pages The number of 4 KB pages to allocate.\r | |
32 | \r | |
33 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
34 | \r | |
35 | **/\r | |
36 | VOID *\r | |
37 | EFIAPI\r | |
38 | AllocatePages (\r | |
39 | IN UINTN Pages\r | |
40 | )\r | |
41 | {\r | |
42 | ASSERT (FALSE);\r | |
43 | return NULL;\r | |
44 | }\r | |
45 | \r | |
46 | /**\r | |
47 | Allocates one or more 4KB pages of type EfiRuntimeServicesData.\r | |
48 | \r | |
49 | Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns a pointer to the\r | |
50 | allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL\r | |
51 | is returned. If there is not enough memory remaining to satisfy the request, then NULL is\r | |
52 | returned.\r | |
53 | \r | |
54 | @param Pages The number of 4 KB pages to allocate.\r | |
55 | \r | |
56 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
57 | \r | |
58 | **/\r | |
59 | VOID *\r | |
60 | EFIAPI\r | |
61 | AllocateRuntimePages (\r | |
62 | IN UINTN Pages\r | |
63 | )\r | |
64 | {\r | |
65 | ASSERT (FALSE);\r | |
66 | return NULL;\r | |
67 | }\r | |
68 | \r | |
69 | /**\r | |
70 | Allocates one or more 4KB pages of type EfiReservedMemoryType.\r | |
71 | \r | |
72 | Allocates the number of 4KB pages of type EfiReservedMemoryType and returns a pointer to the\r | |
73 | allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL\r | |
74 | is returned. If there is not enough memory remaining to satisfy the request, then NULL is\r | |
75 | returned.\r | |
76 | \r | |
77 | @param Pages The number of 4 KB pages to allocate.\r | |
78 | \r | |
79 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
80 | \r | |
81 | **/\r | |
82 | VOID *\r | |
83 | EFIAPI\r | |
84 | AllocateReservedPages (\r | |
85 | IN UINTN Pages\r | |
86 | )\r | |
87 | {\r | |
88 | ASSERT (FALSE);\r | |
89 | return NULL;\r | |
90 | }\r | |
91 | \r | |
92 | /**\r | |
93 | Frees one or more 4KB pages that were previously allocated with one of the page allocation\r | |
94 | functions in the Memory Allocation Library.\r | |
95 | \r | |
96 | Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer\r | |
97 | must have been allocated on a previous call to the page allocation services of the Memory\r | |
98 | Allocation Library. If it is not possible to free allocated pages, then this function will\r | |
99 | perform no actions.\r | |
100 | \r | |
101 | If Buffer was not allocated with a page allocation function in the Memory Allocation Library,\r | |
102 | then ASSERT().\r | |
103 | If Pages is zero, then ASSERT().\r | |
104 | \r | |
105 | @param Buffer The pointer to the buffer of pages to free.\r | |
106 | @param Pages The number of 4 KB pages to free.\r | |
107 | \r | |
108 | **/\r | |
109 | VOID\r | |
110 | EFIAPI\r | |
111 | FreePages (\r | |
112 | IN VOID *Buffer,\r | |
113 | IN UINTN Pages\r | |
114 | )\r | |
115 | {\r | |
116 | ASSERT (FALSE);\r | |
117 | }\r | |
118 | \r | |
119 | /**\r | |
120 | Allocates one or more 4KB pages of type EfiBootServicesData at a specified alignment.\r | |
121 | \r | |
122 | Allocates the number of 4KB pages specified by Pages of type EfiBootServicesData with an\r | |
123 | alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is\r | |
124 | returned. If there is not enough memory at the specified alignment remaining to satisfy the\r | |
125 | request, then NULL is returned.\r | |
126 | \r | |
127 | If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r | |
128 | If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT().\r | |
129 | \r | |
130 | @param Pages The number of 4 KB pages to allocate.\r | |
131 | @param Alignment The requested alignment of the allocation.\r | |
132 | Must be a power of two.\r | |
133 | If Alignment is zero, then byte alignment is used.\r | |
134 | \r | |
135 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
136 | \r | |
137 | **/\r | |
138 | VOID *\r | |
139 | EFIAPI\r | |
140 | AllocateAlignedPages (\r | |
141 | IN UINTN Pages,\r | |
142 | IN UINTN Alignment\r | |
143 | )\r | |
144 | {\r | |
145 | ASSERT (FALSE);\r | |
146 | return NULL;\r | |
147 | }\r | |
148 | \r | |
149 | /**\r | |
150 | Allocates one or more 4KB pages of type EfiRuntimeServicesData at a specified alignment.\r | |
151 | \r | |
152 | Allocates the number of 4KB pages specified by Pages of type EfiRuntimeServicesData with an\r | |
153 | alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is\r | |
154 | returned. If there is not enough memory at the specified alignment remaining to satisfy the\r | |
155 | request, then NULL is returned.\r | |
156 | \r | |
157 | If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r | |
158 | If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT().\r | |
159 | \r | |
160 | @param Pages The number of 4 KB pages to allocate.\r | |
161 | @param Alignment The requested alignment of the allocation.\r | |
162 | Must be a power of two.\r | |
163 | If Alignment is zero, then byte alignment is used.\r | |
164 | \r | |
165 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
166 | \r | |
167 | **/\r | |
168 | VOID *\r | |
169 | EFIAPI\r | |
170 | AllocateAlignedRuntimePages (\r | |
171 | IN UINTN Pages,\r | |
172 | IN UINTN Alignment\r | |
173 | )\r | |
174 | {\r | |
175 | ASSERT (FALSE);\r | |
176 | return NULL;\r | |
177 | }\r | |
178 | \r | |
179 | /**\r | |
180 | Allocates one or more 4KB pages of type EfiReservedMemoryType at a specified alignment.\r | |
181 | \r | |
182 | Allocates the number of 4KB pages specified by Pages of type EfiReservedMemoryType with an\r | |
183 | alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is\r | |
184 | returned. If there is not enough memory at the specified alignment remaining to satisfy the\r | |
185 | request, then NULL is returned.\r | |
186 | \r | |
187 | If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r | |
188 | If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT().\r | |
189 | \r | |
190 | @param Pages The number of 4 KB pages to allocate.\r | |
191 | @param Alignment The requested alignment of the allocation.\r | |
192 | Must be a power of two.\r | |
193 | If Alignment is zero, then byte alignment is used.\r | |
194 | \r | |
195 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
196 | \r | |
197 | **/\r | |
198 | VOID *\r | |
199 | EFIAPI\r | |
200 | AllocateAlignedReservedPages (\r | |
201 | IN UINTN Pages,\r | |
202 | IN UINTN Alignment\r | |
203 | )\r | |
204 | {\r | |
205 | ASSERT (FALSE);\r | |
206 | return NULL;\r | |
207 | }\r | |
208 | \r | |
209 | /**\r | |
210 | Frees one or more 4KB pages that were previously allocated with one of the aligned page\r | |
211 | allocation functions in the Memory Allocation Library.\r | |
212 | \r | |
213 | Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer\r | |
214 | must have been allocated on a previous call to the aligned page allocation services of the Memory\r | |
215 | Allocation Library. If it is not possible to free allocated pages, then this function will\r | |
216 | perform no actions.\r | |
217 | \r | |
218 | If Buffer was not allocated with an aligned page allocation function in the Memory Allocation\r | |
219 | Library, then ASSERT().\r | |
220 | If Pages is zero, then ASSERT().\r | |
221 | \r | |
222 | @param Buffer The pointer to the buffer of pages to free.\r | |
223 | @param Pages The number of 4 KB pages to free.\r | |
224 | \r | |
225 | **/\r | |
226 | VOID\r | |
227 | EFIAPI\r | |
228 | FreeAlignedPages (\r | |
229 | IN VOID *Buffer,\r | |
230 | IN UINTN Pages\r | |
231 | )\r | |
232 | {\r | |
233 | ASSERT (FALSE);\r | |
234 | }\r | |
235 | \r | |
236 | /**\r | |
237 | Allocates a buffer of type EfiBootServicesData.\r | |
238 | \r | |
239 | Allocates the number bytes specified by AllocationSize of type EfiBootServicesData and returns a\r | |
240 | pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is\r | |
241 | returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.\r | |
242 | \r | |
243 | @param AllocationSize The number of bytes to allocate.\r | |
244 | \r | |
245 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
246 | \r | |
247 | **/\r | |
248 | VOID *\r | |
249 | EFIAPI\r | |
250 | AllocatePool (\r | |
251 | IN UINTN AllocationSize\r | |
252 | )\r | |
253 | {\r | |
254 | ASSERT (FALSE);\r | |
255 | return NULL;\r | |
256 | }\r | |
257 | \r | |
258 | /**\r | |
259 | Allocates a buffer of type EfiRuntimeServicesData.\r | |
260 | \r | |
261 | Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData and returns\r | |
262 | a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is\r | |
263 | returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.\r | |
264 | \r | |
265 | @param AllocationSize The number of bytes to allocate.\r | |
266 | \r | |
267 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
268 | \r | |
269 | **/\r | |
270 | VOID *\r | |
271 | EFIAPI\r | |
272 | AllocateRuntimePool (\r | |
273 | IN UINTN AllocationSize\r | |
274 | )\r | |
275 | {\r | |
276 | ASSERT (FALSE);\r | |
277 | return NULL;\r | |
278 | }\r | |
279 | \r | |
280 | /**\r | |
281 | Allocates a buffer of type EfiReservedMemoryType.\r | |
282 | \r | |
283 | Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType and returns\r | |
284 | a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is\r | |
285 | returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.\r | |
286 | \r | |
287 | @param AllocationSize The number of bytes to allocate.\r | |
288 | \r | |
289 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
290 | \r | |
291 | **/\r | |
292 | VOID *\r | |
293 | EFIAPI\r | |
294 | AllocateReservedPool (\r | |
295 | IN UINTN AllocationSize\r | |
296 | )\r | |
297 | {\r | |
298 | ASSERT (FALSE);\r | |
299 | return NULL;\r | |
300 | }\r | |
301 | \r | |
302 | /**\r | |
303 | Allocates and zeros a buffer of type EfiBootServicesData.\r | |
304 | \r | |
305 | Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, clears the\r | |
306 | buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a\r | |
307 | valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the\r | |
308 | request, then NULL is returned.\r | |
309 | \r | |
310 | @param AllocationSize The number of bytes to allocate and zero.\r | |
311 | \r | |
312 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
313 | \r | |
314 | **/\r | |
315 | VOID *\r | |
316 | EFIAPI\r | |
317 | AllocateZeroPool (\r | |
318 | IN UINTN AllocationSize\r | |
319 | )\r | |
320 | {\r | |
321 | ASSERT (FALSE);\r | |
322 | return NULL;\r | |
323 | }\r | |
324 | \r | |
325 | /**\r | |
326 | Allocates and zeros a buffer of type EfiRuntimeServicesData.\r | |
327 | \r | |
328 | Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, clears the\r | |
329 | buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a\r | |
330 | valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the\r | |
331 | request, then NULL is returned.\r | |
332 | \r | |
333 | @param AllocationSize The number of bytes to allocate and zero.\r | |
334 | \r | |
335 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
336 | \r | |
337 | **/\r | |
338 | VOID *\r | |
339 | EFIAPI\r | |
340 | AllocateRuntimeZeroPool (\r | |
341 | IN UINTN AllocationSize\r | |
342 | )\r | |
343 | {\r | |
344 | ASSERT (FALSE);\r | |
345 | return NULL;\r | |
346 | }\r | |
347 | \r | |
348 | /**\r | |
349 | Allocates and zeros a buffer of type EfiReservedMemoryType.\r | |
350 | \r | |
351 | Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType, clears the\r | |
352 | buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a\r | |
353 | valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the\r | |
354 | request, then NULL is returned.\r | |
355 | \r | |
356 | @param AllocationSize The number of bytes to allocate and zero.\r | |
357 | \r | |
358 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
359 | \r | |
360 | **/\r | |
361 | VOID *\r | |
362 | EFIAPI\r | |
363 | AllocateReservedZeroPool (\r | |
364 | IN UINTN AllocationSize\r | |
365 | )\r | |
366 | {\r | |
367 | ASSERT (FALSE);\r | |
368 | return NULL;\r | |
369 | }\r | |
370 | \r | |
371 | /**\r | |
372 | Copies a buffer to an allocated buffer of type EfiBootServicesData.\r | |
373 | \r | |
374 | Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, copies\r | |
375 | AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the\r | |
376 | allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there\r | |
377 | is not enough memory remaining to satisfy the request, then NULL is returned.\r | |
378 | \r | |
379 | If Buffer is NULL, then ASSERT().\r | |
380 | If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r | |
381 | \r | |
382 | @param AllocationSize The number of bytes to allocate and zero.\r | |
383 | @param Buffer The buffer to copy to the allocated buffer.\r | |
384 | \r | |
385 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
386 | \r | |
387 | **/\r | |
388 | VOID *\r | |
389 | EFIAPI\r | |
390 | AllocateCopyPool (\r | |
391 | IN UINTN AllocationSize,\r | |
392 | IN CONST VOID *Buffer\r | |
393 | )\r | |
394 | {\r | |
395 | ASSERT (FALSE);\r | |
396 | return NULL;\r | |
397 | }\r | |
398 | \r | |
399 | /**\r | |
400 | Copies a buffer to an allocated buffer of type EfiRuntimeServicesData.\r | |
401 | \r | |
402 | Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, copies\r | |
403 | AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the\r | |
404 | allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there\r | |
405 | is not enough memory remaining to satisfy the request, then NULL is returned.\r | |
406 | \r | |
407 | If Buffer is NULL, then ASSERT().\r | |
408 | If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r | |
409 | \r | |
410 | @param AllocationSize The number of bytes to allocate and zero.\r | |
411 | @param Buffer The buffer to copy to the allocated buffer.\r | |
412 | \r | |
413 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
414 | \r | |
415 | **/\r | |
416 | VOID *\r | |
417 | EFIAPI\r | |
418 | AllocateRuntimeCopyPool (\r | |
419 | IN UINTN AllocationSize,\r | |
420 | IN CONST VOID *Buffer\r | |
421 | )\r | |
422 | {\r | |
423 | ASSERT (FALSE);\r | |
424 | return NULL;\r | |
425 | }\r | |
426 | \r | |
427 | /**\r | |
428 | Copies a buffer to an allocated buffer of type EfiReservedMemoryType.\r | |
429 | \r | |
430 | Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType, copies\r | |
431 | AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the\r | |
432 | allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there\r | |
433 | is not enough memory remaining to satisfy the request, then NULL is returned.\r | |
434 | \r | |
435 | If Buffer is NULL, then ASSERT().\r | |
436 | If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r | |
437 | \r | |
438 | @param AllocationSize The number of bytes to allocate and zero.\r | |
439 | @param Buffer The buffer to copy to the allocated buffer.\r | |
440 | \r | |
441 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
442 | \r | |
443 | **/\r | |
444 | VOID *\r | |
445 | EFIAPI\r | |
446 | AllocateReservedCopyPool (\r | |
447 | IN UINTN AllocationSize,\r | |
448 | IN CONST VOID *Buffer\r | |
449 | )\r | |
450 | {\r | |
451 | ASSERT (FALSE);\r | |
452 | return NULL;\r | |
453 | }\r | |
454 | \r | |
455 | /**\r | |
456 | Reallocates a buffer of type EfiBootServicesData.\r | |
457 | \r | |
458 | Allocates and zeros the number bytes specified by NewSize from memory of type\r | |
459 | EfiBootServicesData. If OldBuffer is not NULL, then the smaller of OldSize and\r | |
460 | NewSize bytes are copied from OldBuffer to the newly allocated buffer, and\r | |
461 | OldBuffer is freed. A pointer to the newly allocated buffer is returned.\r | |
462 | If NewSize is 0, then a valid buffer of 0 size is returned. If there is not\r | |
463 | enough memory remaining to satisfy the request, then NULL is returned.\r | |
464 | \r | |
465 | If the allocation of the new buffer is successful and the smaller of NewSize and OldSize\r | |
466 | is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().\r | |
467 | \r | |
468 | @param OldSize The size, in bytes, of OldBuffer.\r | |
469 | @param NewSize The size, in bytes, of the buffer to reallocate.\r | |
470 | @param OldBuffer The buffer to copy to the allocated buffer. This is an optional\r | |
471 | parameter that may be NULL.\r | |
472 | \r | |
473 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
474 | \r | |
475 | **/\r | |
476 | VOID *\r | |
477 | EFIAPI\r | |
478 | ReallocatePool (\r | |
479 | IN UINTN OldSize,\r | |
480 | IN UINTN NewSize,\r | |
481 | IN VOID *OldBuffer OPTIONAL\r | |
482 | )\r | |
483 | {\r | |
484 | ASSERT (FALSE);\r | |
485 | return NULL;\r | |
486 | }\r | |
487 | \r | |
488 | /**\r | |
489 | Reallocates a buffer of type EfiRuntimeServicesData.\r | |
490 | \r | |
491 | Allocates and zeros the number bytes specified by NewSize from memory of type\r | |
492 | EfiRuntimeServicesData. If OldBuffer is not NULL, then the smaller of OldSize and\r | |
493 | NewSize bytes are copied from OldBuffer to the newly allocated buffer, and\r | |
494 | OldBuffer is freed. A pointer to the newly allocated buffer is returned.\r | |
495 | If NewSize is 0, then a valid buffer of 0 size is returned. If there is not\r | |
496 | enough memory remaining to satisfy the request, then NULL is returned.\r | |
497 | \r | |
498 | If the allocation of the new buffer is successful and the smaller of NewSize and OldSize\r | |
499 | is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().\r | |
500 | \r | |
501 | @param OldSize The size, in bytes, of OldBuffer.\r | |
502 | @param NewSize The size, in bytes, of the buffer to reallocate.\r | |
503 | @param OldBuffer The buffer to copy to the allocated buffer. This is an optional\r | |
504 | parameter that may be NULL.\r | |
505 | \r | |
506 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
507 | \r | |
508 | **/\r | |
509 | VOID *\r | |
510 | EFIAPI\r | |
511 | ReallocateRuntimePool (\r | |
512 | IN UINTN OldSize,\r | |
513 | IN UINTN NewSize,\r | |
514 | IN VOID *OldBuffer OPTIONAL\r | |
515 | )\r | |
516 | {\r | |
517 | ASSERT (FALSE);\r | |
518 | return NULL;\r | |
519 | }\r | |
520 | \r | |
521 | /**\r | |
522 | Reallocates a buffer of type EfiReservedMemoryType.\r | |
523 | \r | |
524 | Allocates and zeros the number bytes specified by NewSize from memory of type\r | |
525 | EfiReservedMemoryType. If OldBuffer is not NULL, then the smaller of OldSize and\r | |
526 | NewSize bytes are copied from OldBuffer to the newly allocated buffer, and\r | |
527 | OldBuffer is freed. A pointer to the newly allocated buffer is returned.\r | |
528 | If NewSize is 0, then a valid buffer of 0 size is returned. If there is not\r | |
529 | enough memory remaining to satisfy the request, then NULL is returned.\r | |
530 | \r | |
531 | If the allocation of the new buffer is successful and the smaller of NewSize and OldSize\r | |
532 | is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().\r | |
533 | \r | |
534 | @param OldSize The size, in bytes, of OldBuffer.\r | |
535 | @param NewSize The size, in bytes, of the buffer to reallocate.\r | |
536 | @param OldBuffer The buffer to copy to the allocated buffer. This is an\r | |
537 | optional parameter that may be NULL.\r | |
538 | \r | |
539 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
540 | \r | |
541 | **/\r | |
542 | VOID *\r | |
543 | EFIAPI\r | |
544 | ReallocateReservedPool (\r | |
545 | IN UINTN OldSize,\r | |
546 | IN UINTN NewSize,\r | |
547 | IN VOID *OldBuffer OPTIONAL\r | |
548 | )\r | |
549 | {\r | |
550 | ASSERT (FALSE);\r | |
551 | return NULL;\r | |
552 | }\r | |
553 | \r | |
554 | /**\r | |
555 | Frees a buffer that was previously allocated with one of the pool allocation functions in the\r | |
556 | Memory Allocation Library.\r | |
557 | \r | |
558 | Frees the buffer specified by Buffer. Buffer must have been allocated on a previous call to the\r | |
559 | pool allocation services of the Memory Allocation Library. If it is not possible to free pool\r | |
560 | resources, then this function will perform no actions.\r | |
561 | \r | |
562 | If Buffer was not allocated with a pool allocation function in the Memory Allocation Library,\r | |
563 | then ASSERT().\r | |
564 | \r | |
565 | @param Buffer The pointer to the buffer to free.\r | |
566 | \r | |
567 | **/\r | |
568 | VOID\r | |
569 | EFIAPI\r | |
570 | FreePool (\r | |
571 | IN VOID *Buffer\r | |
572 | )\r | |
573 | {\r | |
574 | ASSERT (FALSE);\r | |
575 | }\r |