summaryrefslogtreecommitdiff
path: root/MdePkg
diff options
context:
space:
mode:
authormdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>2009-05-09 01:13:40 +0000
committermdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>2009-05-09 01:13:40 +0000
commit6e10b70a62dee17d7913b20f5323c1e75bd13417 (patch)
tree420bb8a87db254d6165b8d503a0685f33da2fc18 /MdePkg
parent6cb6f078ae95b64715609b87c1e28538395bd821 (diff)
downloadedk2-6e10b70a62dee17d7913b20f5323c1e75bd13417.zip
edk2-6e10b70a62dee17d7913b20f5323c1e75bd13417.tar.gz
edk2-6e10b70a62dee17d7913b20f5323c1e75bd13417.tar.bz2
Clarify that FreePages(), FreeAlignedPages(), and FreePool() may perform n actions if those operations are not possible. For example, the PEI Phase does not provide any services to free allocated pages or allocated pool memory.
Update comments in PeiMemoryAllocationLib and UefiMemoryAllocationLib to match updates to MemoryAllocationLib.h. Add ASSERT() statements in PeiMemoryAllocationLib for the FreePages() and FreeAlignedPages() if Pages is 0. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8275 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg')
-rw-r--r--MdePkg/Include/Library/MemoryAllocationLib.h9
-rw-r--r--MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c11
-rw-r--r--MdePkg/Library/UefiMemoryAllocationLib/MemoryAllocationLib.c9
3 files changed, 20 insertions, 9 deletions
diff --git a/MdePkg/Include/Library/MemoryAllocationLib.h b/MdePkg/Include/Library/MemoryAllocationLib.h
index 74f7673..8cc93f2 100644
--- a/MdePkg/Include/Library/MemoryAllocationLib.h
+++ b/MdePkg/Include/Library/MemoryAllocationLib.h
@@ -83,7 +83,8 @@ AllocateReservedPages (
Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer
must have been allocated on a previous call to the page allocation services of the Memory
- Allocation Library.
+ Allocation Library. If it is not possible to free allocated pages, then this function will
+ peform no actions.
If Buffer was not allocated with a page allocation function in the Memory Allocation Library,
then ASSERT().
@@ -178,7 +179,8 @@ AllocateAlignedReservedPages (
Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer
must have been allocated on a previous call to the aligned page allocation services of the Memory
- Allocation Library.
+ Allocation Library. If it is not possible to free allocated pages, then this function will
+ peform no actions.
If Buffer was not allocated with an aligned page allocation function in the Memory Allocation
Library, then ASSERT().
@@ -470,7 +472,8 @@ ReallocateReservedPool (
Memory Allocation Library.
Frees the buffer specified by Buffer. Buffer must have been allocated on a previous call to the
- pool allocation services of the Memory Allocation Library.
+ pool allocation services of the Memory Allocation Library. If it is not possible to free pool
+ resources, then this function will peform no actions.
If Buffer was not allocated with a pool allocation function in the Memory Allocation Library,
then ASSERT().
diff --git a/MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c b/MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c
index f9e723e..4e5f8fa 100644
--- a/MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c
+++ b/MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c
@@ -128,7 +128,8 @@ AllocateReservedPages (
Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer
must have been allocated on a previous call to the page allocation services of the Memory
- Allocation Library.
+ Allocation Library. If it is not possible to free allocated pages, then this function will
+ peform no actions.
If Buffer was not allocated with a page allocation function in the Memory Allocation Library,
then ASSERT().
@@ -145,6 +146,7 @@ FreePages (
IN UINTN Pages
)
{
+ ASSERT (Pages != 0);
//
// PEI phase does not support to free pages, so leave it as NOP.
//
@@ -288,7 +290,8 @@ AllocateAlignedReservedPages (
Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer
must have been allocated on a previous call to the aligned page allocation services of the Memory
- Allocation Library.
+ Allocation Library. If it is not possible to free allocated pages, then this function will
+ peform no actions.
If Buffer was not allocated with an aligned page allocation function in the Memory Allocation
Library, then ASSERT().
@@ -305,6 +308,7 @@ FreeAlignedPages (
IN UINTN Pages
)
{
+ ASSERT (Pages != 0);
//
// PEI phase does not support to free pages, so leave it as NOP.
//
@@ -775,7 +779,8 @@ ReallocateReservedPool (
Memory Allocation Library.
Frees the buffer specified by Buffer. Buffer must have been allocated on a previous call to the
- pool allocation services of the Memory Allocation Library.
+ pool allocation services of the Memory Allocation Library. If it is not possible to free pool
+ resources, then this function will peform no actions.
If Buffer was not allocated with a pool allocation function in the Memory Allocation Library,
then ASSERT().
diff --git a/MdePkg/Library/UefiMemoryAllocationLib/MemoryAllocationLib.c b/MdePkg/Library/UefiMemoryAllocationLib/MemoryAllocationLib.c
index 2a9f128..08bb292 100644
--- a/MdePkg/Library/UefiMemoryAllocationLib/MemoryAllocationLib.c
+++ b/MdePkg/Library/UefiMemoryAllocationLib/MemoryAllocationLib.c
@@ -127,7 +127,8 @@ AllocateReservedPages (
Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer
must have been allocated on a previous call to the page allocation services of the Memory
- Allocation Library.
+ Allocation Library. If it is not possible to free allocated pages, then this function will
+ peform no actions.
If Buffer was not allocated with a page allocation function in the Memory Allocation Library,
then ASSERT().
@@ -323,7 +324,8 @@ AllocateAlignedReservedPages (
Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer
must have been allocated on a previous call to the aligned page allocation services of the Memory
- Allocation Library.
+ Allocation Library. If it is not possible to free allocated pages, then this function will
+ peform no actions.
If Buffer was not allocated with an aligned page allocation function in the Memory Allocation
Library, then ASSERT().
@@ -792,7 +794,8 @@ ReallocateReservedPool (
Memory Allocation Library.
Frees the buffer specified by Buffer. Buffer must have been allocated on a previous call to the
- pool allocation services of the Memory Allocation Library.
+ pool allocation services of the Memory Allocation Library. If it is not possible to free pool
+ resources, then this function will peform no actions.
If Buffer was not allocated with a pool allocation function in the Memory Allocation Library,
then ASSERT().