MdeModulePkg: Fix unix style of EOL

Cc: Wu Hao <hao.a.wu@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
This commit is contained in:
Jian J Wang
2017-11-20 16:08:28 +08:00
committed by Hao Wu
parent a89b923ea9
commit e63da9f033
19 changed files with 4211 additions and 4211 deletions

View File

@@ -14,7 +14,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "DxeMain.h"
#include "Imem.h"
#include "HeapGuard.h"
#include "HeapGuard.h"
STATIC EFI_LOCK mPoolMemoryLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_NOTIFY);
@@ -170,7 +170,7 @@ LookupPoolHead (
}
}
Pool = CoreAllocatePoolI (EfiBootServicesData, sizeof (POOL), FALSE);
Pool = CoreAllocatePoolI (EfiBootServicesData, sizeof (POOL), FALSE);
if (Pool == NULL) {
return NULL;
}
@@ -215,8 +215,8 @@ CoreInternalAllocatePool (
OUT VOID **Buffer
)
{
EFI_STATUS Status;
BOOLEAN NeedGuard;
EFI_STATUS Status;
BOOLEAN NeedGuard;
//
// If it's not a valid type, fail it
@@ -240,8 +240,8 @@ CoreInternalAllocatePool (
return EFI_OUT_OF_RESOURCES;
}
NeedGuard = IsPoolTypeToGuard (PoolType) && !mOnGuarding;
NeedGuard = IsPoolTypeToGuard (PoolType) && !mOnGuarding;
//
// Acquire the memory lock and make the allocation
//
@@ -250,7 +250,7 @@ CoreInternalAllocatePool (
return EFI_OUT_OF_RESOURCES;
}
*Buffer = CoreAllocatePoolI (PoolType, Size, NeedGuard);
*Buffer = CoreAllocatePoolI (PoolType, Size, NeedGuard);
CoreReleaseLock (&mPoolMemoryLock);
return (*Buffer != NULL) ? EFI_SUCCESS : EFI_OUT_OF_RESOURCES;
}
@@ -302,7 +302,7 @@ CoreAllocatePool (
@param PoolType The type of memory for the new pool pages
@param NoPages No of pages to allocate
@param Granularity Bits to align.
@param NeedGuard Flag to indicate Guard page is needed or not
@param NeedGuard Flag to indicate Guard page is needed or not
@return The allocated memory, or NULL
@@ -312,8 +312,8 @@ VOID *
CoreAllocatePoolPagesI (
IN EFI_MEMORY_TYPE PoolType,
IN UINTN NoPages,
IN UINTN Granularity,
IN BOOLEAN NeedGuard
IN UINTN Granularity,
IN BOOLEAN NeedGuard
)
{
VOID *Buffer;
@@ -324,14 +324,14 @@ CoreAllocatePoolPagesI (
return NULL;
}
Buffer = CoreAllocatePoolPages (PoolType, NoPages, Granularity, NeedGuard);
Buffer = CoreAllocatePoolPages (PoolType, NoPages, Granularity, NeedGuard);
CoreReleaseMemoryLock ();
if (Buffer != NULL) {
if (NeedGuard) {
SetGuardForMemory ((EFI_PHYSICAL_ADDRESS)(UINTN)Buffer, NoPages);
}
ApplyMemoryProtectionPolicy(EfiConventionalMemory, PoolType,
if (NeedGuard) {
SetGuardForMemory ((EFI_PHYSICAL_ADDRESS)(UINTN)Buffer, NoPages);
}
ApplyMemoryProtectionPolicy(EfiConventionalMemory, PoolType,
(EFI_PHYSICAL_ADDRESS)(UINTN)Buffer, EFI_PAGES_TO_SIZE (NoPages));
}
return Buffer;
@@ -343,7 +343,7 @@ CoreAllocatePoolPagesI (
@param PoolType Type of pool to allocate
@param Size The amount of pool to allocate
@param NeedGuard Flag to indicate Guard page is needed or not
@param NeedGuard Flag to indicate Guard page is needed or not
@return The allocate pool, or NULL
@@ -351,8 +351,8 @@ CoreAllocatePoolPagesI (
VOID *
CoreAllocatePoolI (
IN EFI_MEMORY_TYPE PoolType,
IN UINTN Size,
IN BOOLEAN NeedGuard
IN UINTN Size,
IN BOOLEAN NeedGuard
)
{
POOL *Pool;
@@ -366,7 +366,7 @@ CoreAllocatePoolI (
UINTN Offset, MaxOffset;
UINTN NoPages;
UINTN Granularity;
BOOLEAN HasPoolTail;
BOOLEAN HasPoolTail;
ASSERT_LOCKED (&mPoolMemoryLock);
@@ -384,9 +384,9 @@ CoreAllocatePoolI (
// Adjust the size by the pool header & tail overhead
//
HasPoolTail = !(NeedGuard &&
((PcdGet8 (PcdHeapGuardPropertyMask) & BIT7) == 0));
HasPoolTail = !(NeedGuard &&
((PcdGet8 (PcdHeapGuardPropertyMask) & BIT7) == 0));
//
// Adjusting the Size to be of proper alignment so that
// we don't get an unaligned access fault later when
@@ -406,16 +406,16 @@ CoreAllocatePoolI (
// If allocation is over max size, just allocate pages for the request
// (slow)
//
if (Index >= SIZE_TO_LIST (Granularity) || NeedGuard) {
if (!HasPoolTail) {
Size -= sizeof (POOL_TAIL);
}
NoPages = EFI_SIZE_TO_PAGES (Size) + EFI_SIZE_TO_PAGES (Granularity) - 1;
if (Index >= SIZE_TO_LIST (Granularity) || NeedGuard) {
if (!HasPoolTail) {
Size -= sizeof (POOL_TAIL);
}
NoPages = EFI_SIZE_TO_PAGES (Size) + EFI_SIZE_TO_PAGES (Granularity) - 1;
NoPages &= ~(UINTN)(EFI_SIZE_TO_PAGES (Granularity) - 1);
Head = CoreAllocatePoolPagesI (PoolType, NoPages, Granularity, NeedGuard);
if (NeedGuard) {
Head = AdjustPoolHeadA ((EFI_PHYSICAL_ADDRESS)(UINTN)Head, NoPages, Size);
}
Head = CoreAllocatePoolPagesI (PoolType, NoPages, Granularity, NeedGuard);
if (NeedGuard) {
Head = AdjustPoolHeadA ((EFI_PHYSICAL_ADDRESS)(UINTN)Head, NoPages, Size);
}
goto Done;
}
@@ -443,8 +443,8 @@ CoreAllocatePoolI (
//
// Get another page
//
NewPage = CoreAllocatePoolPagesI (PoolType, EFI_SIZE_TO_PAGES (Granularity),
Granularity, NeedGuard);
NewPage = CoreAllocatePoolPagesI (PoolType, EFI_SIZE_TO_PAGES (Granularity),
Granularity, NeedGuard);
if (NewPage == NULL) {
goto Done;
}
@@ -490,11 +490,11 @@ Done:
if (Head != NULL) {
//
// Account the allocation
//
Pool->Used += Size;
//
// Account the allocation
//
Pool->Used += Size;
//
// If we have a pool buffer, fill in the header & tail info
//
@@ -502,24 +502,24 @@ Done:
Head->Size = Size;
Head->Type = (EFI_MEMORY_TYPE) PoolType;
Buffer = Head->Data;
if (HasPoolTail) {
Tail = HEAD_TO_TAIL (Head);
Tail->Signature = POOL_TAIL_SIGNATURE;
Tail->Size = Size;
Size -= POOL_OVERHEAD;
} else {
Size -= SIZE_OF_POOL_HEAD;
}
DEBUG_CLEAR_MEMORY (Buffer, Size);
if (HasPoolTail) {
Tail = HEAD_TO_TAIL (Head);
Tail->Signature = POOL_TAIL_SIGNATURE;
Tail->Size = Size;
Size -= POOL_OVERHEAD;
} else {
Size -= SIZE_OF_POOL_HEAD;
}
DEBUG_CLEAR_MEMORY (Buffer, Size);
DEBUG ((
DEBUG_POOL,
"AllocatePoolI: Type %x, Addr %p (len %lx) %,ld\n", PoolType,
Buffer,
(UINT64)Size,
(UINT64)Size,
(UINT64) Pool->Used
));
@@ -619,34 +619,34 @@ CoreFreePoolPagesI (
(EFI_PHYSICAL_ADDRESS)(UINTN)Memory, EFI_PAGES_TO_SIZE (NoPages));
}
/**
Internal function. Frees guarded pool pages.
@param PoolType The type of memory for the pool pages
@param Memory The base address to free
@param NoPages The number of pages to free
**/
STATIC
VOID
CoreFreePoolPagesWithGuard (
IN EFI_MEMORY_TYPE PoolType,
IN EFI_PHYSICAL_ADDRESS Memory,
IN UINTN NoPages
)
{
EFI_PHYSICAL_ADDRESS MemoryGuarded;
UINTN NoPagesGuarded;
MemoryGuarded = Memory;
NoPagesGuarded = NoPages;
AdjustMemoryF (&Memory, &NoPages);
CoreFreePoolPagesI (PoolType, Memory, NoPages);
UnsetGuardForMemory (MemoryGuarded, NoPagesGuarded);
}
/**
Internal function. Frees guarded pool pages.
@param PoolType The type of memory for the pool pages
@param Memory The base address to free
@param NoPages The number of pages to free
**/
STATIC
VOID
CoreFreePoolPagesWithGuard (
IN EFI_MEMORY_TYPE PoolType,
IN EFI_PHYSICAL_ADDRESS Memory,
IN UINTN NoPages
)
{
EFI_PHYSICAL_ADDRESS MemoryGuarded;
UINTN NoPagesGuarded;
MemoryGuarded = Memory;
NoPagesGuarded = NoPages;
AdjustMemoryF (&Memory, &NoPages);
CoreFreePoolPagesI (PoolType, Memory, NoPages);
UnsetGuardForMemory (MemoryGuarded, NoPagesGuarded);
}
/**
Internal function to free a pool entry.
Caller must have the memory lock held
@@ -675,8 +675,8 @@ CoreFreePoolI (
UINTN Offset;
BOOLEAN AllFree;
UINTN Granularity;
BOOLEAN IsGuarded;
BOOLEAN HasPoolTail;
BOOLEAN IsGuarded;
BOOLEAN HasPoolTail;
ASSERT(Buffer != NULL);
//
@@ -689,32 +689,32 @@ CoreFreePoolI (
return EFI_INVALID_PARAMETER;
}
IsGuarded = IsPoolTypeToGuard (Head->Type) &&
IsMemoryGuarded ((EFI_PHYSICAL_ADDRESS)(UINTN)Head);
HasPoolTail = !(IsGuarded &&
((PcdGet8 (PcdHeapGuardPropertyMask) & BIT7) == 0));
IsGuarded = IsPoolTypeToGuard (Head->Type) &&
IsMemoryGuarded ((EFI_PHYSICAL_ADDRESS)(UINTN)Head);
HasPoolTail = !(IsGuarded &&
((PcdGet8 (PcdHeapGuardPropertyMask) & BIT7) == 0));
if (HasPoolTail) {
Tail = HEAD_TO_TAIL (Head);
ASSERT (Tail != NULL);
if (HasPoolTail) {
Tail = HEAD_TO_TAIL (Head);
ASSERT (Tail != NULL);
//
// Debug
//
ASSERT (Tail->Signature == POOL_TAIL_SIGNATURE);
ASSERT (Head->Size == Tail->Size);
//
// Debug
//
ASSERT (Tail->Signature == POOL_TAIL_SIGNATURE);
ASSERT (Head->Size == Tail->Size);
if (Tail->Signature != POOL_TAIL_SIGNATURE) {
return EFI_INVALID_PARAMETER;
}
if (Head->Size != Tail->Size) {
return EFI_INVALID_PARAMETER;
}
if (Tail->Signature != POOL_TAIL_SIGNATURE) {
return EFI_INVALID_PARAMETER;
}
if (Head->Size != Tail->Size) {
return EFI_INVALID_PARAMETER;
}
}
ASSERT_LOCKED (&mPoolMemoryLock);
ASSERT_LOCKED (&mPoolMemoryLock);
//
// Determine the pool type and account for it
//
@@ -749,27 +749,27 @@ CoreFreePoolI (
//
// If it's not on the list, it must be pool pages
//
if (Index >= SIZE_TO_LIST (Granularity) || IsGuarded) {
if (Index >= SIZE_TO_LIST (Granularity) || IsGuarded) {
//
// Return the memory pages back to free memory
//
NoPages = EFI_SIZE_TO_PAGES (Size) + EFI_SIZE_TO_PAGES (Granularity) - 1;
NoPages = EFI_SIZE_TO_PAGES (Size) + EFI_SIZE_TO_PAGES (Granularity) - 1;
NoPages &= ~(UINTN)(EFI_SIZE_TO_PAGES (Granularity) - 1);
if (IsGuarded) {
Head = AdjustPoolHeadF ((EFI_PHYSICAL_ADDRESS)(UINTN)Head);
CoreFreePoolPagesWithGuard (
Pool->MemoryType,
(EFI_PHYSICAL_ADDRESS)(UINTN)Head,
NoPages
);
} else {
CoreFreePoolPagesI (
Pool->MemoryType,
(EFI_PHYSICAL_ADDRESS)(UINTN)Head,
NoPages
);
}
if (IsGuarded) {
Head = AdjustPoolHeadF ((EFI_PHYSICAL_ADDRESS)(UINTN)Head);
CoreFreePoolPagesWithGuard (
Pool->MemoryType,
(EFI_PHYSICAL_ADDRESS)(UINTN)Head,
NoPages
);
} else {
CoreFreePoolPagesI (
Pool->MemoryType,
(EFI_PHYSICAL_ADDRESS)(UINTN)Head,
NoPages
);
}
} else {