Add pool type masks and use them.
Modified: trunk/reactos/ntoskrnl/include/internal/mm.h
Modified: trunk/reactos/ntoskrnl/mm/npool.c
Modified: trunk/reactos/ntoskrnl/mm/pool.c
Modified: trunk/reactos/ntoskrnl/mm/ppool.c
_____
Modified: trunk/reactos/ntoskrnl/include/internal/mm.h
--- trunk/reactos/ntoskrnl/include/internal/mm.h 2005-08-01
11:26:53 UTC (rev 16944)
+++ trunk/reactos/ntoskrnl/include/internal/mm.h 2005-08-01
11:33:15 UTC (rev 16945)
@@ -307,6 +307,13 @@
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)
_____
Modified: trunk/reactos/ntoskrnl/mm/npool.c
--- trunk/reactos/ntoskrnl/mm/npool.c 2005-08-01 11:26:53 UTC (rev
16944)
+++ trunk/reactos/ntoskrnl/mm/npool.c 2005-08-01 11:33:15 UTC (rev
16945)
@@ -1630,8 +1630,7 @@
{
alignment = PAGE_SIZE;
}
- else if (Type == NonPagedPoolCacheAligned ||
- Type == NonPagedPoolCacheAlignedMustS)
+ else if (Type & CACHE_ALIGNED_POOL_MASK)
{
alignment = MM_CACHE_LINE_SIZE;
}
_____
Modified: trunk/reactos/ntoskrnl/mm/pool.c
--- trunk/reactos/ntoskrnl/mm/pool.c 2005-08-01 11:26:53 UTC (rev
16944)
+++ trunk/reactos/ntoskrnl/mm/pool.c 2005-08-01 11:33:15 UTC (rev
16945)
@@ -30,31 +30,17 @@
{
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);
}
_____
Modified: trunk/reactos/ntoskrnl/mm/ppool.c
--- trunk/reactos/ntoskrnl/mm/ppool.c 2005-08-01 11:26:53 UTC (rev
16944)
+++ trunk/reactos/ntoskrnl/mm/ppool.c 2005-08-01 11:33:15 UTC (rev
16945)
@@ -80,7 +80,7 @@
if ( NumberOfBytes >= PAGE_SIZE )
align = 2;
- else if ( PoolType == PagedPoolCacheAligned )
+ else if ( PoolType & CACHE_ALIGNED_POOL_MASK )
align = 1;
else
align = 0;