1. Line 79:Use the pre-initialized global variable mPoolHeadList = INITIALIZE_LIST_HEAD_VARIABLE (mPoolHeadList) to remove the statement in line 102
2. Line 337: The debug print statement: “Addr = %x” should change to “Addr = %p” since the expected Buffer is VOID *; How about “(len %x) %,d” ? The Size & Pool->Used belong to type UINTN? Cast it to UINT64 and use %lx
3.Line 413, 418, 425, 477: Use “Buffer != NULL” instead of “NULL != Buffer”
4. Line 451: The debug print statement: “FreePool = %x” should change to FreePool = %p” since Head->Data is pointer; How about “(len %x) %,d” ? The Head->Size& Pool->Used belong to type UINTN? Cast it to UINT64 and use %lx
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5916
6f19259b-4bc3-4df7-8a09-
765794883524
//\r
// List of pool header to search for the appropriate memory type.\r
//\r
//\r
// List of pool header to search for the appropriate memory type.\r
//\r
-LIST_ENTRY mPoolHeadList;\r
+LIST_ENTRY mPoolHeadList = INITIALIZE_LIST_HEAD_VARIABLE (mPoolHeadList);\r
InitializeListHead (&mPoolHead[Type].FreeList[Index]);\r
}\r
}\r
InitializeListHead (&mPoolHead[Type].FreeList[Index]);\r
}\r
}\r
- InitializeListHead (&mPoolHeadList);\r
\r
DEBUG ((\r
DEBUG_POOL,\r
\r
DEBUG ((\r
DEBUG_POOL,\r
- "AllocatePoolI: Type %x, Addr %x (len %x) %,d\n", PoolType,\r
+ "AllocatePoolI: Type %x, Addr %p (len %lx) %,ld\n", PoolType,\r
- Size - POOL_OVERHEAD,\r
- Pool->Used\r
+ (UINT64)(Size - POOL_OVERHEAD),\r
+ (UINT64) Pool->Used\r
Pool->Used += Size;\r
\r
} else {\r
Pool->Used += Size;\r
\r
} else {\r
- DEBUG ((DEBUG_ERROR | DEBUG_POOL, "AllocatePool: failed to allocate %d bytes\n", Size));\r
+ DEBUG ((DEBUG_ERROR | DEBUG_POOL, "AllocatePool: failed to allocate %ld bytes\n", (UINT64) Size));\r
UINTN Offset;\r
BOOLEAN AllFree;\r
\r
UINTN Offset;\r
BOOLEAN AllFree;\r
\r
- ASSERT(NULL != Buffer);\r
+ ASSERT(Buffer != NULL);\r
//\r
// Get the head & tail of the pool entry\r
//\r
Head = CR (Buffer, POOL_HEAD, Data, POOL_HEAD_SIGNATURE);\r
//\r
// Get the head & tail of the pool entry\r
//\r
Head = CR (Buffer, POOL_HEAD, Data, POOL_HEAD_SIGNATURE);\r
- ASSERT(NULL != Head);\r
+ ASSERT(Head != NULL);\r
\r
if (Head->Signature != POOL_HEAD_SIGNATURE) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
Tail = HEAD_TO_TAIL (Head);\r
\r
if (Head->Signature != POOL_HEAD_SIGNATURE) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
Tail = HEAD_TO_TAIL (Head);\r
- ASSERT(NULL != Tail);\r
+ ASSERT(Tail != NULL);\r
return EFI_INVALID_PARAMETER;\r
}\r
Pool->Used -= Size;\r
return EFI_INVALID_PARAMETER;\r
}\r
Pool->Used -= Size;\r
- DEBUG ((DEBUG_POOL, "FreePool: %x (len %x) %,d\n", Head->Data, Head->Size - POOL_OVERHEAD, Pool->Used));\r
+ DEBUG ((DEBUG_POOL, "FreePool: %p (len %lx) %,ld\n", Head->Data, (UINT64)(Head->Size - POOL_OVERHEAD), (UINT64) Pool->Used));\r
\r
//\r
// Determine the pool list\r
\r
//\r
// Determine the pool list\r
// Put the pool entry onto the free pool list\r
//\r
Free = (POOL_FREE *) Head;\r
// Put the pool entry onto the free pool list\r
//\r
Free = (POOL_FREE *) Head;\r
- ASSERT(NULL != Free);\r
+ ASSERT(Free != NULL);\r
Free->Signature = POOL_FREE_SIGNATURE;\r
Free->Index = (UINT32)Index;\r
InsertHeadList (&Pool->FreeList[Index], &Free->Link);\r
Free->Signature = POOL_FREE_SIGNATURE;\r
Free->Index = (UINT32)Index;\r
InsertHeadList (&Pool->FreeList[Index], &Free->Link);\r
FSize = LIST_TO_SIZE(Index);\r
while (Offset + FSize <= DEFAULT_PAGE_ALLOCATION) {\r
Free = (POOL_FREE *) &NewPage[Offset];\r
FSize = LIST_TO_SIZE(Index);\r
while (Offset + FSize <= DEFAULT_PAGE_ALLOCATION) {\r
Free = (POOL_FREE *) &NewPage[Offset];\r
- ASSERT(NULL != Free);\r
+ ASSERT(Free != NULL);\r
if (Free->Signature != POOL_FREE_SIGNATURE) {\r
AllFree = FALSE;\r
}\r
if (Free->Signature != POOL_FREE_SIGNATURE) {\r
AllFree = FALSE;\r
}\r
// Remove all of these pool entries from the free loop lists.\r
//\r
Free = (POOL_FREE *) &NewPage[0];\r
// Remove all of these pool entries from the free loop lists.\r
//\r
Free = (POOL_FREE *) &NewPage[0];\r
- ASSERT(NULL != Free);\r
+ ASSERT(Free != NULL);\r
Index = Free->Index;\r
Offset = 0;\r
\r
Index = Free->Index;\r
Offset = 0;\r
\r
FSize = LIST_TO_SIZE(Index);\r
while (Offset + FSize <= DEFAULT_PAGE_ALLOCATION) {\r
Free = (POOL_FREE *) &NewPage[Offset];\r
FSize = LIST_TO_SIZE(Index);\r
while (Offset + FSize <= DEFAULT_PAGE_ALLOCATION) {\r
Free = (POOL_FREE *) &NewPage[Offset];\r
- ASSERT(NULL != Free);\r
+ ASSERT(Free != NULL);\r
RemoveEntryList (&Free->Link);\r
Offset += FSize;\r
}\r
RemoveEntryList (&Free->Link);\r
Offset += FSize;\r
}\r