Changeset 58466 in vbox for trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/SmmMemoryAllocationLib
- Timestamp:
- Oct 29, 2015 4:30:44 AM (9 years ago)
- Location:
- trunk/src/VBox/Devices/EFI/Firmware
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/Firmware
- Property svn:mergeinfo changed
/vendor/edk2/current merged: 103769-103776
- Property svn:mergeinfo changed
-
trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/SmmMemoryAllocationLib/MemoryAllocationLib.c
r58459 r58466 1 1 /** @file 2 Support routines for memory allocation routines based 2 Support routines for memory allocation routines based 3 3 on SMM Services Table services for SMM phase drivers. 4 4 5 5 The PI System Management Mode Core Interface Specification only allows the use 6 of EfiRuntimeServicesCode and EfiRuntimeServicesData memory types for memory 7 allocations through the SMM Services Table. The functions in the Memory 6 of EfiRuntimeServicesCode and EfiRuntimeServicesData memory types for memory 7 allocations through the SMM Services Table. The functions in the Memory 8 8 Allocation Library use EfiBootServicesData as the default memory allocation 9 type. For this SMM specific instance of the Memory Allocation Library, 9 type. For this SMM specific instance of the Memory Allocation Library, 10 10 EfiRuntimeServicesData is used as the default memory type for all allocations. 11 In addition, allocation for the Reserved memory types are not supported and 11 In addition, allocation for the Reserved memory types are not supported and 12 12 will always return NULL. 13 13 14 14 Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR> 15 This program and the accompanying materials 16 are licensed and made available under the terms and conditions of the BSD License 17 which accompanies this distribution. The full text of the license may be found at 18 http://opensource.org/licenses/bsd-license.php. 19 20 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 21 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 15 This program and the accompanying materials 16 are licensed and made available under the terms and conditions of the BSD License 17 which accompanies this distribution. The full text of the license may be found at 18 http://opensource.org/licenses/bsd-license.php. 19 20 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 21 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 22 22 23 23 **/ … … 37 37 /** 38 38 The constructor function caches SMRAM ranges that are present in the system. 39 39 40 40 It will ASSERT() if SMM Access2 Protocol doesn't exist. 41 41 It will ASSERT() if SMRAM ranges can't be got. 42 It will ASSERT() if Resource can't be allocated for cache SMRAM range. 42 It will ASSERT() if Resource can't be allocated for cache SMRAM range. 43 43 It will always return EFI_SUCCESS. 44 44 … … 64 64 // 65 65 Status = gBS->LocateProtocol ( 66 &gEfiSmmAccess2ProtocolGuid, 67 NULL, 66 &gEfiSmmAccess2ProtocolGuid, 67 NULL, 68 68 (VOID **)&SmmAccess 69 69 ); … … 89 89 90 90 /** 91 If SMM driver exits with an error, it must call this routine 91 If SMM driver exits with an error, it must call this routine 92 92 to free the allocated resource before the exiting. 93 93 … … 126 126 127 127 for (Index = 0; Index < mSmramRangeCount; Index ++) { 128 if (((EFI_PHYSICAL_ADDRESS) (UINTN) Buffer >= mSmramRanges[Index].CpuStart) && 128 if (((EFI_PHYSICAL_ADDRESS) (UINTN) Buffer >= mSmramRanges[Index].CpuStart) && 129 129 ((EFI_PHYSICAL_ADDRESS) (UINTN) Buffer < (mSmramRanges[Index].CpuStart + mSmramRanges[Index].PhysicalSize))) { 130 130 return TRUE; … … 138 138 Allocates one or more 4KB pages of a certain memory type. 139 139 140 Allocates the number of 4KB pages of a certain memory type and returns a pointer 141 to the allocated buffer. The buffer returned is aligned on a 4KB boundary. If 142 Pages is 0, then NULL is returned. If there is not enough memory remaining to 140 Allocates the number of 4KB pages of a certain memory type and returns a pointer 141 to the allocated buffer. The buffer returned is aligned on a 4KB boundary. If 142 Pages is 0, then NULL is returned. If there is not enough memory remaining to 143 143 satisfy the request, then NULL is returned. 144 144 … … 151 151 VOID * 152 152 InternalAllocatePages ( 153 IN EFI_MEMORY_TYPE MemoryType, 153 IN EFI_MEMORY_TYPE MemoryType, 154 154 IN UINTN Pages 155 155 ) 156 156 { 157 157 EFI_STATUS Status; 158 EFI_PHYSICAL_ADDRESS Memory; 158 EFI_PHYSICAL_ADDRESS Memory; 159 159 160 160 if (Pages == 0) { … … 172 172 Allocates one or more 4KB pages of type EfiBootServicesData. 173 173 174 Allocates the number of 4KB pages of type EfiBootServicesData and returns a pointer 175 to the allocated buffer. The buffer returned is aligned on a 4KB boundary. If 176 Pages is 0, then NULL is returned. If there is not enough memory remaining to 174 Allocates the number of 4KB pages of type EfiBootServicesData and returns a pointer 175 to the allocated buffer. The buffer returned is aligned on a 4KB boundary. If 176 Pages is 0, then NULL is returned. If there is not enough memory remaining to 177 177 satisfy the request, then NULL is returned. 178 178 … … 194 194 Allocates one or more 4KB pages of type EfiRuntimeServicesData. 195 195 196 Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns a 197 pointer to the allocated buffer. The buffer returned is aligned on a 4KB boundary. 198 If Pages is 0, then NULL is returned. If there is not enough memory remaining 196 Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns a 197 pointer to the allocated buffer. The buffer returned is aligned on a 4KB boundary. 198 If Pages is 0, then NULL is returned. If there is not enough memory remaining 199 199 to satisfy the request, then NULL is returned. 200 200 … … 216 216 Allocates one or more 4KB pages of type EfiReservedMemoryType. 217 217 218 Allocates the number of 4KB pages of type EfiReservedMemoryType and returns a 219 pointer to the allocated buffer. The buffer returned is aligned on a 4KB boundary. 220 If Pages is 0, then NULL is returned. If there is not enough memory remaining 218 Allocates the number of 4KB pages of type EfiReservedMemoryType and returns a 219 pointer to the allocated buffer. The buffer returned is aligned on a 4KB boundary. 220 If Pages is 0, then NULL is returned. If there is not enough memory remaining 221 221 to satisfy the request, then NULL is returned. 222 222 … … 239 239 functions in the Memory Allocation Library. 240 240 241 Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. 242 Buffer must have been allocated on a previous call to the page allocation services 243 of the Memory Allocation Library. If it is not possible to free allocated pages, 241 Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. 242 Buffer must have been allocated on a previous call to the page allocation services 243 of the Memory Allocation Library. If it is not possible to free allocated pages, 244 244 then this function will perform no actions. 245 246 If Buffer was not allocated with a page allocation function in the Memory Allocation 245 246 If Buffer was not allocated with a page allocation function in the Memory Allocation 247 247 Library, then ASSERT(). 248 248 If Pages is zero, then ASSERT(). 249 249 250 250 @param Buffer The pointer to the buffer of pages to free. 251 251 @param Pages The number of 4 KB pages to free. … … 281 281 Allocates one or more 4KB pages of a certain memory type at a specified alignment. 282 282 283 Allocates the number of 4KB pages specified by Pages of a certain memory type 284 with an alignment specified by Alignment. The allocated buffer is returned. 285 If Pages is 0, then NULL is returned. If there is not enough memory at the 283 Allocates the number of 4KB pages specified by Pages of a certain memory type 284 with an alignment specified by Alignment. The allocated buffer is returned. 285 If Pages is 0, then NULL is returned. If there is not enough memory at the 286 286 specified alignment remaining to satisfy the request, then NULL is returned. 287 287 If Alignment is not a power of two and Alignment is not zero, then ASSERT(). … … 290 290 @param MemoryType The type of memory to allocate. 291 291 @param Pages The number of 4 KB pages to allocate. 292 @param Alignment The requested alignment of the allocation. 292 @param Alignment The requested alignment of the allocation. 293 293 Must be a power of two. 294 294 If Alignment is zero, then byte alignment is used. … … 299 299 VOID * 300 300 InternalAllocateAlignedPages ( 301 IN EFI_MEMORY_TYPE MemoryType, 301 IN EFI_MEMORY_TYPE MemoryType, 302 302 IN UINTN Pages, 303 303 IN UINTN Alignment … … 315 315 // 316 316 ASSERT ((Alignment & (Alignment - 1)) == 0); 317 317 318 318 if (Pages == 0) { 319 319 return NULL; … … 329 329 // 330 330 ASSERT (RealPages > Pages); 331 331 332 332 Status = gSmst->SmmAllocatePages (AllocateAnyPages, MemoryType, RealPages, &Memory); 333 333 if (EFI_ERROR (Status)) { … … 368 368 Allocates one or more 4KB pages of type EfiBootServicesData at a specified alignment. 369 369 370 Allocates the number of 4KB pages specified by Pages of type EfiBootServicesData 371 with an alignment specified by Alignment. The allocated buffer is returned. 372 If Pages is 0, then NULL is returned. If there is not enough memory at the 370 Allocates the number of 4KB pages specified by Pages of type EfiBootServicesData 371 with an alignment specified by Alignment. The allocated buffer is returned. 372 If Pages is 0, then NULL is returned. If there is not enough memory at the 373 373 specified alignment remaining to satisfy the request, then NULL is returned. 374 374 375 375 If Alignment is not a power of two and Alignment is not zero, then ASSERT(). 376 376 If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT(). 377 377 378 378 @param Pages The number of 4 KB pages to allocate. 379 @param Alignment The requested alignment of the allocation. 379 @param Alignment The requested alignment of the allocation. 380 380 Must be a power of two. 381 381 If Alignment is zero, then byte alignment is used. … … 397 397 Allocates one or more 4KB pages of type EfiRuntimeServicesData at a specified alignment. 398 398 399 Allocates the number of 4KB pages specified by Pages of type EfiRuntimeServicesData 400 with an alignment specified by Alignment. The allocated buffer is returned. 401 If Pages is 0, then NULL is returned. If there is not enough memory at the 399 Allocates the number of 4KB pages specified by Pages of type EfiRuntimeServicesData 400 with an alignment specified by Alignment. The allocated buffer is returned. 401 If Pages is 0, then NULL is returned. If there is not enough memory at the 402 402 specified alignment remaining to satisfy the request, then NULL is returned. 403 403 404 404 If Alignment is not a power of two and Alignment is not zero, then ASSERT(). 405 405 If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT(). 406 406 407 407 @param Pages The number of 4 KB pages to allocate. 408 @param Alignment The requested alignment of the allocation. 408 @param Alignment The requested alignment of the allocation. 409 409 Must be a power of two. 410 410 If Alignment is zero, then byte alignment is used. … … 426 426 Allocates one or more 4KB pages of type EfiReservedMemoryType at a specified alignment. 427 427 428 Allocates the number of 4KB pages specified by Pages of type EfiReservedMemoryType 429 with an alignment specified by Alignment. The allocated buffer is returned. 430 If Pages is 0, then NULL is returned. If there is not enough memory at the 428 Allocates the number of 4KB pages specified by Pages of type EfiReservedMemoryType 429 with an alignment specified by Alignment. The allocated buffer is returned. 430 If Pages is 0, then NULL is returned. If there is not enough memory at the 431 431 specified alignment remaining to satisfy the request, then NULL is returned. 432 432 433 433 If Alignment is not a power of two and Alignment is not zero, then ASSERT(). 434 434 If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT(). 435 435 436 436 @param Pages The number of 4 KB pages to allocate. 437 @param Alignment The requested alignment of the allocation. 437 @param Alignment The requested alignment of the allocation. 438 438 Must be a power of two. 439 439 If Alignment is zero, then byte alignment is used. … … 456 456 allocation functions in the Memory Allocation Library. 457 457 458 Frees the number of 4KB pages specified by Pages from the buffer specified by 459 Buffer. Buffer must have been allocated on a previous call to the aligned page 460 allocation services of the Memory Allocation Library. If it is not possible to 458 Frees the number of 4KB pages specified by Pages from the buffer specified by 459 Buffer. Buffer must have been allocated on a previous call to the aligned page 460 allocation services of the Memory Allocation Library. If it is not possible to 461 461 free allocated pages, then this function will perform no actions. 462 463 If Buffer was not allocated with an aligned page allocation function in the 462 463 If Buffer was not allocated with an aligned page allocation function in the 464 464 Memory Allocation Library, then ASSERT(). 465 465 If Pages is zero, then ASSERT(). 466 466 467 467 @param Buffer The pointer to the buffer of pages to free. 468 468 @param Pages The number of 4 KB pages to free. … … 498 498 Allocates a buffer of a certain pool type. 499 499 500 Allocates the number bytes specified by AllocationSize of a certain pool type 501 and returns a pointer to the allocated buffer. If AllocationSize is 0, then a 502 valid buffer of 0 size is returned. If there is not enough memory remaining to 500 Allocates the number bytes specified by AllocationSize of a certain pool type 501 and returns a pointer to the allocated buffer. If AllocationSize is 0, then a 502 valid buffer of 0 size is returned. If there is not enough memory remaining to 503 503 satisfy the request, then NULL is returned. 504 504 … … 511 511 VOID * 512 512 InternalAllocatePool ( 513 IN EFI_MEMORY_TYPE MemoryType, 513 IN EFI_MEMORY_TYPE MemoryType, 514 514 IN UINTN AllocationSize 515 515 ) … … 528 528 Allocates a buffer of type EfiBootServicesData. 529 529 530 Allocates the number bytes specified by AllocationSize of type EfiBootServicesData 531 and returns a pointer to the allocated buffer. If AllocationSize is 0, then a 532 valid buffer of 0 size is returned. If there is not enough memory remaining to 530 Allocates the number bytes specified by AllocationSize of type EfiBootServicesData 531 and returns a pointer to the allocated buffer. If AllocationSize is 0, then a 532 valid buffer of 0 size is returned. If there is not enough memory remaining to 533 533 satisfy the request, then NULL is returned. 534 534 … … 550 550 Allocates a buffer of type EfiRuntimeServicesData. 551 551 552 Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData 553 and returns a pointer to the allocated buffer. If AllocationSize is 0, then a 554 valid buffer of 0 size is returned. If there is not enough memory remaining to 552 Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData 553 and returns a pointer to the allocated buffer. If AllocationSize is 0, then a 554 valid buffer of 0 size is returned. If there is not enough memory remaining to 555 555 satisfy the request, then NULL is returned. 556 556 … … 572 572 Allocates a buffer of type EfiReservedMemoryType. 573 573 574 Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType 575 and returns a pointer to the allocated buffer. If AllocationSize is 0, then a 576 valid buffer of 0 size is returned. If there is not enough memory remaining to 574 Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType 575 and returns a pointer to the allocated buffer. If AllocationSize is 0, then a 576 valid buffer of 0 size is returned. If there is not enough memory remaining to 577 577 satisfy the request, then NULL is returned. 578 578 … … 594 594 Allocates and zeros a buffer of a certain pool type. 595 595 596 Allocates the number bytes specified by AllocationSize of a certain pool type, 597 clears the buffer with zeros, and returns a pointer to the allocated buffer. 598 If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is 596 Allocates the number bytes specified by AllocationSize of a certain pool type, 597 clears the buffer with zeros, and returns a pointer to the allocated buffer. 598 If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is 599 599 not enough memory remaining to satisfy the request, then NULL is returned. 600 600 … … 607 607 VOID * 608 608 InternalAllocateZeroPool ( 609 IN EFI_MEMORY_TYPE PoolType, 609 IN EFI_MEMORY_TYPE PoolType, 610 610 IN UINTN AllocationSize 611 ) 611 ) 612 612 { 613 613 VOID *Memory; … … 623 623 Allocates and zeros a buffer of type EfiBootServicesData. 624 624 625 Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, 626 clears the buffer with zeros, and returns a pointer to the allocated buffer. 627 If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is 625 Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, 626 clears the buffer with zeros, and returns a pointer to the allocated buffer. 627 If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is 628 628 not enough memory remaining to satisfy the request, then NULL is returned. 629 629 … … 645 645 Allocates and zeros a buffer of type EfiRuntimeServicesData. 646 646 647 Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, 648 clears the buffer with zeros, and returns a pointer to the allocated buffer. 649 If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is 647 Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, 648 clears the buffer with zeros, and returns a pointer to the allocated buffer. 649 If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is 650 650 not enough memory remaining to satisfy the request, then NULL is returned. 651 651 … … 667 667 Allocates and zeros a buffer of type EfiReservedMemoryType. 668 668 669 Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType, 670 clears the buffer with zeros, and returns a pointer to the allocated buffer. 671 If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is 669 Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType, 670 clears the buffer with zeros, and returns a pointer to the allocated buffer. 671 If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is 672 672 not enough memory remaining to satisfy the request, then NULL is returned. 673 673 … … 689 689 Copies a buffer to an allocated buffer of a certain pool type. 690 690 691 Allocates the number bytes specified by AllocationSize of a certain pool type, 692 copies AllocationSize bytes from Buffer to the newly allocated buffer, and returns 693 a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer 694 of 0 size is returned. If there is not enough memory remaining to satisfy the 691 Allocates the number bytes specified by AllocationSize of a certain pool type, 692 copies AllocationSize bytes from Buffer to the newly allocated buffer, and returns 693 a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer 694 of 0 size is returned. If there is not enough memory remaining to satisfy the 695 695 request, then NULL is returned. If Buffer is NULL, then ASSERT(). 696 If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). 696 If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). 697 697 698 698 @param PoolType The type of pool to allocate. … … 705 705 VOID * 706 706 InternalAllocateCopyPool ( 707 IN EFI_MEMORY_TYPE PoolType, 707 IN EFI_MEMORY_TYPE PoolType, 708 708 IN UINTN AllocationSize, 709 709 IN CONST VOID *Buffer 710 ) 710 ) 711 711 { 712 712 VOID *Memory; … … 720 720 } 721 721 return Memory; 722 } 722 } 723 723 724 724 /** 725 725 Copies a buffer to an allocated buffer of type EfiBootServicesData. 726 726 727 Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, 728 copies AllocationSize bytes from Buffer to the newly allocated buffer, and returns 729 a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer 730 of 0 size is returned. If there is not enough memory remaining to satisfy the 727 Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, 728 copies AllocationSize bytes from Buffer to the newly allocated buffer, and returns 729 a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer 730 of 0 size is returned. If there is not enough memory remaining to satisfy the 731 731 request, then NULL is returned. 732 732 733 733 If Buffer is NULL, then ASSERT(). 734 If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). 734 If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). 735 735 736 736 @param AllocationSize The number of bytes to allocate and zero. … … 753 753 Copies a buffer to an allocated buffer of type EfiRuntimeServicesData. 754 754 755 Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, 756 copies AllocationSize bytes from Buffer to the newly allocated buffer, and returns 757 a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer 758 of 0 size is returned. If there is not enough memory remaining to satisfy the 755 Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, 756 copies AllocationSize bytes from Buffer to the newly allocated buffer, and returns 757 a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer 758 of 0 size is returned. If there is not enough memory remaining to satisfy the 759 759 request, then NULL is returned. 760 760 761 761 If Buffer is NULL, then ASSERT(). 762 If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). 762 If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). 763 763 764 764 @param AllocationSize The number of bytes to allocate and zero. … … 781 781 Copies a buffer to an allocated buffer of type EfiReservedMemoryType. 782 782 783 Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType, 784 copies AllocationSize bytes from Buffer to the newly allocated buffer, and returns 785 a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer 786 of 0 size is returned. If there is not enough memory remaining to satisfy the 783 Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType, 784 copies AllocationSize bytes from Buffer to the newly allocated buffer, and returns 785 a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer 786 of 0 size is returned. If there is not enough memory remaining to satisfy the 787 787 request, then NULL is returned. 788 788 789 789 If Buffer is NULL, then ASSERT(). 790 If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). 790 If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). 791 791 792 792 @param AllocationSize The number of bytes to allocate and zero. … … 810 810 811 811 Allocates and zeros the number bytes specified by NewSize from memory of the type 812 specified by PoolType. If OldBuffer is not NULL, then the smaller of OldSize and 813 NewSize bytes are copied from OldBuffer to the newly allocated buffer, and 814 OldBuffer is freed. A pointer to the newly allocated buffer is returned. 815 If NewSize is 0, then a valid buffer of 0 size is returned. If there is not 812 specified by PoolType. If OldBuffer is not NULL, then the smaller of OldSize and 813 NewSize bytes are copied from OldBuffer to the newly allocated buffer, and 814 OldBuffer is freed. A pointer to the newly allocated buffer is returned. 815 If NewSize is 0, then a valid buffer of 0 size is returned. If there is not 816 816 enough memory remaining to satisfy the request, then NULL is returned. 817 818 If the allocation of the new buffer is successful and the smaller of NewSize 817 818 If the allocation of the new buffer is successful and the smaller of NewSize 819 819 and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT(). 820 820 … … 822 822 @param OldSize The size, in bytes, of OldBuffer. 823 823 @param NewSize The size, in bytes, of the buffer to reallocate. 824 @param OldBuffer The buffer to copy to the allocated buffer. This is an 824 @param OldBuffer The buffer to copy to the allocated buffer. This is an 825 825 optional parameter that may be NULL. 826 826 … … 830 830 VOID * 831 831 InternalReallocatePool ( 832 IN EFI_MEMORY_TYPE PoolType, 832 IN EFI_MEMORY_TYPE PoolType, 833 833 IN UINTN OldSize, 834 834 IN UINTN NewSize, … … 850 850 851 851 Allocates and zeros the number bytes specified by NewSize from memory of type 852 EfiBootServicesData. If OldBuffer is not NULL, then the smaller of OldSize and 853 NewSize bytes are copied from OldBuffer to the newly allocated buffer, and 854 OldBuffer is freed. A pointer to the newly allocated buffer is returned. 855 If NewSize is 0, then a valid buffer of 0 size is returned. If there is not 852 EfiBootServicesData. If OldBuffer is not NULL, then the smaller of OldSize and 853 NewSize bytes are copied from OldBuffer to the newly allocated buffer, and 854 OldBuffer is freed. A pointer to the newly allocated buffer is returned. 855 If NewSize is 0, then a valid buffer of 0 size is returned. If there is not 856 856 enough memory remaining to satisfy the request, then NULL is returned. 857 858 If the allocation of the new buffer is successful and the smaller of NewSize 857 858 If the allocation of the new buffer is successful and the smaller of NewSize 859 859 and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT(). 860 860 861 861 @param OldSize The size, in bytes, of OldBuffer. 862 862 @param NewSize The size, in bytes, of the buffer to reallocate. 863 @param OldBuffer The buffer to copy to the allocated buffer. This is an 863 @param OldBuffer The buffer to copy to the allocated buffer. This is an 864 864 optional parameter that may be NULL. 865 865 … … 882 882 883 883 Allocates and zeros the number bytes specified by NewSize from memory of type 884 EfiRuntimeServicesData. If OldBuffer is not NULL, then the smaller of OldSize 885 and NewSize bytes are copied from OldBuffer to the newly allocated buffer, and 886 OldBuffer is freed. A pointer to the newly allocated buffer is returned. 887 If NewSize is 0, then a valid buffer of 0 size is returned. If there is not 884 EfiRuntimeServicesData. If OldBuffer is not NULL, then the smaller of OldSize 885 and NewSize bytes are copied from OldBuffer to the newly allocated buffer, and 886 OldBuffer is freed. A pointer to the newly allocated buffer is returned. 887 If NewSize is 0, then a valid buffer of 0 size is returned. If there is not 888 888 enough memory remaining to satisfy the request, then NULL is returned. 889 889 890 If the allocation of the new buffer is successful and the smaller of NewSize 890 If the allocation of the new buffer is successful and the smaller of NewSize 891 891 and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT(). 892 892 893 893 @param OldSize The size, in bytes, of OldBuffer. 894 894 @param NewSize The size, in bytes, of the buffer to reallocate. 895 @param OldBuffer The buffer to copy to the allocated buffer. This is an 895 @param OldBuffer The buffer to copy to the allocated buffer. This is an 896 896 optional parameter that may be NULL. 897 897 … … 914 914 915 915 Allocates and zeros the number bytes specified by NewSize from memory of type 916 EfiReservedMemoryType. If OldBuffer is not NULL, then the smaller of OldSize 917 and NewSize bytes are copied from OldBuffer to the newly allocated buffer, and 918 OldBuffer is freed. A pointer to the newly allocated buffer is returned. 919 If NewSize is 0, then a valid buffer of 0 size is returned. If there is not 916 EfiReservedMemoryType. If OldBuffer is not NULL, then the smaller of OldSize 917 and NewSize bytes are copied from OldBuffer to the newly allocated buffer, and 918 OldBuffer is freed. A pointer to the newly allocated buffer is returned. 919 If NewSize is 0, then a valid buffer of 0 size is returned. If there is not 920 920 enough memory remaining to satisfy the request, then NULL is returned. 921 921 922 If the allocation of the new buffer is successful and the smaller of NewSize 922 If the allocation of the new buffer is successful and the smaller of NewSize 923 923 and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT(). 924 924 925 925 @param OldSize The size, in bytes, of OldBuffer. 926 926 @param NewSize The size, in bytes, of the buffer to reallocate. 927 @param OldBuffer The buffer to copy to the allocated buffer. This is an 927 @param OldBuffer The buffer to copy to the allocated buffer. This is an 928 928 optional parameter that may be NULL. 929 929 … … 943 943 944 944 /** 945 Frees a buffer that was previously allocated with one of the pool allocation 945 Frees a buffer that was previously allocated with one of the pool allocation 946 946 functions in the Memory Allocation Library. 947 947 948 Frees the buffer specified by Buffer. Buffer must have been allocated on a 949 previous call to the pool allocation services of the Memory Allocation Library. 950 If it is not possible to free pool resources, then this function will perform 948 Frees the buffer specified by Buffer. Buffer must have been allocated on a 949 previous call to the pool allocation services of the Memory Allocation Library. 950 If it is not possible to free pool resources, then this function will perform 951 951 no actions. 952 953 If Buffer was not allocated with a pool allocation function in the Memory 952 953 If Buffer was not allocated with a pool allocation function in the Memory 954 954 Allocation Library, then ASSERT(). 955 955 -
trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf
r58459 r58466 2 2 # Instance of Memory Allocation Library using SMM Services Table. 3 3 # 4 # Memory Allocation Library that uses services from the SMM Services Table to 4 # Memory Allocation Library that uses services from the SMM Services Table to 5 5 # allocate and free memory. 6 6 # … … 23 23 VERSION_STRING = 1.0 24 24 PI_SPECIFICATION_VERSION = 0x0001000A 25 LIBRARY_CLASS = MemoryAllocationLib|DXE_SMM_DRIVER 25 LIBRARY_CLASS = MemoryAllocationLib|DXE_SMM_DRIVER 26 26 CONSTRUCTOR = SmmMemoryAllocationLibConstructor 27 27 DESTRUCTOR = SmmMemoryAllocationLibDestructor … … 44 44 45 45 [Protocols] 46 gEfiSmmAccess2ProtocolGuid ## CONSUMES 46 gEfiSmmAccess2ProtocolGuid ## CONSUMES 47 47 48 48 [Depex]
Note:
See TracChangeset
for help on using the changeset viewer.