Add pool type masks and use them.

svn path=/trunk/; revision=16945
This commit is contained in:
Filip Navara 2005-08-01 11:33:15 +00:00
parent 981faa01eb
commit 9b42911e3d
4 changed files with 18 additions and 26 deletions

View file

@ -307,6 +307,13 @@ MiAllocateSpecialPool (IN POOL_TYPE PoolType,
extern PVOID MmPagedPoolBase;
extern ULONG MmPagedPoolSize;
#define PAGED_POOL_MASK 1
#define MUST_SUCCEES_POOL_MASK 2
#define CACHE_ALIGNED_POOL_MASK 4
#define QUOTA_POOL_MASK 8
#define SESSION_POOL_MASK 32
#define VERIFIER_POOL_MASK 64
#define MM_PAGED_POOL_SIZE (100*1024*1024)
#define MM_NONPAGED_POOL_SIZE (100*1024*1024)

View file

@ -1630,8 +1630,7 @@ ExAllocateNonPagedPoolWithTag(POOL_TYPE Type, ULONG Size, ULONG Tag, PVOID Calle
{
alignment = PAGE_SIZE;
}
else if (Type == NonPagedPoolCacheAligned ||
Type == NonPagedPoolCacheAlignedMustS)
else if (Type & CACHE_ALIGNED_POOL_MASK)
{
alignment = MM_CACHE_LINE_SIZE;
}

View file

@ -30,31 +30,17 @@ EiAllocatePool(POOL_TYPE PoolType,
{
PVOID Block;
switch(PoolType)
/* FIXME: Handle SESSION_POOL_MASK, VERIFIER_POOL_MASK, QUOTA_POOL_MASK */
if (PoolType & PAGED_POOL_MASK)
{
case NonPagedPool:
case NonPagedPoolMustSucceed:
case NonPagedPoolCacheAligned:
case NonPagedPoolCacheAlignedMustS:
Block =
ExAllocateNonPagedPoolWithTag(PoolType,
NumberOfBytes,
Tag,
Caller);
break;
Block = ExAllocatePagedPoolWithTag(PoolType,NumberOfBytes,Tag);
}
else
{
Block = ExAllocateNonPagedPoolWithTag(PoolType,NumberOfBytes,Tag,Caller);
}
case PagedPool:
case PagedPoolCacheAligned:
Block = ExAllocatePagedPoolWithTag(PoolType,NumberOfBytes,Tag);
break;
default:
return(NULL);
};
if ((PoolType==NonPagedPoolMustSucceed ||
PoolType==NonPagedPoolCacheAlignedMustS) && Block==NULL)
if ((PoolType & MUST_SUCCEES_POOL_MASK) && Block==NULL)
{
KEBUGCHECK(MUST_SUCCEED_POOL_EMPTY);
}

View file

@ -80,7 +80,7 @@ ExAllocatePagedPoolWithTag (IN POOL_TYPE PoolType,
if ( NumberOfBytes >= PAGE_SIZE )
align = 2;
else if ( PoolType == PagedPoolCacheAligned )
else if ( PoolType & CACHE_ALIGNED_POOL_MASK )
align = 1;
else
align = 0;