- @return A pointer to the allocated buffer or NULL if allocation fails.\r
-\r
-**/\r
-VOID *\r
-InternalAllocateAlignedCopyPool (\r
- IN EFI_MEMORY_TYPE PoolType,\r
- IN UINTN AllocationSize,\r
- IN CONST VOID *Buffer,\r
- IN UINTN Alignment\r
- )\r
-{\r
- VOID *Memory;\r
- \r
- ASSERT (Buffer != NULL);\r
- ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN) Buffer + 1));\r
-\r
- Memory = InternalAllocateAlignedPool (PoolType, AllocationSize, Alignment);\r
- if (Memory != NULL) {\r
- Memory = CopyMem (Memory, Buffer, AllocationSize);\r
- }\r
- return Memory;\r
-}\r
-\r
-/**\r
- Copies a buffer to an allocated buffer of type EfiBootServicesData at a specified alignment.\r
-\r
- Allocates the number bytes specified by AllocationSize of type EfiBootServicesData type with an\r
- alignment specified by Alignment. The allocated buffer is returned. If AllocationSize is 0,\r
- then a valid buffer of 0 size is returned. If there is not enough memory at the specified\r
- alignment remaining to satisfy the request, then NULL is returned.\r
- If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r
-\r
- @param AllocationSize The number of bytes to allocate.\r
- @param Buffer The buffer to copy to the allocated buffer.\r
- @param Alignment The requested alignment of the allocation. Must be a power of two.\r
- If Alignment is zero, then byte alignment is used.\r
-\r
- @return A pointer to the allocated buffer or NULL if allocation fails.\r
-\r
-**/\r
-VOID *\r
-EFIAPI\r
-AllocateAlignedCopyPool (\r
- IN UINTN AllocationSize,\r
- IN CONST VOID *Buffer,\r
- IN UINTN Alignment\r
- )\r
-{\r
- VOID *Memory;\r
- \r
- ASSERT (Buffer != NULL);\r
- ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN) Buffer + 1));\r
-\r
- Memory = AllocateAlignedPool (AllocationSize, Alignment);\r
- if (Memory != NULL) {\r
- Memory = CopyMem (Memory, Buffer, AllocationSize);\r
- }\r
- return Memory;\r
-}\r
-\r
-/**\r
- Copies a buffer to an allocated buffer of type EfiRuntimeServicesData at a specified alignment.\r
-\r
- Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData type with an\r
- alignment specified by Alignment. The allocated buffer is returned. If AllocationSize is 0,\r
- then a valid buffer of 0 size is returned. If there is not enough memory at the specified\r
- alignment remaining to satisfy the request, then NULL is returned.\r
- If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r
-\r
- @param AllocationSize The number of bytes to allocate.\r
- @param Buffer The buffer to copy to the allocated buffer.\r
- @param Alignment The requested alignment of the allocation. Must be a power of two.\r
- If Alignment is zero, then byte alignment is used.\r
-\r
- @return A pointer to the allocated buffer or NULL if allocation fails.\r
-\r
-**/\r
-VOID *\r
-EFIAPI\r
-AllocateAlignedRuntimeCopyPool (\r
- IN UINTN AllocationSize,\r
- IN CONST VOID *Buffer,\r
- IN UINTN Alignment\r
- )\r
-{\r
- return InternalAllocateAlignedCopyPool (EfiRuntimeServicesData, AllocationSize, Buffer, Alignment);\r
-}\r
-\r
-/**\r
- Copies a buffer to an allocated buffer of type EfiReservedMemoryType at a specified alignment.\r
-\r
- Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType type with an\r
- alignment specified by Alignment. The allocated buffer is returned. If AllocationSize is 0,\r
- then a valid buffer of 0 size is returned. If there is not enough memory at the specified\r
- alignment remaining to satisfy the request, then NULL is returned.\r
- If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r
-\r
- @param AllocationSize The number of bytes to allocate.\r
- @param Buffer The buffer to copy to the allocated buffer.\r
- @param Alignment The requested alignment of the allocation. Must be a power of two.\r
- If Alignment is zero, then byte alignment is used.\r