[NTOS]: Define the POOL_HEADER for x64.
authorSir Richard <sir_richard@svn.reactos.org>
Sat, 5 Jun 2010 16:53:54 +0000 (16:53 +0000)
committerSir Richard <sir_richard@svn.reactos.org>
Sat, 5 Jun 2010 16:53:54 +0000 (16:53 +0000)
[NTOS]: Define POOL_BLOCK_SIZE definition to set the minimum pool block size. In NT, this is equal to a LIST_ENTRY structure, because the Pool Allocator must be able to store a LIST_ENTRY into a freed pool block. This also determines the alignment of pool allocations. So 8 on x86, 16 on x64.
[NTOS]: Don't depend on LIST_ENTRY, but use POOL_BLOCK_SIZE instead (on IA64, if we ever want to support this, the pool block size is different from a LIST_ENTRY/POOL_HEADER).
[NTOS]: The following ASSERTs must hold: the POOL_HEADER must be as big as the the smallest pool block (POOL_BLOCK_SIZE), which must be at least as big as a LIST_ENTRY structure. 8 == 8 == 8 on x86, 16 == 16 == 16 on x64.

svn path=/trunk/; revision=47592

reactos/ntoskrnl/mm/ARM3/miarm.h

index 67eeb42..b5adad3 100644 (file)
@@ -225,13 +225,18 @@ MmProtectToPteMask[32] =
 // Special IRQL value (found in assertions)
 //
 #define MM_NOIRQL (KIRQL)0xFFFFFFFF
-    
+
 //
 // FIXFIX: These should go in ex.h after the pool merge
 //
-#define POOL_LISTS_PER_PAGE (PAGE_SIZE / sizeof(LIST_ENTRY))
+#ifdef _M_AMD64
+#define POOL_BLOCK_SIZE 16
+#else
+#define POOL_BLOCK_SIZE  8
+#endif
+#define POOL_LISTS_PER_PAGE (PAGE_SIZE / POOL_BLOCK_SIZE)
 #define BASE_POOL_TYPE_MASK 1
-#define POOL_MAX_ALLOC (PAGE_SIZE - (sizeof(POOL_HEADER) + sizeof(LIST_ENTRY)))
+#define POOL_MAX_ALLOC (PAGE_SIZE - (sizeof(POOL_HEADER) + POOL_BLOCK_SIZE))
 
 typedef struct _POOL_DESCRIPTOR
 {
@@ -256,16 +261,30 @@ typedef struct _POOL_HEADER
     {
         struct
         {
+#ifdef _M_AMD64
+            ULONG PreviousSize:8;
+            ULONG PoolIndex:8;
+            ULONG BlockSize:8;
+            ULONG PoolType:8;
+#else
             USHORT PreviousSize:9;
             USHORT PoolIndex:7;
             USHORT BlockSize:9;
             USHORT PoolType:7;
+#endif
         };
         ULONG Ulong1;
     };
+#ifdef _M_AMD64
+    ULONG PoolTag;
+#endif
     union
     {
+#ifdef _M_AMD64
+        PEPROCESS ProcessBilled;
+#else
         ULONG PoolTag;
+#endif
         struct
         {
             USHORT AllocatorBackTraceIndex;
@@ -274,11 +293,8 @@ typedef struct _POOL_HEADER
     };
 } POOL_HEADER, *PPOOL_HEADER;
 
-//
-// Everything depends on this
-//
-C_ASSERT(sizeof(POOL_HEADER) == 8);
-C_ASSERT(sizeof(POOL_HEADER) == sizeof(LIST_ENTRY));
+C_ASSERT(sizeof(POOL_HEADER) == POOL_BLOCK_SIZE);
+C_ASSERT(POOL_BLOCK_SIZE == sizeof(LIST_ENTRY));
 
 extern ULONG ExpNumberOfPagedPools;
 extern POOL_DESCRIPTOR NonPagedPoolDescriptor;