]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Library/MemoryAllocationLib.h
2 Memory Allocation Library Services
4 Copyright (c) 2006, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 Module Name: MemoryAllocationLib.h
17 #ifndef __MEMORY_ALLOCATION_LIB_H__
18 #define __MEMORY_ALLOCATION_LIB_H__
21 Allocates the number of 4KB pages specified by Pages of type EfiBootServicesData.
23 @param Pages The number of 4 KB pages to allocate.
26 A pointer to the allocated buffer. The buffer returned is aligned on a 4KB boundary.
27 If Pages is 0, then NULL is returned.
28 If there is not enough memory remaining to satisfy the request, then NULL is returned.
39 Allocates the number of 4KB pages specified by Pages of type EfiRuntimeServicesData.
41 @param Pages The number of 4 KB pages to allocate.
44 A pointer to the allocated buffer. The buffer returned is aligned on a 4KB boundary.
45 If Pages is 0, then NULL is returned.
46 If there is not enough memory remaining to satisfy the request, then NULL is returned.
51 AllocateRuntimePages (
57 Allocates the number of 4KB pages specified by Pages of type EfiReservedMemoryType.
59 @param Pages The number of 4 KB pages to allocate.
62 A pointer to the allocated buffer. The buffer returned is aligned on a 4KB boundary.
63 If Pages is 0, then NULL is returned.
64 If there is not enough memory remaining to satisfy the request, then NULL is returned.
69 AllocateReservedPages (
75 Frees one or more 4KB pages that were previously allocated with
76 one of the page allocation functions in the Memory Allocation Library.
78 @param Buffer Pointer to the buffer of pages to free.
79 @param Pages The number of 4 KB pages to free.
93 Allocates the number of 4KB pages specified by Pages of type EfiBootServicesData with an alignment specified by Alignment.
95 @param Pages The number of 4 KB pages to allocate.
96 @param Alignment The requested alignment of the allocation. Must be a power of two.
97 If Alignment is zero, then byte alignment is used.
100 The allocated buffer is returned. If Pages is 0, then NULL is returned.
101 If there is not enough memory at the specified alignment remaining to satisfy the request, then NULL is returned.
106 AllocateAlignedPages (
113 Allocates the number of 4KB pages specified by Pages of type EfiRuntimeServicesData with an alignment specified by Alignment.
115 @param Pages The number of 4 KB pages to allocate.
116 @param Alignment The requested alignment of the allocation. Must be a power of two.
117 If Alignment is zero, then byte alignment is used.
120 The allocated buffer is returned. If Pages is 0, then NULL is returned.
121 If there is not enough memory at the specified alignment remaining to satisfy the request, then NULL is returned.
126 AllocateAlignedRuntimePages (
133 Allocates one or more 4KB pages of type EfiReservedMemoryType at a specified alignment.
135 @param Pages The number of 4 KB pages to allocate.
136 @param Alignment The requested alignment of the allocation. Must be a power of two.
137 If Alignment is zero, then byte alignment is used.
140 The allocated buffer is returned. If Pages is 0, then NULL is returned.
141 If there is not enough memory at the specified alignment remaining to satisfy the request, then NULL is returned.
146 AllocateAlignedReservedPages (
153 Frees one or more 4KB pages that were previously allocated with
154 one of the aligned page allocation functions in the Memory Allocation Library.
156 @param Buffer Pointer to the buffer of pages to free.
157 @param Pages The number of 4 KB pages to free.
171 Allocates a buffer of type EfiBootServicesData.
173 @param AllocationSize The number of bytes to allocate.
176 A pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned.
177 If there is not enough memory remaining to satisfy the request, then NULL is returned.
183 IN UINTN AllocationSize
188 Allocates a buffer of type EfiRuntimeServicesData.
190 @param AllocationSize The number of bytes to allocate.
193 A pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned.
194 If there is not enough memory remaining to satisfy the request, then NULL is returned.
199 AllocateRuntimePool (
200 IN UINTN AllocationSize
205 Allocates a buffer of type EfiReservedMemoryType.
207 @param AllocationSize The number of bytes to allocate.
210 A pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned.
211 If there is not enough memory remaining to satisfy the request, then NULL is returned.
216 AllocateReservedPool (
217 IN UINTN AllocationSize
222 Allocates and zeros a buffer of type EfiBootServicesData.
224 @param AllocationSize The number of bytes to allocate and zero.
227 A pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned.
228 If there is not enough memory remaining to satisfy the request, then NULL is returned.
234 IN UINTN AllocationSize
239 Allocates and zeros a buffer of type EfiRuntimeServicesData.
241 @param AllocationSize The number of bytes to allocate and zero.
244 A pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned.
245 If there is not enough memory remaining to satisfy the request, then NULL is returned.
250 AllocateRuntimeZeroPool (
251 IN UINTN AllocationSize
256 Allocates and zeros a buffer of type EfiReservedMemoryType.
258 @param AllocationSize The number of bytes to allocate and zero.
261 A pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned.
262 If there is not enough memory remaining to satisfy the request, then NULL is returned.
267 AllocateReservedZeroPool (
268 IN UINTN AllocationSize
273 Copies a buffer to an allocated buffer of type EfiBootServicesData.
275 @param AllocationSize The number of bytes to allocate.
276 @param Buffer The buffer to copy to the allocated buffer.
279 A pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned.
280 If there is not enough memory remaining to satisfy the request, then NULL is returned.
286 IN UINTN AllocationSize
,
287 IN CONST VOID
*Buffer
292 Copies a buffer to an allocated buffer of type EfiRuntimeServicesData.
294 @param AllocationSize The number of bytes to allocate.
295 @param Buffer The buffer to copy to the allocated buffer.
298 A pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned.
299 If there is not enough memory remaining to satisfy the request, then NULL is returned.
304 AllocateRuntimeCopyPool (
305 IN UINTN AllocationSize
,
306 IN CONST VOID
*Buffer
311 Copies a buffer to an allocated buffer of type EfiReservedMemoryType.
313 @param AllocationSize The number of bytes to allocate.
314 @param Buffer The buffer to copy to the allocated buffer.
317 A pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned.
318 If there is not enough memory remaining to satisfy the request, then NULL is returned.
323 AllocateReservedCopyPool (
324 IN UINTN AllocationSize
,
325 IN CONST VOID
*Buffer
330 Frees a buffer that was previously allocated with one of the pool allocation functions
331 in the Memory Allocation Library.
333 @param Buffer Pointer to the buffer to free.
346 Allocates a buffer of type EfiBootServicesData at a specified alignment.
348 @param AllocationSize The number of bytes to allocate.
349 @param Alignment The requested alignment of the allocation. Must be a power of two.
350 If Alignment is zero, then byte alignment is used.
353 A pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned.
354 If there is not enough memory remaining to satisfy the request, then NULL is returned.
359 AllocateAlignedPool (
360 IN UINTN AllocationSize
,
366 Allocates a buffer of type EfiRuntimeServicesData at a specified alignment.
368 @param AllocationSize The number of bytes to allocate.
369 @param Alignment The requested alignment of the allocation. Must be a power of two.
370 If Alignment is zero, then byte alignment is used.
373 A pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned.
374 If there is not enough memory remaining to satisfy the request, then NULL is returned.
379 AllocateAlignedRuntimePool (
380 IN UINTN AllocationSize
,
386 Allocates a buffer of type EfiReservedMemoryType at a specified alignment.
388 @param AllocationSize The number of bytes to allocate.
389 @param Alignment The requested alignment of the allocation. Must be a power of two.
390 If Alignment is zero, then byte alignment is used.
393 A pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned.
394 If there is not enough memory remaining to satisfy the request, then NULL is returned.
399 AllocateAlignedReservedPool (
400 IN UINTN AllocationSize
,
406 Allocates and zeros a buffer of type EfiBootServicesData at a specified alignment.
408 @param AllocationSize The number of bytes to allocate.
409 @param Alignment The requested alignment of the allocation. Must be a power of two.
410 If Alignment is zero, then byte alignment is used.
413 A pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned.
414 If there is not enough memory remaining to satisfy the request, then NULL is returned.
419 AllocateAlignedZeroPool (
420 IN UINTN AllocationSize
,
426 Allocates and zeros a buffer of type EfiRuntimeServicesData at a specified alignment.
428 @param AllocationSize The number of bytes to allocate.
429 @param Alignment The requested alignment of the allocation. Must be a power of two.
430 If Alignment is zero, then byte alignment is used.
433 A pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned.
434 If there is not enough memory remaining to satisfy the request, then NULL is returned.
439 AllocateAlignedRuntimeZeroPool (
440 IN UINTN AllocationSize
,
446 Allocates and zeros a buffer of type EfiReservedMemoryType at a specified alignment.
448 @param AllocationSize The number of bytes to allocate.
449 @param Alignment The requested alignment of the allocation. Must be a power of two.
450 If Alignment is zero, then byte alignment is used.
453 A pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned.
454 If there is not enough memory remaining to satisfy the request, then NULL is returned.
459 AllocateAlignedReservedZeroPool (
460 IN UINTN AllocationSize
,
466 Copies a buffer to an allocated buffer of type EfiBootServicesData at a specified alignment.
468 @param AllocationSize The number of bytes to allocate.
469 @param Buffer The buffer to copy to the allocated buffer.
470 @param Alignment The requested alignment of the allocation. Must be a power of two.
471 If Alignment is zero, then byte alignment is used.
474 A pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned.
475 If there is not enough memory remaining to satisfy the request, then NULL is returned.
480 AllocateAlignedCopyPool (
481 IN UINTN AllocationSize
,
482 IN CONST VOID
*Buffer
,
488 Copies a buffer to an allocated buffer of type EfiRuntimeServicesData at a specified alignment.
490 @param AllocationSize The number of bytes to allocate.
491 @param Buffer The buffer to copy to the allocated buffer.
492 @param Alignment The requested alignment of the allocation. Must be a power of two.
493 If Alignment is zero, then byte alignment is used.
496 A pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned.
497 If there is not enough memory remaining to satisfy the request, then NULL is returned.
502 AllocateAlignedRuntimeCopyPool (
503 IN UINTN AllocationSize
,
504 IN CONST VOID
*Buffer
,
510 Copies a buffer to an allocated buffer of type EfiReservedMemoryType at a specified alignment.
512 @param AllocationSize The number of bytes to allocate.
513 @param Buffer The buffer to copy to the allocated buffer.
514 @param Alignment The requested alignment of the allocation. Must be a power of two.
515 If Alignment is zero, then byte alignment is used.
518 A pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned.
519 If there is not enough memory remaining to satisfy the request, then NULL is returned.
524 AllocateAlignedReservedCopyPool (
525 IN UINTN AllocationSize
,
526 IN CONST VOID
*Buffer
,
532 Frees a buffer that was previously allocated with one of the aligned pool allocation functions
533 in the Memory Allocation Library.
535 @param Buffer Pointer to the buffer to free.