Added tagging of most allocates
authorDavid Welch <welch@cwcom.net>
Wed, 7 Mar 2001 16:48:45 +0000 (16:48 +0000)
committerDavid Welch <welch@cwcom.net>
Wed, 7 Mar 2001 16:48:45 +0000 (16:48 +0000)
Added facility to print out newly allocated blocks from the non paged pool

svn path=/trunk/; revision=1673

46 files changed:
reactos/include/ddk/obtypes.h
reactos/install.bochs
reactos/ntoskrnl/cc/view.c
reactos/ntoskrnl/ex/resource.c
reactos/ntoskrnl/hal/x86/bus.c
reactos/ntoskrnl/include/internal/mm.h
reactos/ntoskrnl/include/internal/pool.h
reactos/ntoskrnl/io/buildirp.c
reactos/ntoskrnl/io/cntrller.c
reactos/ntoskrnl/io/create.c
reactos/ntoskrnl/io/device.c
reactos/ntoskrnl/io/fs.c
reactos/ntoskrnl/io/iomgr.c
reactos/ntoskrnl/io/irp.c
reactos/ntoskrnl/io/mdl.c
reactos/ntoskrnl/io/shutdown.c
reactos/ntoskrnl/io/symlink.c
reactos/ntoskrnl/io/timer.c
reactos/ntoskrnl/io/vpb.c
reactos/ntoskrnl/kd/kdebug.c
reactos/ntoskrnl/ke/.cvsignore
reactos/ntoskrnl/ke/apc.c
reactos/ntoskrnl/ke/i386/irq.c
reactos/ntoskrnl/ke/kthread.c
reactos/ntoskrnl/ldr/loader.c
reactos/ntoskrnl/lpc/connect.c
reactos/ntoskrnl/lpc/port.c
reactos/ntoskrnl/lpc/reply.c
reactos/ntoskrnl/mm/aspace.c
reactos/ntoskrnl/mm/marea.c
reactos/ntoskrnl/mm/mm.c
reactos/ntoskrnl/mm/npool.c
reactos/ntoskrnl/mm/pageop.c
reactos/ntoskrnl/mm/section.c
reactos/ntoskrnl/mm/virtual.c
reactos/ntoskrnl/nt/.cvsignore
reactos/ntoskrnl/nt/ntevent.c
reactos/ntoskrnl/nt/ntsem.c
reactos/ntoskrnl/nt/nttimer.c
reactos/ntoskrnl/ob/handle.c
reactos/ntoskrnl/ob/namespc.c
reactos/ntoskrnl/ob/object.c
reactos/ntoskrnl/ps/kill.c
reactos/ntoskrnl/ps/process.c
reactos/ntoskrnl/ps/thread.c
reactos/ntoskrnl/se/token.c

index c6eeb3b..efa53f0 100644 (file)
@@ -1,6 +1,6 @@
 #ifndef _INCLUDE_DDK_OBTYPES_H
 #define _INCLUDE_DDK_OBTYPES_H
-/* $Id: obtypes.h,v 1.10 2001/01/28 15:13:11 ekohl Exp $ */
+/* $Id: obtypes.h,v 1.11 2001/03/07 16:48:40 dwelch Exp $ */
 struct _DIRECTORY_OBJECT;
 struct _OBJECT_ATTRIBUTES;
 
@@ -13,103 +13,107 @@ typedef struct _OBJECT_HANDLE_INFORMATION {
 
 typedef struct _OBJECT_TYPE
 {
-   /*
-    * PURPOSE: Name of the type
-    */
-   UNICODE_STRING TypeName;
-   
-   /*
-    * PURPOSE: Total number of objects of this type
-    */
-   ULONG TotalObjects;
-   
-   /*
-    * PURPOSE: Total number of handles of this type
-    */
-   ULONG TotalHandles;
-   
-   /*
-    * PURPOSE: Maximum objects of this type
-    */
-   ULONG MaxObjects;
-   
+  /*
+   * PURPOSE: Tag to be used when allocating objects of this type
+   */
+  ULONG Tag;
+
+  /*
+   * PURPOSE: Name of the type
+   */
+  UNICODE_STRING TypeName;
+  
+  /*
+   * PURPOSE: Total number of objects of this type
+   */
+  ULONG TotalObjects;
+  
+  /*
+   * PURPOSE: Total number of handles of this type
+   */
+  ULONG TotalHandles;
+  
+  /*
+   * PURPOSE: Maximum objects of this type
+   */
+  ULONG MaxObjects;
+  
    /*
     * PURPOSE: Maximum handles of this type
     */
-   ULONG MaxHandles;
-   
-   /*
-    * PURPOSE: Paged pool charge
-    */
+  ULONG MaxHandles;
+  
+  /*
+   * PURPOSE: Paged pool charge
+   */
    ULONG PagedPoolCharge;
-   
-   /*
-    * PURPOSE: Nonpaged pool charge
-    */
-   ULONG NonpagedPoolCharge;
-   
-   /*
-    * PURPOSE: Mapping of generic access rights
-    */
-   PGENERIC_MAPPING Mapping;
-   
-   /*
-    * PURPOSE: Dumps the object
-    * NOTE: To be defined
-    */
-   VOID (*Dump)(VOID);
-   
-   /*
-    * PURPOSE: Opens the object
-    * NOTE: To be defined
-    */
-   VOID (*Open)(VOID);
-   
+  
+  /*
+   * PURPOSE: Nonpaged pool charge
+   */
+  ULONG NonpagedPoolCharge;
+  
+  /*
+   * PURPOSE: Mapping of generic access rights
+   */
+  PGENERIC_MAPPING Mapping;
+  
+  /*
+   * PURPOSE: Dumps the object
+   * NOTE: To be defined
+   */
+  VOID (*Dump)(VOID);
+  
+  /*
+   * PURPOSE: Opens the object
+   * NOTE: To be defined
+   */
+  VOID (*Open)(VOID);
+  
    /*
     * PURPOSE: Called to close an object if OkayToClose returns true
     */
-   VOID (*Close)(PVOID ObjectBody, ULONG HandleCount);
-   
-   /*
-    * PURPOSE: Called to delete an object when the last reference is removed
-    */
-   VOID (*Delete)(PVOID ObjectBody);
-   
-   /*
-    * PURPOSE: Called when an open attempts to open a file apparently
-    * residing within the object
-    * RETURNS
-    *     STATUS_SUCCESS       NextObject was found
-    *     STATUS_UNSUCCESSFUL  NextObject not found
-    *     STATUS_REPARSE       Path changed, restart parsing the path
-    */
+  VOID (*Close)(PVOID ObjectBody, ULONG HandleCount);
+  
+  /*
+   * PURPOSE: Called to delete an object when the last reference is removed
+   */
+  VOID (*Delete)(PVOID ObjectBody);
+  
+  /*
+   * PURPOSE: Called when an open attempts to open a file apparently
+   * residing within the object
+   * RETURNS
+   *     STATUS_SUCCESS       NextObject was found
+   *     STATUS_UNSUCCESSFUL  NextObject not found
+   *     STATUS_REPARSE       Path changed, restart parsing the path
+   */
    NTSTATUS (*Parse)(PVOID ParsedObject,
                     PVOID *NextObject,
                     PUNICODE_STRING FullPath,
                     PWSTR *Path,
                     struct _OBJECT_TYPE* ObjectType);
-   
-   /*
-    */
-   NTSTATUS (*Security)(PVOID Object,
-                       ULONG InfoClass,
-                       PVOID Info,
-                       PULONG InfoLength);
-   
-   /*
-    */
-   VOID (*QueryName)(VOID);
-   
-   /*
-    * PURPOSE: Called when a process asks to close the object
-    */
-   VOID (*OkayToClose)(VOID);
-   
-   NTSTATUS (*Create)(PVOID ObjectBody,
-                     PVOID Parent,
-                     PWSTR RemainingPath,
-                     struct _OBJECT_ATTRIBUTES* ObjectAttributes);
-   
+  
+   /*
+    */
+  NTSTATUS (*Security)(PVOID Object,
+                      ULONG InfoClass,
+                      PVOID Info,
+                      PULONG InfoLength);
+  
+  /*
+   */
+  VOID (*QueryName)(VOID);
+   
+  /*
+   * PURPOSE: Called when a process asks to close the object
+   */
+  VOID (*OkayToClose)(VOID);
+  
+  NTSTATUS (*Create)(PVOID ObjectBody,
+                    PVOID Parent,
+                    PWSTR RemainingPath,
+                    struct _OBJECT_ATTRIBUTES* ObjectAttributes);  
 } OBJECT_TYPE, *POBJECT_TYPE;
 
 
index cdec20b..d3de394 100644 (file)
@@ -1,4 +1,5 @@
 #!/bin/sh
+/sbin/modprobe loop
 #echo "Installing to floppy."
 #mount -t vfat /bochs/1.44a /mnt/floppy -o loop,rw
 #./install-system.sh /mnt/floppy
index 4c054db..7093639 100644 (file)
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: view.c,v 1.15 2001/03/06 14:41:18 dwelch Exp $
+/* $Id: view.c,v 1.16 2001/03/07 16:48:40 dwelch Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -55,6 +55,7 @@
 #include <ddk/ntifs.h>
 #include <internal/mm.h>
 #include <internal/cc.h>
+#include <internal/pool.h>
 
 #define NDEBUG
 #include <internal/debug.h>
@@ -64,6 +65,9 @@
 #define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S))
 #define ROUND_DOWN(N, S) (ROUND_UP(N, S) - S)
 
+#define TAG_CSEG  TAG('C', 'S', 'E', 'G')
+#define TAG_BCB   TAG('B', 'C', 'B', ' ')
+
 /* FUNCTIONS *****************************************************************/
 
 NTSTATUS STDCALL 
@@ -153,7 +157,8 @@ CcRequestCacheSegment(PBCB Bcb,
    
    KeReleaseSpinLock(&Bcb->BcbLock, oldirql);
 
-   current = ExAllocatePool(NonPagedPool, sizeof(CACHE_SEGMENT));
+   current = ExAllocatePoolWithTag(NonPagedPool, sizeof(CACHE_SEGMENT), 
+                                  TAG_CSEG);
    current->BaseAddress = NULL;
    MmCreateMemoryArea(KernelMode,
                      MmGetKernelAddressSpace(),
@@ -252,7 +257,7 @@ CcInitializeFileCache(PFILE_OBJECT FileObject,
 {
    DPRINT("CcInitializeFileCache(FileObject %x)\n",FileObject);
    
-   (*Bcb) = ExAllocatePool(NonPagedPool, sizeof(BCB));
+   (*Bcb) = ExAllocatePoolWithTag(NonPagedPool, sizeof(BCB), TAG_BCB);
    if ((*Bcb) == NULL)
      {
        return(STATUS_UNSUCCESSFUL);
index 5af8a6a..b56ce70 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: resource.c,v 1.15 2000/10/22 16:36:49 ekohl Exp $
+/* $Id: resource.c,v 1.16 2001/03/07 16:48:40 dwelch Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
 
 #include <ddk/ntddk.h>
 #include <internal/ke.h>
+#include <internal/pool.h>
 
 #define NDEBUG
 #include <internal/debug.h>
 
+/* GLOBALS *******************************************************************/
+
+#define TAG_OWNER_TABLE     TAG('R', 'O', 'W', 'N')
+#define TAG_EXCLUSIVE_LOCK  TAG('E', 'R', 'E', 'L')
+#define TAG_SHARED_SEM      TAG('E', 'R', 'S', 'S')
+
 /* FUNCTIONS *****************************************************************/
 
 
@@ -230,8 +237,9 @@ static BOOLEAN EiAddSharedOwner(PERESOURCE Resource)
        DPRINT("Creating owner table\n");
        
        /* allocate ownertable,memset to 0, initialize first entry */
-       Resource->OwnerTable = ExAllocatePool(NonPagedPool,
-                                             sizeof(OWNER_ENTRY)*3);
+       Resource->OwnerTable = 
+         ExAllocatePoolWithTag(NonPagedPool, sizeof(OWNER_ENTRY)*3, 
+                               TAG_OWNER_TABLE);
        if (Resource->OwnerTable == NULL)
          {
             KeBugCheck(0);
@@ -277,9 +285,11 @@ static BOOLEAN EiAddSharedOwner(PERESOURCE Resource)
        DPRINT("Allocating new entry\n");
        
        /* reallocate ownertable with one more entry */
-       freeEntry = ExAllocatePool(NonPagedPool,
-                                  sizeof(OWNER_ENTRY)*
-                                  (Resource->OwnerThreads[1].a.TableSize+1));
+       freeEntry = 
+         ExAllocatePoolWithTag(NonPagedPool,
+                               sizeof(OWNER_ENTRY)*
+                               (Resource->OwnerThreads[1].a.TableSize+1),
+                               TAG_OWNER_TABLE);
        if (freeEntry == NULL)
          {
             KeBugCheck(0);
@@ -563,11 +573,8 @@ ExInitializeResource (
    return(ExInitializeResourceLite(Resource));
 }
 
-NTSTATUS
-STDCALL
-ExInitializeResourceLite (
-       PERESOURCE      Resource
-       )
+NTSTATUS STDCALL
+ExInitializeResourceLite (PERESOURCE   Resource)
 {
    DPRINT("ExInitializeResourceLite(Resource %x)\n", Resource);
    memset(Resource,0,sizeof(ERESOURCE));
@@ -575,11 +582,13 @@ ExInitializeResourceLite (
    Resource->NumberOfExclusiveWaiters = 0;
    KeInitializeSpinLock(&Resource->SpinLock);
    Resource->Flag = 0;
-   Resource->ExclusiveWaiters = ExAllocatePool(NonPagedPool, sizeof(KEVENT));
+   Resource->ExclusiveWaiters = 
+     ExAllocatePoolWithTag(NonPagedPool, sizeof(KEVENT), TAG_EXCLUSIVE_LOCK);
    KeInitializeEvent(Resource->ExclusiveWaiters,
                     SynchronizationEvent,
                     FALSE);
-   Resource->SharedWaiters = ExAllocatePool(NonPagedPool ,sizeof(KSEMAPHORE));
+   Resource->SharedWaiters = 
+     ExAllocatePoolWithTag(NonPagedPool ,sizeof(KSEMAPHORE), TAG_SHARED_SEM);
    KeInitializeSemaphore(Resource->SharedWaiters,0,0x7fffffff);
    Resource->ActiveCount = 0;
    return(0);
index c3a3c6b..13b2d3e 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: bus.c,v 1.5 2000/04/09 15:58:13 ekohl Exp $
+/* $Id: bus.c,v 1.6 2001/03/07 16:48:41 dwelch Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
 
 #include <ddk/ntddk.h>
 #include <internal/hal.h>
+#include <internal/pool.h>
 
 #define NDEBUG
 #include <internal/debug.h>
 
+/* GLOBALS *******************************************************************/
+
+#define TAG_BUS  TAG('B', 'U', 'S', 'H')
 
 /* TYPE DEFINITIONS *********************************************************/
 
@@ -215,7 +219,8 @@ HalpAllocateBusHandler (
 
        DPRINT("HalpAllocateBusHandler()\n");
 
-       BusHandler = ExAllocatePool (NonPagedPool, sizeof(BUS_HANDLER));
+       BusHandler = 
+         ExAllocatePoolWithTag(NonPagedPool, sizeof(BUS_HANDLER), TAG_BUS);
        if (BusHandler == NULL)
                return NULL;
 
index 7a97213..ca5ec37 100644 (file)
@@ -413,6 +413,8 @@ typedef struct _MM_PAGEOP
 } MM_PAGEOP, *PMM_PAGEOP;
 
 VOID
-MiDebugDumpNonPagedPool(VOID);
+MiDebugDumpNonPagedPool(BOOLEAN NewOnly);
+VOID
+MiDebugDumpNonPagedPoolStats(BOOLEAN NewOnly);
 
 #endif
index 000d93e..8fa6ff0 100644 (file)
@@ -10,4 +10,6 @@ PVOID STDCALL ExAllocatePagedPoolWithTag (POOL_TYPE   Type,
                                          ULONG         size,
                                          ULONG         Tag);
 
+#define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
+
 #endif /* __INTERNAL_POOL_H */
index 17116f0..f0b9835 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: buildirp.c,v 1.23 2001/01/13 18:38:09 dwelch Exp $
+/* $Id: buildirp.c,v 1.24 2001/03/07 16:48:41 dwelch Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
 /* INCLUDES *****************************************************************/
 
 #include <ddk/ntddk.h>
+#include <internal/pool.h>
 
 #define NDEBUG
 #include <internal/debug.h>
 
+/* GLOBALS ******************************************************************/
+
+#define TAG_SYS_BUF  TAG('S', 'B', 'U', 'F')
+
 /* FUNCTIONS *****************************************************************/
 
 NTSTATUS IoPrepareIrpBuffer(PIRP Irp,
@@ -32,8 +37,8 @@ NTSTATUS IoPrepareIrpBuffer(PIRP Irp,
    if (DeviceObject->Flags & DO_BUFFERED_IO)
      {
        DPRINT("Doing buffer i/o\n");
-       Irp->AssociatedIrp.SystemBuffer = (PVOID)
-                          ExAllocatePool(NonPagedPool,Length);
+       Irp->AssociatedIrp.SystemBuffer = 
+         (PVOID)ExAllocatePoolWithTag(NonPagedPool,Length, TAG_SYS_BUF);
        if (Irp->AssociatedIrp.SystemBuffer==NULL)
          {
             IoFreeIrp(Irp);
@@ -290,7 +295,7 @@ PIRP STDCALL IoBuildDeviceIoControlRequest(ULONG IoControlCode,
        if (BufferLength)
          {
             Irp->AssociatedIrp.SystemBuffer = (PVOID)
-              ExAllocatePool(NonPagedPool,BufferLength);
+              ExAllocatePoolWithTag(NonPagedPool,BufferLength, TAG_SYS_BUF);
            
             if (Irp->AssociatedIrp.SystemBuffer == NULL)
               {
@@ -315,7 +320,8 @@ PIRP STDCALL IoBuildDeviceIoControlRequest(ULONG IoControlCode,
        if (InputBuffer && InputBufferLength)
          {
             Irp->AssociatedIrp.SystemBuffer = (PVOID)
-               ExAllocatePool(NonPagedPool,InputBufferLength);
+               ExAllocatePoolWithTag(NonPagedPool,InputBufferLength, 
+                                    TAG_SYS_BUF);
             
             if (Irp->AssociatedIrp.SystemBuffer == NULL)
               {
@@ -347,7 +353,8 @@ PIRP STDCALL IoBuildDeviceIoControlRequest(ULONG IoControlCode,
        if (InputBuffer && InputBufferLength)
          {
             Irp->AssociatedIrp.SystemBuffer = (PVOID)
-               ExAllocatePool(NonPagedPool,InputBufferLength);
+               ExAllocatePoolWithTag(NonPagedPool,InputBufferLength, 
+                                    TAG_SYS_BUF);
             
             if (Irp->AssociatedIrp.SystemBuffer==NULL)
               {
index 7ceb7ea..9982128 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: cntrller.c,v 1.4 2000/03/26 19:38:21 ea Exp $
+/* $Id: cntrller.c,v 1.5 2001/03/07 16:48:41 dwelch Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
 /* INCLUDES *****************************************************************/
 
 #include <ddk/ntddk.h>
+#include <internal/pool.h>
 
 #include <internal/debug.h>
 
+/* GLOBALS *******************************************************************/
+
+#define TAG_CQE                    TAG('C', 'Q', 'E', ' ')
+#define TAG_CONTROLLER             TAG('C', 'N', 'T', 'R')
+#define TAG_CONTROLLER_EXTENSION   TAG('C', 'E', 'X', 'T')
+
 /* TYPES ********************************************************************/
 
 typedef struct
@@ -54,7 +61,9 @@ IoAllocateController(PCONTROLLER_OBJECT ControllerObject,
    
    assert_irql(DISPATCH_LEVEL);
    
-   entry=ExAllocatePool(NonPagedPool,sizeof(CONTROLLER_QUEUE_ENTRY));
+   entry = 
+     ExAllocatePoolWithTag(NonPagedPool, sizeof(CONTROLLER_QUEUE_ENTRY),
+                          TAG_CQE);
    assert(entry!=NULL);
    
    entry->DeviceObject = DeviceObject;
@@ -88,13 +97,16 @@ IoCreateController(ULONG Size)
    
    assert_irql(PASSIVE_LEVEL);
    
-   controller = ExAllocatePool(NonPagedPool,sizeof(CONTROLLER_OBJECT));
+   controller = 
+     ExAllocatePoolWithTag(NonPagedPool, sizeof(CONTROLLER_OBJECT),
+                          TAG_CONTROLLER);
    if (controller==NULL)
      {
        return(NULL);
      }
    
-   controller->ControllerExtension=ExAllocatePool(NonPagedPool,Size);
+   controller->ControllerExtension = 
+     ExAllocatePoolWithTag(NonPagedPool, Size, TAG_CONTROLLER_EXTENSION);
    if (controller->ControllerExtension==NULL)
      {
        ExFreePool(controller);
index 62f6fba..59bea4d 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: create.c,v 1.36 2001/02/10 22:51:09 dwelch Exp $
+/* $Id: create.c,v 1.37 2001/03/07 16:48:41 dwelch Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
 #include <internal/ob.h>
 #include <internal/io.h>
 #include <internal/id.h>
+#include <internal/pool.h>
 
 #define NDEBUG
 #include <internal/debug.h>
 
+/* GLOBALS *******************************************************************/
+
+#define TAG_FILE_NAME     TAG('F', 'N', 'A', 'M')
+
 /* FUNCTIONS *************************************************************/
 
 /**********************************************************************
@@ -98,8 +103,10 @@ IopCreateFile (PVOID                        ObjectBody,
    if (NULL == RemainingPath)
      {
        FileObject->Flags = FileObject->Flags | FO_DIRECT_DEVICE_OPEN;
-       FileObject->FileName.Buffer = ExAllocatePool(NonPagedPool,
-                                                    (ObjectAttributes->ObjectName->Length+1)*2);
+       FileObject->FileName.Buffer = 
+         ExAllocatePoolWithTag(NonPagedPool,
+                               (ObjectAttributes->ObjectName->Length+1)*2,
+                               TAG_FILE_NAME);
        FileObject->FileName.Length = ObjectAttributes->ObjectName->Length;
        FileObject->FileName.MaximumLength = 
           ObjectAttributes->ObjectName->MaximumLength;
index 0dbf2fa..f665b26 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: device.c,v 1.25 2000/12/23 02:37:39 dwelch Exp $
+/* $Id: device.c,v 1.26 2001/03/07 16:48:41 dwelch Exp $
  *
  * COPYRIGHT:      See COPYING in the top level directory
  * PROJECT:        ReactOS kernel
 #include <internal/ldr.h>
 #include <internal/id.h>
 #include <internal/ps.h>
+#include <internal/pool.h>
 
 #define NDEBUG
 #include <internal/debug.h>
 
+/* GLOBALS *******************************************************************/
+
+#define TAG_DRIVER             TAG('D', 'R', 'V', 'R')
+#define TAG_DEVICE_EXTENSION   TAG('D', 'E', 'X', 'T')
 
 /* FUNCTIONS ***************************************************************/
 
@@ -252,7 +257,8 @@ IoInitializeDriver(PDRIVER_INITIALIZE DriverEntry)
    PDRIVER_OBJECT DriverObject;
    ULONG i;
    
-   DriverObject = ExAllocatePool(NonPagedPool,sizeof(DRIVER_OBJECT));
+   DriverObject = 
+     ExAllocatePoolWithTag(NonPagedPool, sizeof(DRIVER_OBJECT), TAG_DRIVER);
    if (DriverObject == NULL)
      {
        return STATUS_INSUFFICIENT_RESOURCES;
@@ -397,8 +403,9 @@ IoCreateDevice(PDRIVER_OBJECT DriverObject,
    CreatedDeviceObject->CurrentIrp = NULL;
    CreatedDeviceObject->Flags = 0;
 
-   CreatedDeviceObject->DeviceExtension = ExAllocatePool(NonPagedPool,
-                                                        DeviceExtensionSize);
+   CreatedDeviceObject->DeviceExtension = 
+     ExAllocatePoolWithTag(NonPagedPool, DeviceExtensionSize, 
+                          TAG_DEVICE_EXTENSION);
    if (DeviceExtensionSize > 0 && CreatedDeviceObject->DeviceExtension == NULL)
      {
        ExFreePool(CreatedDeviceObject);
index ee660a5..053bd64 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: fs.c,v 1.15 2000/12/29 13:43:13 ekohl Exp $
+/* $Id: fs.c,v 1.16 2001/03/07 16:48:41 dwelch Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -13,6 +13,7 @@
 
 #include <ddk/ntddk.h>
 #include <internal/io.h>
+#include <internal/pool.h>
 
 #define NDEBUG
 #include <internal/debug.h>
@@ -30,6 +31,8 @@ typedef struct
 static KSPIN_LOCK FileSystemListLock;
 static LIST_ENTRY FileSystemListHead;
 
+#define TAG_FILE_SYSTEM     TAG('F', 'S', 'Y', 'S')
+
 /* FUNCTIONS *****************************************************************/
 
 NTSTATUS
@@ -243,7 +246,8 @@ VOID STDCALL IoRegisterFileSystem(PDEVICE_OBJECT DeviceObject)
    
    DPRINT("IoRegisterFileSystem(DeviceObject %x)\n",DeviceObject);
    
-   fs=ExAllocatePool(NonPagedPool,sizeof(FILE_SYSTEM_OBJECT));
+   fs = ExAllocatePoolWithTag(NonPagedPool, sizeof(FILE_SYSTEM_OBJECT),
+                             TAG_FILE_SYSTEM);
    assert(fs!=NULL);
    
    fs->DeviceObject = DeviceObject;   
index dfce0cc..aa84bcf 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: iomgr.c,v 1.17 2001/01/28 17:37:48 ekohl Exp $
+/* $Id: iomgr.c,v 1.18 2001/03/07 16:48:42 dwelch Exp $
  *
  * COPYRIGHT:            See COPYING in the top level directory
  * PROJECT:              ReactOS kernel
 #include <ddk/ntddk.h>
 #include <internal/ob.h>
 #include <internal/io.h>
+#include <internal/pool.h>
 
 #define NDEBUG
 #include <internal/debug.h>
 
 /* GLOBALS *******************************************************************/
 
+#define TAG_DEVICE_TYPE     TAG('D', 'E', 'V', 'T')
+#define TAG_FILE_TYPE       TAG('F', 'I', 'L', 'E')
+
 /* DATA ********************************************************************/
 
 
@@ -115,11 +119,10 @@ VOID IoInit (VOID)
        /*
         * Register iomgr types: DeviceObjectType
         */
-       IoDeviceObjectType = ExAllocatePool (
-                               NonPagedPool,
-                               sizeof (OBJECT_TYPE)
-                               );
+       IoDeviceObjectType = ExAllocatePool (NonPagedPool, 
+                                            sizeof (OBJECT_TYPE));
 
+       IoDeviceObjectType->Tag = TAG_DEVICE_TYPE;
        IoDeviceObjectType->TotalObjects = 0;
        IoDeviceObjectType->TotalHandles = 0;
        IoDeviceObjectType->MaxObjects = ULONG_MAX;
@@ -151,6 +154,7 @@ VOID IoInit (VOID)
                                sizeof (OBJECT_TYPE)
                                );
 
+       IoFileObjectType->Tag = TAG_FILE_TYPE;
        IoFileObjectType->TotalObjects = 0;
        IoFileObjectType->TotalHandles = 0;
        IoFileObjectType->MaxObjects = ULONG_MAX;
index 2f002c7..225ccd7 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: irp.c,v 1.33 2000/12/23 02:37:39 dwelch Exp $
+/* $Id: irp.c,v 1.34 2001/03/07 16:48:42 dwelch Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
 #include <ddk/ntddk.h>
 #include <internal/io.h>
 #include <internal/ps.h>
+#include <internal/pool.h>
 
 #define NDEBUG
 #include <internal/debug.h>
 
+/* GLOBALS *******************************************************************/
+
+#define TAG_IRP     TAG('I', 'R', 'P', ' ')
+
 /* FUNCTIONS ****************************************************************/
 
 
@@ -150,11 +155,13 @@ IoAllocateIrp (CCHAR StackSize, BOOLEAN ChargeQuota)
    if (ChargeQuota)
      {
 //     Irp = ExAllocatePoolWithQuota(NonPagedPool,IoSizeOfIrp(StackSize));
-       Irp = ExAllocatePool(NonPagedPool,IoSizeOfIrp(StackSize));
+       Irp = ExAllocatePoolWithTag(NonPagedPool, IoSizeOfIrp(StackSize), 
+                                   TAG_IRP);
      }
    else
      { 
-       Irp = ExAllocatePool(NonPagedPool,IoSizeOfIrp(StackSize));
+       Irp = ExAllocatePoolWithTag(NonPagedPool,IoSizeOfIrp(StackSize),
+                                   TAG_IRP);
      }
       
    if (Irp==NULL)
index 8087ff2..2c712b1 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: mdl.c,v 1.5 2000/03/26 19:38:25 ea Exp $
+/* $Id: mdl.c,v 1.6 2001/03/07 16:48:42 dwelch Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
 
 #include <ddk/ntddk.h>
 #include <internal/mmhal.h>
+#include <internal/pool.h>
 
 #include <internal/debug.h>
 
+/* GLOBALS *******************************************************************/
+
+#define TAG_MDL    TAG('M', 'D', 'L', ' ')
+
 /* FUNCTIONS *****************************************************************/
 
 PMDL
@@ -32,11 +37,15 @@ IoAllocateMdl(PVOID VirtualAddress,
      {
 //     Mdl = ExAllocatePoolWithQuota(NonPagedPool,
 //                                   MmSizeOfMdl(VirtualAddress,Length));
-       Mdl = ExAllocatePool(NonPagedPool,MmSizeOfMdl(VirtualAddress,Length));
+       Mdl = ExAllocatePoolWithTag(NonPagedPool,
+                                   MmSizeOfMdl(VirtualAddress,Length),
+                                   TAG_MDL);
      }
    else
      {
-       Mdl = ExAllocatePool(NonPagedPool,MmSizeOfMdl(VirtualAddress,Length));
+       Mdl = ExAllocatePoolWithTag(NonPagedPool,
+                                   MmSizeOfMdl(VirtualAddress,Length),
+                                   TAG_MDL);
      }
    MmInitializeMdl(Mdl,VirtualAddress,Length);
    if (Irp!=NULL && !SecondaryBuffer)
index 4bbc56a..d6387a1 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: shutdown.c,v 1.3 2000/09/10 13:54:01 ekohl Exp $
+/* $Id: shutdown.c,v 1.4 2001/03/07 16:48:42 dwelch Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
 /* INCLUDES *****************************************************************/
 
 #include <ddk/ntddk.h>
+#include <internal/pool.h>
 
 #include <internal/debug.h>
 
-
 /* LOCAL DATA ***************************************************************/
 
 typedef struct _SHUTDOWN_ENTRY
@@ -27,6 +27,7 @@ typedef struct _SHUTDOWN_ENTRY
 static LIST_ENTRY ShutdownListHead;
 static KSPIN_LOCK ShutdownListLock;
 
+#define TAG_SHUTDOWN_ENTRY    TAG('S', 'H', 'U', 'T')
 
 /* FUNCTIONS *****************************************************************/
 
@@ -81,7 +82,8 @@ NTSTATUS STDCALL IoRegisterShutdownNotification(PDEVICE_OBJECT DeviceObject)
 {
    PSHUTDOWN_ENTRY Entry;
 
-   Entry = ExAllocatePool(NonPagedPool, sizeof(SHUTDOWN_ENTRY));
+   Entry = ExAllocatePoolWithTag(NonPagedPool, sizeof(SHUTDOWN_ENTRY),
+                                TAG_SHUTDOWN_ENTRY);
    if (Entry == NULL)
      return STATUS_INSUFFICIENT_RESOURCES;
 
index 09893a1..99b9636 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: symlink.c,v 1.18 2001/01/28 17:37:48 ekohl Exp $
+/* $Id: symlink.c,v 1.19 2001/03/07 16:48:42 dwelch Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -14,6 +14,7 @@
 #include <limits.h>
 #include <ddk/ntddk.h>
 #include <internal/ob.h>
+#include <internal/pool.h>
 
 #define NDEBUG
 #include <internal/debug.h>
@@ -36,6 +37,9 @@ static GENERIC_MAPPING IopSymbolicLinkMapping = {
        STANDARD_RIGHTS_EXECUTE|SYMBOLIC_LINK_QUERY,
        SYMBOLIC_LINK_ALL_ACCESS};
 
+#define TAG_SYMLINK_TTARGET     TAG('S', 'Y', 'T', 'T')
+#define TAG_SYMLINK_TARGET      TAG('S', 'Y', 'M', 'T')
+
 /* FUNCTIONS *****************************************************************/
 
 
@@ -134,8 +138,9 @@ IopParseSymbolicLink (
        if (RemainingPath && *RemainingPath)
                TargetPath.MaximumLength += (wcslen (*RemainingPath) * sizeof(WCHAR));
        TargetPath.Length = TargetPath.MaximumLength - sizeof(WCHAR);
-       TargetPath.Buffer = ExAllocatePool (NonPagedPool,
-                                           TargetPath.MaximumLength);
+       TargetPath.Buffer = ExAllocatePoolWithTag (NonPagedPool,
+                                                  TargetPath.MaximumLength,
+                                                  TAG_SYMLINK_TTARGET);
        wcscpy (TargetPath.Buffer, SymlinkObject->TargetName.Buffer);
        if (RemainingPath && *RemainingPath)
                wcscat (TargetPath.Buffer, *RemainingPath);
@@ -171,6 +176,7 @@ VOID IoInitSymbolicLinkImplementation (VOID)
 {
    IoSymbolicLinkType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
    
+   IoSymbolicLinkType->Tag = TAG('S', 'Y', 'M', 'T');
    IoSymbolicLinkType->TotalObjects = 0;
    IoSymbolicLinkType->TotalHandles = 0;
    IoSymbolicLinkType->MaxObjects = ULONG_MAX;
@@ -381,10 +387,9 @@ IoCreateSymbolicLink (
        SymbolicLink->TargetName.MaximumLength = 
                ((wcslen(DeviceName->Buffer) + 1) * sizeof(WCHAR));
        SymbolicLink->TargetName.Buffer =
-               ExAllocatePool(
-                       NonPagedPool,
-                       SymbolicLink->TargetName.MaximumLength
-                       );
+               ExAllocatePoolWithTag(NonPagedPool,
+                              SymbolicLink->TargetName.MaximumLength,
+                              TAG_SYMLINK_TARGET);
        RtlCopyUnicodeString(
                & (SymbolicLink->TargetName),
                DeviceName
@@ -501,11 +506,10 @@ NtCreateSymbolicLinkObject (
        SymbolicLink->TargetName.Length = 0;
        SymbolicLink->TargetName.MaximumLength = 
                ((wcslen(DeviceName->Buffer) + 1) * sizeof(WCHAR));
-       SymbolicLink->TargetName.Buffer =
-               ExAllocatePool(
-                       NonPagedPool,
-                       SymbolicLink->TargetName.MaximumLength
-                       );
+       SymbolicLink->TargetName.Buffer = 
+         ExAllocatePoolWithTag(NonPagedPool,
+                               SymbolicLink->TargetName.MaximumLength,
+                               TAG_SYMLINK_TARGET);
        RtlCopyUnicodeString(
                & (SymbolicLink->TargetName),
                DeviceName
index 1fa2946..51bf08f 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: timer.c,v 1.5 2000/03/26 19:38:26 ea Exp $
+/* $Id: timer.c,v 1.6 2001/03/07 16:48:42 dwelch Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
 /* INCLUDES *****************************************************************/
 
 #include <ddk/ntddk.h>
+#include <internal/pool.h>
 
 #define NDEBUG
 #include <internal/debug.h>
 
+/* GLBOALS *******************************************************************/
+
+#define TAG_IO_TIMER      TAG('I', 'O', 'T', 'M')
+
 /* FUNCTIONS *****************************************************************/
 
 NTSTATUS
@@ -34,7 +39,8 @@ IoInitializeTimer(PDEVICE_OBJECT DeviceObject,
  * RETURNS: Status
  */
 {
-   DeviceObject->Timer = ExAllocatePool(NonPagedPool,sizeof(IO_TIMER));
+   DeviceObject->Timer = ExAllocatePoolWithTag(NonPagedPool, sizeof(IO_TIMER),
+                                              TAG_IO_TIMER);
    KeInitializeTimer(&(DeviceObject->Timer->timer));
    KeInitializeDpc(&(DeviceObject->Timer->dpc),
                   (PKDEFERRED_ROUTINE)TimerRoutine,Context);
index 6c9e668..281d39b 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: vpb.c,v 1.10 2000/07/07 02:10:50 ekohl Exp $
+/* $Id: vpb.c,v 1.11 2001/03/07 16:48:42 dwelch Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -13,6 +13,7 @@
 
 #include <ddk/ntddk.h>
 #include <internal/io.h>
+#include <internal/pool.h>
 
 #define NDEBUG
 #include <internal/debug.h>
@@ -21,6 +22,8 @@
 
 static KSPIN_LOCK IoVpbLock;
 
+#define TAG_VPB    TAG('V', 'P', 'B', ' ')
+
 /* FUNCTIONS *****************************************************************/
 
 VOID
@@ -35,7 +38,7 @@ NTSTATUS IoAttachVpb(PDEVICE_OBJECT DeviceObject)
 {
    PVPB Vpb;
    
-   Vpb = ExAllocatePool(NonPagedPool,sizeof(VPB));
+   Vpb = ExAllocatePoolWithTag(NonPagedPool, sizeof(VPB), TAG_VPB);
    if (Vpb==NULL)
      {
        return(STATUS_UNSUCCESSFUL);
index 32989b5..52404eb 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: kdebug.c,v 1.20 2001/03/07 08:57:08 dwelch Exp $
+/* $Id: kdebug.c,v 1.21 2001/03/07 16:48:42 dwelch Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -342,12 +342,24 @@ KdSystemDebugControl(ULONG Code)
 {
   if (Code == 0)
     {
-      MiDebugDumpNonPagedPool();
+      MiDebugDumpNonPagedPool(FALSE);
     }
-  if (Code == 1)
+  else if (Code == 1)
     {
       KeBugCheck(0);
     }
+  else if (Code == 2)
+    {
+      MiDebugDumpNonPagedPoolStats(FALSE);
+    }
+  else if (Code == 3)
+    {
+      MiDebugDumpNonPagedPool(TRUE);
+    }
+  else if (Code == 4)
+    {
+      MiDebugDumpNonPagedPoolStats(TRUE);
+    }
 }
 
 /* EOF */
index c7fbdad..36de49a 100644 (file)
@@ -1 +1 @@
-exports.c
+*.d
\ No newline at end of file
index 6905c6d..99c130b 100644 (file)
@@ -16,6 +16,7 @@
 #include <internal/ps.h>
 #include <internal/ke.h>
 #include <internal/ldr.h>
+#include <internal/pool.h>
 
 #define NDEBUG
 #include <internal/debug.h>
@@ -31,6 +32,8 @@ extern KSPIN_LOCK PiThreadListLock;
 
 VOID PsTerminateCurrentThread(NTSTATUS ExitStatus);
 
+#define TAG_KAPC     TAG('K', 'A', 'P', 'C')
+
 /* FUNCTIONS *****************************************************************/
 
 VOID KiRundownThread(VOID)
@@ -467,7 +470,7 @@ NTSTATUS STDCALL NtQueueApcThread(HANDLE                    ThreadHandle,
        return(Status);
      }
    
-   Apc = ExAllocatePool(NonPagedPool, sizeof(KAPC));
+   Apc = ExAllocatePoolWithTag(NonPagedPool, sizeof(KAPC), TAG_KAPC);
    if (Apc == NULL)
      {
        ObDereferenceObject(Thread);
index ecaa2a0..4cf91e7 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: irq.c,v 1.5 2001/02/06 00:11:19 dwelch Exp $
+/* $Id: irq.c,v 1.6 2001/03/07 16:48:43 dwelch Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -23,6 +23,7 @@
 #include <internal/ke.h>
 #include <internal/ps.h>
 #include <internal/i386/segment.h>
+#include <internal/pool.h>
 
 #define NDEBUG
 #include <internal/debug.h>
@@ -79,6 +80,8 @@ static LIST_ENTRY isr_table[NR_IRQS]={{NULL,NULL},};
 static PKSPIN_LOCK isr_lock[NR_IRQS] = {NULL,};
 static KSPIN_LOCK isr_table_lock = {0,};
 
+#define TAG_ISR_LOCK     TAG('I', 'S', 'R', 'L')
+#define TAG_KINTERRUPT   TAG('K', 'I', 'S', 'R')
 
 /* FUNCTIONS ****************************************************************/
 
@@ -264,7 +267,9 @@ KeConnectInterrupt(PKINTERRUPT InterruptObject)
      }
    else
      {
-       isr_lock[Vector]=ExAllocatePool(NonPagedPool,sizeof(KSPIN_LOCK));
+       isr_lock[Vector] =
+         ExAllocatePoolWithTag(NonPagedPool, sizeof(KSPIN_LOCK),
+                               TAG_ISR_LOCK);
        KeInitializeSpinLock(isr_lock[Vector]);
      }
 
@@ -397,7 +402,8 @@ IoConnectInterrupt(PKINTERRUPT* InterruptObject,
    /*
     * Initialize interrupt object
     */
-   Interrupt=ExAllocatePool(NonPagedPool,sizeof(KINTERRUPT));
+   Interrupt=ExAllocatePoolWithTag(NonPagedPool,sizeof(KINTERRUPT),
+                                  TAG_KINTERRUPT);
    if (Interrupt==NULL)
      {
        return(STATUS_INSUFFICIENT_RESOURCES);
index 8027f03..b3f73ee 100644 (file)
@@ -30,6 +30,7 @@
 #include <internal/ke.h>
 #include <internal/ps.h>
 #include <internal/id.h>
+#include <internal/pool.h>
 
 #define NDEBUG
 #include <internal/debug.h>
@@ -51,6 +52,10 @@ PiSuspendThreadNormalRoutine(PVOID NormalContext,
                             PVOID SystemArgument1,
                             PVOID SystemArgument2);
 
+/* GLOBALS *******************************************************************/
+
+#define TAG_THREAD_STACK    TAG('T', 'S', 'T', 'K')
+
 /* FUNCTIONS *****************************************************************/
 
 VOID 
@@ -70,7 +75,8 @@ KeInitializeThread(PKPROCESS Process, PKTHREAD Thread, BOOLEAN First)
    InitializeListHead(&Thread->MutantListHead);
    if (!First)
      {
-       KernelStack = ExAllocatePool(NonPagedPool, MM_STACK_SIZE);
+       KernelStack = ExAllocatePoolWithTag(NonPagedPool, MM_STACK_SIZE,
+                                          TAG_THREAD_STACK);
        Thread->InitialStack = KernelStack + MM_STACK_SIZE;
        Thread->StackBase = KernelStack + MM_STACK_SIZE;
        Thread->StackLimit = (ULONG)KernelStack;
index e850c08..31df176 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: loader.c,v 1.67 2001/02/21 18:18:31 ekohl Exp $
+/* $Id: loader.c,v 1.68 2001/03/07 16:48:43 dwelch Exp $
  * 
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -29,6 +29,7 @@
 #include <internal/ob.h>
 #include <internal/ps.h>
 #include <internal/ldr.h>
+#include <internal/pool.h>
 
 #define NDEBUG
 #include <internal/debug.h>
@@ -46,6 +47,9 @@ NTSTATUS IoInitializeDriver(PDRIVER_INITIALIZE DriverEntry);
 LIST_ENTRY ModuleListHead;
 POBJECT_TYPE EXPORTED IoDriverObjectType = NULL;
 
+#define TAG_DRIVER_MEM  TAG('D', 'R', 'V', 'M')
+#define TAG_SYM_BUF     TAG('S', 'Y', 'M', 'B')
+
 /* FORWARD DECLARATIONS ******************************************************/
 
 PMODULE_OBJECT  LdrLoadModule(PUNICODE_STRING Filename);
@@ -82,6 +86,7 @@ VOID LdrInitModuleManagement(VOID)
 
   /*  Register the process object type  */
   IoDriverObjectType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
+  IoDriverObjectType->Tag = TAG('D', 'R', 'V', 'T');
   IoDriverObjectType->TotalObjects = 0;
   IoDriverObjectType->TotalHandles = 0;
   IoDriverObjectType->MaxObjects = ULONG_MAX;
@@ -340,8 +345,9 @@ LdrLoadModule(PUNICODE_STRING Filename)
   CHECKPOINT;
 
   /*  Allocate nonpageable memory for driver  */
-  ModuleLoadBase = ExAllocatePool(NonPagedPool,
-                                  FileStdInfo.EndOfFile.u.LowPart);
+  ModuleLoadBase = ExAllocatePoolWithTag(NonPagedPool,
+                                        FileStdInfo.EndOfFile.u.LowPart,
+                                        TAG_DRIVER_MEM);
 
   if (ModuleLoadBase == NULL)
     {
@@ -789,7 +795,7 @@ LdrPEProcessModule(PVOID ModuleLoadBase, PUNICODE_STRING FileName)
     {
       PIMAGE_IMPORT_MODULE_DIRECTORY ImportModuleDirectory;
 
-      SymbolNameBuf = ExAllocatePool(NonPagedPool, 512);
+      SymbolNameBuf = ExAllocatePoolWithTag(NonPagedPool, 512, TAG_SYM_BUF);
 
       /*  Process each import module  */
       ImportModuleDirectory = (PIMAGE_IMPORT_MODULE_DIRECTORY)
index abce662..ba09801 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: connect.c,v 1.4 2001/01/29 00:13:21 ea Exp $
+/* $Id: connect.c,v 1.5 2001/03/07 16:48:43 dwelch Exp $
  * 
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
 #include <internal/ob.h>
 #include <internal/port.h>
 #include <internal/dbg.h>
+#include <internal/pool.h>
 
 #define NDEBUG
 #include <internal/debug.h>
 
+/* GLOBALS *******************************************************************/
+
+#define TAG_LPC_CONNECT_MESSAGE   TAG('L', 'P', 'C', 'C')
+
+/* FUNCTIONS *****************************************************************/
 
 /**********************************************************************
  * NAME                                                        EXPORTED
@@ -98,8 +104,9 @@ NtConnectPort (PHANDLE                               ConnectedPort,
    */
   DPRINT("Creating request message\n");
   
-  Request = ExAllocatePool (NonPagedPool,
-                           (sizeof (LPC_MESSAGE) + ConnectInfoLength));
+  Request = ExAllocatePoolWithTag (NonPagedPool,
+                                  (sizeof (LPC_MESSAGE) + ConnectInfoLength),
+                                  TAG_LPC_CONNECT_MESSAGE);
    
   Request->DataSize = ConnectInfoLength;
   Request->MessageSize = sizeof(LPC_MESSAGE) + ConnectInfoLength;
index b9980d0..a236793 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: port.c,v 1.4 2001/01/28 17:38:12 ekohl Exp $
+/* $Id: port.c,v 1.5 2001/03/07 16:48:43 dwelch Exp $
  * 
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -20,6 +20,7 @@
 #include <internal/ob.h>
 #include <internal/port.h>
 #include <internal/dbg.h>
+#include <internal/pool.h>
 
 #define NDEBUG
 #include <internal/debug.h>
@@ -45,6 +46,7 @@ NTSTATUS NiInitPort (VOID)
    
    RtlInitUnicodeString(&ExPortType->TypeName,L"Port");
    
+   ExPortType->Tag = TAG('L', 'P', 'R', 'T');
    ExPortType->MaxObjects = ULONG_MAX;
    ExPortType->MaxHandles = ULONG_MAX;
    ExPortType->TotalObjects = 0;
index 5875ce9..82b1eec 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: reply.c,v 1.5 2001/01/29 00:13:22 ea Exp $
+/* $Id: reply.c,v 1.6 2001/03/07 16:48:43 dwelch Exp $
  * 
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
 #include <internal/ob.h>
 #include <internal/port.h>
 #include <internal/dbg.h>
+#include <internal/pool.h>
 
 #define NDEBUG
 #include <internal/debug.h>
 
+/* GLOBALS *******************************************************************/
+
+#define TAG_LPC_MESSAGE   TAG('L', 'P', 'C', 'M')
+
 /* FUNCTIONS *****************************************************************/
 
 /**********************************************************************
@@ -47,7 +52,8 @@ EiReplyOrRequestPort (IN      PEPORT          Port,
        KeBugCheck(0);
      }
 
-   MessageReply = ExAllocatePool(NonPagedPool, sizeof(QUEUEDMESSAGE));
+   MessageReply = ExAllocatePoolWithTag(NonPagedPool, sizeof(QUEUEDMESSAGE),
+                                       TAG_LPC_MESSAGE);
    MessageReply->Sender = Sender;
    
    if (LpcReply != NULL)
index 1543fcb..e51e205 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: aspace.c,v 1.5 2001/01/08 02:14:05 dwelch Exp $
+/* $Id: aspace.c,v 1.6 2001/03/07 16:48:43 dwelch Exp $
  * 
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -14,6 +14,7 @@
 #include <ddk/ntddk.h>
 #include <internal/mm.h>
 #include <internal/ps.h>
+#include <internal/pool.h>
 
 #include <internal/debug.h>
 
@@ -21,6 +22,8 @@
 
 STATIC MADDRESS_SPACE KernelAddressSpace;
 
+#define TAG_PTRC      TAG('P', 'T', 'R', 'C')
+
 /* FUNCTIONS *****************************************************************/
 
 VOID 
@@ -77,7 +80,8 @@ MmInitializeAddressSpace(PEPROCESS Process,
    if (Process != NULL)
      {
        AddressSpace->PageTableRefCountTable = 
-         ExAllocatePool(NonPagedPool, 768 * sizeof(USHORT));
+         ExAllocatePoolWithTag(NonPagedPool, 768 * sizeof(USHORT),
+                               TAG_PTRC);
        AddressSpace->PageTableRefCountTableSize = 768;
      }
    else
@@ -91,5 +95,9 @@ MmInitializeAddressSpace(PEPROCESS Process,
 NTSTATUS 
 MmDestroyAddressSpace(PMADDRESS_SPACE AddressSpace)
 {
+  if (AddressSpace->PageTableRefCountTable != NULL)
+    {
+      ExFreePool(AddressSpace->PageTableRefCountTable);
+    }
    return(STATUS_SUCCESS);
 }
index 2b6b051..6e1fb03 100644 (file)
 #include <internal/mm.h>
 #include <internal/mmhal.h>
 #include <internal/ps.h>
+#include <internal/pool.h>
 
 #define NDEBUG
 #include <internal/debug.h>
 
+/* GLOBALS *******************************************************************/
+
+#define TAG_MAREA   TAG('M', 'A', 'R', 'E')
+
 /* FUNCTIONS *****************************************************************/
 
 VOID MmDumpMemoryAreas(PLIST_ENTRY ListHead)
@@ -333,7 +338,8 @@ PMEMORY_AREA MmSplitMemoryArea(PEPROCESS Process,
    PMEMORY_AREA Result;
    PMEMORY_AREA Split;
    
-   Result = ExAllocatePool(NonPagedPool,sizeof(MEMORY_AREA));
+   Result = ExAllocatePoolWithTag(NonPagedPool, sizeof(MEMORY_AREA), 
+                                 TAG_MAREA);
    RtlZeroMemory(Result,sizeof(MEMORY_AREA));
    Result->Type = NewType;
    Result->BaseAddress = BaseAddress;
@@ -358,7 +364,8 @@ PMEMORY_AREA MmSplitMemoryArea(PEPROCESS Process,
        return(Result);
      }
       
-   Split = ExAllocatePool(NonPagedPool,sizeof(MEMORY_AREA));
+   Split = ExAllocatePoolWithTag(NonPagedPool, sizeof(MEMORY_AREA),
+                                TAG_MAREA);
    RtlCopyMemory(Split,OriginalMemoryArea,sizeof(MEMORY_AREA));
    Split->BaseAddress = BaseAddress + Length;
    Split->Length = OriginalMemoryArea->Length - (((ULONG)BaseAddress) 
@@ -416,7 +423,8 @@ NTSTATUS MmCreateMemoryArea(PEPROCESS Process,
          }
      }
    
-   *Result = ExAllocatePool(NonPagedPool,sizeof(MEMORY_AREA));
+   *Result = ExAllocatePoolWithTag(NonPagedPool, sizeof(MEMORY_AREA),
+                                  TAG_MAREA);
    RtlZeroMemory(*Result,sizeof(MEMORY_AREA));
    (*Result)->Type = Type;
    (*Result)->BaseAddress = *BaseAddress;
index 4f3f402..2c47b02 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: mm.c,v 1.42 2001/02/14 02:53:53 dwelch Exp $
+/* $Id: mm.c,v 1.43 2001/03/07 16:48:43 dwelch Exp $
  *
  * COPYRIGHT:   See COPYING in the top directory
  * PROJECT:     ReactOS kernel 
@@ -88,6 +88,7 @@ NTSTATUS MmReleaseMmInfo(PEPROCESS Process)
    Mmi386ReleaseMmInfo(Process);
    
    MmUnlockAddressSpace(&Process->AddressSpace);
+   MmDestroyAddressSpace(&Process->AddressSpace);
    
    DPRINT("Finished MmReleaseMmInfo()\n");
    return(STATUS_SUCCESS);
index a7112a5..329df03 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: npool.c,v 1.35 2001/03/07 08:57:08 dwelch Exp $
+/* $Id: npool.c,v 1.36 2001/03/07 16:48:43 dwelch Exp $
  *
  * COPYRIGHT:    See COPYING in the top level directory
  * PROJECT:      ReactOS kernel
@@ -26,8 +26,6 @@
 #define NDEBUG
 #include <internal/debug.h>
 
-
-
 #if 0
 #define VALIDATE_POOL validate_kernel_pool()
 #else
@@ -42,7 +40,8 @@
 
 /* TYPES *******************************************************************/
 
-#define BLOCK_HDR_MAGIC (0xdeadbeef)
+#define BLOCK_HDR_USED_MAGIC (0xdeadbeef)
+#define BLOCK_HDR_FREE_MAGIC (0xceadbeef)
 
 /*
  * fields present at the start of a block (this is for internal use only)
@@ -55,6 +54,8 @@ typedef struct _BLOCK_HDR
   struct _BLOCK_HDR* next;
   ULONG Tag;
   PVOID Caller;
+  struct _BLOCK_HDR* tag_next;
+  BOOLEAN Dumped;
 } BLOCK_HDR;
 
 /* GLOBALS *****************************************************************/
@@ -80,17 +81,166 @@ unsigned int EiUsedNonPagedPool = 0;
 unsigned int 
 alloc_pool_region(unsigned int nr_pages);
 
+#define TAG_HASH_TABLE_SIZE       (1024)
+static BLOCK_HDR* tag_hash_table[TAG_HASH_TABLE_SIZE];
+
 /* FUNCTIONS ***************************************************************/
 
+VOID
+MiRemoveFromTagHashTable(BLOCK_HDR* block)
+{
+  BLOCK_HDR* previous;
+  BLOCK_HDR* current;
+  ULONG hash;
+
+  if (block->Tag == 0)
+    {
+      return;
+    }
+
+  hash = block->Tag % TAG_HASH_TABLE_SIZE;
+  
+  previous = NULL;
+  current = tag_hash_table[hash];
+  while (current != NULL)
+    {
+      if (current == block)
+       {
+         if (previous == NULL)
+           {
+             tag_hash_table[hash] = block->tag_next;
+           }
+         else
+           {
+             previous->tag_next = block->tag_next;
+           }
+         return;
+       }
+      previous = current;
+      current = current->tag_next;
+    }
+  DPRINT1("Tagged block wasn't on hash table list (Tag %x Caller %x)\n",
+         block->Tag, block->Caller);
+  KeBugCheck(0);
+}
+
+VOID
+MiAddToTagHashTable(BLOCK_HDR* block)
+{
+  ULONG hash;
+  BLOCK_HDR* current;
+  BLOCK_HDR* previous;
+
+  if (block->Tag == 0)
+    {
+      return;
+    }
+
+  hash = block->Tag % TAG_HASH_TABLE_SIZE;
+
+  previous = NULL;
+  current = tag_hash_table[hash];
+  while (current != NULL)
+    {
+      if (current->Tag == block->Tag)
+       {
+         block->tag_next = current->tag_next;
+         current->tag_next = block;
+         return;
+       }
+      previous = current;
+      current = current->tag_next;
+    }
+  block->tag_next = NULL;
+  if (previous == NULL)
+    {
+      tag_hash_table[hash] = block;
+    }
+  else
+    {
+      previous->tag_next = block;
+    }
+}
+
 VOID ExInitNonPagedPool(ULONG BaseAddress)
 {
    kernel_pool_base = BaseAddress;
    KeInitializeSpinLock(&MmNpoolLock);
    MmInitKernelMap((PVOID)BaseAddress);
+   memset(tag_hash_table, 0, sizeof(tag_hash_table));
+}
+
+VOID static
+MiDumpTagStats(ULONG CurrentTag, ULONG CurrentNrBlocks, ULONG CurrentSize)
+{
+  CHAR c1, c2, c3, c4;
+  
+  c1 = (CurrentTag >> 24) & 0xFF;
+  c2 = (CurrentTag >> 16) & 0xFF;
+  c3 = (CurrentTag >> 8) & 0xFF;
+  c4 = CurrentTag & 0xFF;
+  
+  if (isprint(c1) && isprint(c2) && isprint(c3) && isprint(c4))
+    {
+      DbgPrint("Tag %x (%c%c%c%c) Blocks %d Total Size %d Average Size %d\n",
+              CurrentTag, c4, c3, c2, c1, CurrentNrBlocks,
+              CurrentSize, CurrentSize / CurrentNrBlocks);
+    }
+  else
+    {
+      DbgPrint("Tag %x Blocks %d Total Size %d Average Size %d\n",
+              CurrentTag, CurrentNrBlocks, CurrentSize,
+              CurrentSize / CurrentNrBlocks);
+    }
 }
 
 VOID
-MiDebugDumpNonPagedPool(VOID)
+MiDebugDumpNonPagedPoolStats(BOOLEAN NewOnly)
+{
+  ULONG i;
+  BLOCK_HDR* current;
+  ULONG CurrentTag;
+  ULONG CurrentNrBlocks;
+  ULONG CurrentSize;
+
+  DbgPrint("******* Dumping non paging pool stats ******\n");
+  for (i = 0; i < TAG_HASH_TABLE_SIZE; i++)
+    {
+      CurrentTag = 0;
+      CurrentNrBlocks = 0;
+      CurrentSize = 0;
+      current = tag_hash_table[i];
+      while (current != NULL)
+       {
+         if (current->Tag != CurrentTag)
+           {
+             if (CurrentTag != 0 && CurrentNrBlocks != 0)
+               {
+                 MiDumpTagStats(CurrentTag, CurrentNrBlocks, CurrentSize);
+               }
+             CurrentTag = current->Tag;
+             CurrentNrBlocks = 0;
+             CurrentSize = 0;
+           }
+
+         if (!NewOnly || !current->Dumped)
+           {
+             CurrentNrBlocks++;
+             CurrentSize = CurrentSize + current->size;
+             current->Dumped = TRUE;
+           }
+         current = current->tag_next;
+       }
+      if (CurrentTag != 0 && CurrentNrBlocks != 0)
+       {
+         MiDumpTagStats(CurrentTag, CurrentNrBlocks, CurrentSize);
+       }
+    }
+   DbgPrint("***************** Dump Complete ***************\n");
+}
+
+VOID
+MiDebugDumpNonPagedPool(BOOLEAN NewOnly)
 {
    BLOCK_HDR* current = used_list_head;
    KIRQL oldIrql;
@@ -100,12 +250,28 @@ MiDebugDumpNonPagedPool(VOID)
    DbgPrint("******* Dumping non paging pool contents ******\n");
    while (current != NULL)
      {
-       DbgPrint("Size 0x%x Tag 0x%x (%c%c%c%c) Allocator 0x%x\n",
-               current->size, current->Tag, 
-               current->Tag >> 24, (current->Tag >> 16) & 0xFF,
-               (current->Tag >> 8) & 0xFF, current->Tag & 0xFF,
-               current->Caller);
-
+       if (!NewOnly || !current->Dumped)
+        {
+          CHAR c1, c2, c3, c4;
+          
+          c1 = (current->Tag >> 24) & 0xFF;
+          c2 = (current->Tag >> 16) & 0xFF;
+          c3 = (current->Tag >> 8) & 0xFF;
+          c4 = current->Tag & 0xFF;
+          
+          if (isprint(c1) && isprint(c2) && isprint(c3) && isprint(c4))
+            {
+              DbgPrint("Size 0x%x Tag 0x%x (%c%c%c%c) Allocator 0x%x\n",
+                       current->size, current->Tag, c4, c3, c2, c1, 
+                       current->Caller);
+            }
+          else
+            {
+              DbgPrint("Size 0x%x Tag 0x%x Allocator 0x%x\n",
+                       current->size, current->Tag, current->Caller);
+            }
+          current->Dumped = TRUE;
+        }
        current=current->next;
      }
    DbgPrint("***************** Dump Complete ***************\n");
@@ -125,7 +291,7 @@ static void validate_free_list(void)
      {
        unsigned int base_addr = (int)current;
 
-       if (current->magic != BLOCK_HDR_MAGIC)
+       if (current->magic != BLOCK_HDR_FREE_MAGIC)
          {
             DbgPrint("Bad block magic (probable pool corruption) at %x\n",
                      current);
@@ -173,7 +339,7 @@ static void validate_used_list(void)
      {
        unsigned int base_addr = (int)current;
        
-       if (current->magic != BLOCK_HDR_MAGIC)
+       if (current->magic != BLOCK_HDR_USED_MAGIC)
          {
             DbgPrint("Bad block magic (probable pool corruption) at %x\n",
                      current);
@@ -217,7 +383,7 @@ static void check_duplicates(BLOCK_HDR* blk)
    BLOCK_HDR* current=free_list_head;
    while (current!=NULL)
      {
-       if (current->magic != BLOCK_HDR_MAGIC)
+       if (current->magic != BLOCK_HDR_FREE_MAGIC)
          {
             DbgPrint("Bad block magic (probable pool corruption) at %x\n",
                      current);
@@ -288,14 +454,14 @@ static void add_to_free_list(BLOCK_HDR* blk)
  * FUNCTION: add the block to the free list (internal)
  */
 {
-        blk->next=free_list_head;
-        blk->previous=NULL;
-        if (free_list_head!=NULL)
-        {
-                free_list_head->previous=blk;
-        }
-        free_list_head=blk;
-        nr_free_blocks++;
+  blk->next=free_list_head;
+  blk->previous=NULL;
+  if (free_list_head!=NULL)
+    {
+      free_list_head->previous=blk;
+    }
+  free_list_head=blk;
+  nr_free_blocks++;
 }
 
 static void add_to_used_list(BLOCK_HDR* blk)
@@ -303,41 +469,41 @@ static void add_to_used_list(BLOCK_HDR* blk)
  * FUNCTION: add the block to the used list (internal)
  */
 {
-        blk->next=used_list_head;
-        blk->previous=NULL;
-        if (used_list_head!=NULL)
-        {
-                used_list_head->previous=blk;
-        }
-        used_list_head=blk;
-        EiNrUsedBlocks++;
+  blk->next=used_list_head;
+  blk->previous=NULL;
+  if (used_list_head!=NULL)
+    {
+      used_list_head->previous=blk;
+    }
+  used_list_head=blk;
+  EiNrUsedBlocks++;
 }
 
 
 static void remove_from_free_list(BLOCK_HDR* current)
 {
-        if (current->next==NULL&&current->previous==NULL)
-        {
-                free_list_head=NULL;                                
-        }
-        else
-        {
-          if (current->next==NULL)
-            {
-               current->previous->next=NULL;
-            }
-          else if (current->previous==NULL)
-            {
-               current->next->previous=NULL;
-               free_list_head=current->next;
-            }
-          else
-            {
-               current->next->previous=current->previous;
-               current->previous->next=current->next;
-            }
-        }
-        nr_free_blocks--;
+  if (current->next==NULL&&current->previous==NULL)
+    {
+      free_list_head=NULL;                                
+    }
+  else
+    {
+      if (current->next==NULL)
+       {
+         current->previous->next=NULL;
+       }
+      else if (current->previous==NULL)
+       {
+         current->next->previous=NULL;
+         free_list_head=current->next;
+       }
+      else
+       {
+         current->next->previous=current->previous;
+         current->previous->next=current->next;
+       }
+    }
+  nr_free_blocks--;
 }
 
 
@@ -421,13 +587,13 @@ static BLOCK_HDR* grow_kernel_pool(unsigned int size, ULONG Tag, PVOID Caller)
      {
        used_blk = (struct _BLOCK_HDR *)start;
        OLD_DPRINT("Creating block at %x\n",start);
-       used_blk->magic = BLOCK_HDR_MAGIC;
+       used_blk->magic = BLOCK_HDR_USED_MAGIC;
         used_blk->size = size;
        add_to_used_list(used_blk);
        
        free_blk = (BLOCK_HDR *)(start + sizeof(BLOCK_HDR) + size);
        OLD_DPRINT("Creating block at %x\n",free_blk);
-       free_blk->magic = BLOCK_HDR_MAGIC;
+       free_blk->magic = BLOCK_HDR_FREE_MAGIC;
        free_blk->size = (nr_pages * PAGESIZE) -((sizeof(BLOCK_HDR)*2) + size);
        add_to_free_list(free_blk);
        
@@ -437,7 +603,7 @@ static BLOCK_HDR* grow_kernel_pool(unsigned int size, ULONG Tag, PVOID Caller)
    else
      {
        used_blk = (struct _BLOCK_HDR *)start;
-       used_blk->magic = BLOCK_HDR_MAGIC;
+       used_blk->magic = BLOCK_HDR_USED_MAGIC;
        used_blk->size = (nr_pages * PAGESIZE) - sizeof(BLOCK_HDR);
        add_to_used_list(used_blk);
        
@@ -446,6 +612,8 @@ static BLOCK_HDR* grow_kernel_pool(unsigned int size, ULONG Tag, PVOID Caller)
 
    used_blk->Tag = Tag;
    used_blk->Caller = Caller;
+   used_blk->Dumped = FALSE;
+   MiAddToTagHashTable(used_blk);
    
    VALIDATE_POOL;
    return(used_blk);
@@ -477,7 +645,7 @@ static void* take_block(BLOCK_HDR* current, unsigned int size,
         */
         free_blk = (BLOCK_HDR *)(((int)current)
                                 + sizeof(BLOCK_HDR) + size);           
-       free_blk->magic = BLOCK_HDR_MAGIC;
+       free_blk->magic = BLOCK_HDR_FREE_MAGIC;
        free_blk->next = current->next;
        free_blk->previous = current->previous;
        if (current->next) 
@@ -496,6 +664,11 @@ static void* take_block(BLOCK_HDR* current, unsigned int size,
        
        current->size=size;
        add_to_used_list(current);
+       current->magic = BLOCK_HDR_USED_MAGIC;
+       current->Tag = Tag;
+       current->Caller = Caller;
+       current->Dumped = FALSE;
+       MiAddToTagHashTable(current);
        
        EiUsedNonPagedPool = EiUsedNonPagedPool + current->size;
        EiFreeNonPagedPool = EiFreeNonPagedPool + free_blk->size;
@@ -512,9 +685,12 @@ static void* take_block(BLOCK_HDR* current, unsigned int size,
    
    EiFreeNonPagedPool = EiFreeNonPagedPool - current->size;
    EiUsedNonPagedPool = EiUsedNonPagedPool + current->size;
-   
+
+   current->magic = BLOCK_HDR_USED_MAGIC;   
    current->Tag = Tag;
    current->Caller = Caller;
+   current->Dumped = FALSE;
+   MiAddToTagHashTable(current);
 
    VALIDATE_POOL;
    return(block_to_address(current));
@@ -539,7 +715,7 @@ VOID STDCALL ExFreePool (PVOID block)
       
    VALIDATE_POOL;
    
-   if (blk->magic != BLOCK_HDR_MAGIC)
+   if (blk->magic != BLOCK_HDR_USED_MAGIC)
      {
        DbgPrint("ExFreePool of non-allocated address %x\n",block);
        KeBugCheck(0);
@@ -551,9 +727,11 @@ VOID STDCALL ExFreePool (PVOID block)
    /*
     * Please don't change the order
     */
+   MiRemoveFromTagHashTable(blk);
    remove_from_used_list(blk);
    add_to_free_list(blk);
-   
+   blk->magic = BLOCK_HDR_FREE_MAGIC;
+
    EiUsedNonPagedPool = EiUsedNonPagedPool - blk->size;
    EiFreeNonPagedPool = EiFreeNonPagedPool + blk->size;
    
index 60e042f..f84edef 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: pageop.c,v 1.1 2001/02/16 18:32:20 dwelch Exp $
+/* $Id: pageop.c,v 1.2 2001/03/07 16:48:44 dwelch Exp $
  *
  * COPYRIGHT:    See COPYING in the top level directory
  * PROJECT:      ReactOS kernel
@@ -25,6 +25,8 @@
 KSPIN_LOCK MmPageOpHashTableLock;
 PMM_PAGEOP MmPageOpHashTable[PAGEOP_HASH_TABLE_SIZE];
 
+#define TAG_MM_PAGEOP   TAG('M', 'P', 'O', 'P')
+
 /* FUNCTIONS *****************************************************************/
 
 VOID
@@ -138,7 +140,8 @@ MmGetPageOp(PMEMORY_AREA MArea, ULONG Pid, PVOID Address,
   /*
    * Otherwise add a new pageop.
    */
-  PageOp = ExAllocatePool(NonPagedPool, sizeof(MM_PAGEOP));
+  PageOp = ExAllocatePoolWithTag(NonPagedPool, sizeof(MM_PAGEOP),
+                                TAG_MM_PAGEOP);
   if (PageOp == NULL)
     {
       KeReleaseSpinLock(&MmPageOpHashTableLock, oldIrql);
index 09f535e..02478bb 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: section.c,v 1.47 2001/02/18 17:43:32 dwelch Exp $
+/* $Id: section.c,v 1.48 2001/03/07 16:48:44 dwelch Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -17,6 +17,7 @@
 #include <internal/ob.h>
 #include <internal/io.h>
 #include <internal/ps.h>
+#include <internal/pool.h>
 #include <ddk/ntifs.h>
 
 #define NDEBUG
@@ -32,6 +33,9 @@ static GENERIC_MAPPING MmpSectionMapping = {
        STANDARD_RIGHTS_EXECUTE | SECTION_MAP_EXECUTE,
        SECTION_ALL_ACCESS};
 
+#define TAG_MM_SECTION_SEGMENT   TAG('M', 'M', 'S', 'S')
+#define TAG_SECTION_PAGE_TABLE   TAG('M', 'S', 'P', 'T')
+
 /* FUNCTIONS *****************************************************************/
 
 NTSTATUS 
@@ -89,7 +93,8 @@ MmSetPageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
      {
        Table = 
          Segment->PageDirectory.PageTables[DirectoryOffset] =
-         ExAllocatePool(NonPagedPool, sizeof(SECTION_PAGE_TABLE));
+         ExAllocatePoolWithTag(NonPagedPool, sizeof(SECTION_PAGE_TABLE),
+                               TAG_SECTION_PAGE_TABLE);
        memset(Table, 0, sizeof(SECTION_PAGE_TABLE));
        DPRINT("Table %x\n", Table);
      }
@@ -666,6 +671,7 @@ MmpCloseSection(PVOID ObjectBody,
 {
    DPRINT("MmpCloseSection(OB %x, HC %d) RC %d\n",
           ObjectBody, HandleCount, ObGetReferenceCount(ObjectBody));
+   
 }
 
 NTSTATUS MmpCreateSection(PVOID ObjectBody,
@@ -759,6 +765,7 @@ MmInitSectionImplementation(VOID)
    
    RtlInitUnicodeString(&MmSectionObjectType->TypeName, L"Section");
    
+   MmSectionObjectType->Tag = TAG('S', 'E', 'C', 'T');
    MmSectionObjectType->TotalObjects = 0;
    MmSectionObjectType->TotalHandles = 0;
    MmSectionObjectType->MaxObjects = ULONG_MAX;
@@ -832,7 +839,8 @@ MmCreatePageFileSection(PHANDLE SectionHandle,
   Section->Flags = 0;
   Section->FileObject = NULL;
   Section->MaximumSize = MaximumSize;
-  Segment = ExAllocatePool(NonPagedPool, sizeof(MM_SECTION_SEGMENT));
+  Segment = ExAllocatePoolWithTag(NonPagedPool, sizeof(MM_SECTION_SEGMENT),
+                                 TAG_MM_SECTION_SEGMENT);
   if (Segment == NULL)
     {
       ZwClose(*SectionHandle);
@@ -989,7 +997,8 @@ MmCreateDataFileSection(PHANDLE SectionHandle,
    */
   if (FileObject->SectionObjectPointers->DataSectionObject == NULL)
     {
-      Segment = ExAllocatePool(NonPagedPool, sizeof(MM_SECTION_SEGMENT));
+      Segment = ExAllocatePoolWithTag(NonPagedPool, sizeof(MM_SECTION_SEGMENT),
+                                     TAG_MM_SECTION_SEGMENT);
       if (Segment == NULL)
        {
          KeSetEvent((PVOID)&FileObject->Lock, IO_NO_INCREMENT, FALSE);
@@ -1309,7 +1318,9 @@ MmCreateImageSection(PHANDLE SectionHandle,
       ULONG i;
       
       SectionSegments = 
-       ExAllocatePool(NonPagedPool, sizeof(MM_SECTION_SEGMENT) * NrSegments);
+       ExAllocatePoolWithTag(NonPagedPool, 
+                            sizeof(MM_SECTION_SEGMENT) * NrSegments,
+                            TAG_MM_SECTION_SEGMENT);
       if (SectionSegments == NULL)
        {
          KeSetEvent((PVOID)&FileObject->Lock, IO_NO_INCREMENT, FALSE);
@@ -1365,6 +1376,7 @@ MmCreateImageSection(PHANDLE SectionHandle,
 
       FileObject->SectionObjectPointers->ImageSectionObject = 
        (PVOID)SectionSegments;       
+      ExFreePool(ImageSections);
     }
   else
     {
index 3d699b8..9631689 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: virtual.c,v 1.39 2001/02/14 02:53:53 dwelch Exp $
+/* $Id: virtual.c,v 1.40 2001/03/07 16:48:44 dwelch Exp $
  *
  * COPYRIGHT:   See COPYING in the top directory
  * PROJECT:     ReactOS kernel
@@ -19,6 +19,7 @@
 #include <internal/ob.h>
 #include <internal/io.h>
 #include <internal/ps.h>
+#include <internal/pool.h>
 
 #define NDEBUG
 #include <internal/debug.h>
@@ -33,6 +34,10 @@ typedef struct _MM_SEGMENT
    LIST_ENTRY SegmentListEntry;
 } MM_SEGMENT, *PMM_SEGMENT;
 
+/* GLOBALS *******************************************************************/
+
+#define TAG_MM_SEGMENT    TAG('M', 'S', 'E', 'G')
+
 /* FUNCTIONS *****************************************************************/
 
 PMM_SEGMENT 
@@ -452,7 +457,8 @@ MmSplitSegment(PMADDRESS_SPACE AddressSpace,
     * Allocate the segment we might need here because if the allocation
     * fails below it will be difficult to undo what we've done already.
     */
-   NewTopSegment = ExAllocatePool(NonPagedPool, sizeof(MM_SEGMENT));
+   NewTopSegment = ExAllocatePoolWithTag(NonPagedPool, sizeof(MM_SEGMENT),
+                                        TAG_MM_SEGMENT);
    if (NewTopSegment == NULL)
      {
        return(STATUS_NO_MEMORY);
@@ -465,7 +471,8 @@ MmSplitSegment(PMADDRESS_SPACE AddressSpace,
         * the current segment then create a new segment for the
         * affected portion
         */     
-       RegionSegment = ExAllocatePool(NonPagedPool, sizeof(MM_SEGMENT));
+       RegionSegment = ExAllocatePoolWithTag(NonPagedPool, sizeof(MM_SEGMENT),
+                                             TAG_MM_SEGMENT);
        if (RegionSegment == NULL)
          {
             ExFreePool(NewTopSegment);
@@ -566,7 +573,8 @@ NTSTATUS MmGatherSegment(PMADDRESS_SPACE AddressSpace,
         * we need to split it into two segments
         */
        
-       RegionSegment = ExAllocatePool(NonPagedPool, sizeof(MM_SEGMENT));
+       RegionSegment = ExAllocatePoolWithTag(NonPagedPool, sizeof(MM_SEGMENT),
+                                             TAG_MM_SEGMENT);
        if (RegionSegment == NULL)
          {
             return(STATUS_NO_MEMORY);
@@ -870,7 +878,8 @@ NtAllocateVirtualMemory(IN  HANDLE  ProcessHandle,
          }
      }
 
-   Segment = ExAllocatePool(NonPagedPool, sizeof(MM_SEGMENT));
+   Segment = ExAllocatePoolWithTag(NonPagedPool, sizeof(MM_SEGMENT),
+                                  TAG_MM_SEGMENT);
    if (Segment == NULL)
      {
        MmUnlockAddressSpace(AddressSpace);
index 70779e9..36de49a 100644 (file)
@@ -1 +1 @@
-zw.c
+*.d
\ No newline at end of file
index 461f7e2..d1a87d4 100644 (file)
@@ -15,6 +15,7 @@
 #include <internal/ob.h>
 #include <internal/id.h>
 #include <ntos/synch.h>
+#include <internal/pool.h>
 
 #define NDEBUG
 #include <internal/debug.h>
@@ -61,6 +62,7 @@ NtInitializeEventImplementation(VOID)
    
    RtlCreateUnicodeString(&ExEventObjectType->TypeName, L"Event");
    
+   ExEventObjectType->Tag = TAG('E', 'V', 'T', 'T');
    ExEventObjectType->MaxObjects = ULONG_MAX;
    ExEventObjectType->MaxHandles = ULONG_MAX;
    ExEventObjectType->TotalObjects = 0;
index 620b141..98a3cf2 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: ntsem.c,v 1.9 2001/01/28 15:15:07 ekohl Exp $
+/* $Id: ntsem.c,v 1.10 2001/03/07 16:48:44 dwelch Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -15,6 +15,7 @@
 #include <ddk/ntddk.h>
 #include <internal/ob.h>
 #include <ntos/synch.h>
+#include <internal/pool.h>
 
 #define NDEBUG
 #include <internal/debug.h>
@@ -58,6 +59,7 @@ VOID NtInitializeSemaphoreImplementation(VOID)
    
    RtlCreateUnicodeString(&ExSemaphoreType->TypeName, L"Semaphore");
    
+   ExSemaphoreType->Tag = TAG('S', 'E', 'M', 'T');
    ExSemaphoreType->MaxObjects = ULONG_MAX;
    ExSemaphoreType->MaxHandles = ULONG_MAX;
    ExSemaphoreType->TotalObjects = 0;
index 1846f51..1856ae8 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: nttimer.c,v 1.8 2001/02/18 19:43:15 phreak Exp $
+/* $Id: nttimer.c,v 1.9 2001/03/07 16:48:44 dwelch Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -16,7 +16,7 @@
 #include <internal/ob.h>
 #include <internal/ke.h>
 #include <limits.h>
-
+#include <internal/pool.h>
 
 #include <internal/debug.h>
 
@@ -107,6 +107,7 @@ VOID NtInitializeTimerImplementation(VOID)
    
    RtlCreateUnicodeString(&ExTimerType->TypeName, L"Timer");
    
+   ExTimerType->Tag = TAG('T', 'I', 'M', 'T');
    ExTimerType->MaxObjects = ULONG_MAX;
    ExTimerType->MaxHandles = ULONG_MAX;
    ExTimerType->TotalObjects = 0;
index 1b48a67..841bea5 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: handle.c,v 1.28 2001/02/06 00:11:19 dwelch Exp $
+/* $Id: handle.c,v 1.29 2001/03/07 16:48:45 dwelch Exp $
  *
  * COPYRIGHT:          See COPYING in the top level directory
  * PROJECT:            ReactOS kernel
@@ -14,6 +14,7 @@
 #include <ddk/ntddk.h>
 #include <internal/ob.h>
 #include <internal/ps.h>
+#include <internal/pool.h>
 
 #define NDEBUG
 #include <internal/debug.h>
@@ -31,6 +32,10 @@ typedef struct
    HANDLE_REP handles[HANDLE_BLOCK_ENTRIES];
 } HANDLE_BLOCK, *PHANDLE_BLOCK;
 
+/* GLOBALS *******************************************************************/
+
+#define TAG_HANDLE_TABLE    TAG('H', 'T', 'B', 'L')
+
 /* FUNCTIONS ***************************************************************/
 
 
@@ -433,7 +438,9 @@ NTSTATUS ObCreateHandle(PEPROCESS Process,
    /*
     * Add a new handle block to the end of the list
     */
-   new_blk = (HANDLE_BLOCK *)ExAllocatePool(NonPagedPool,sizeof(HANDLE_BLOCK));
+   new_blk = 
+     (HANDLE_BLOCK *)ExAllocatePoolWithTag(NonPagedPool,sizeof(HANDLE_BLOCK),
+                                          TAG_HANDLE_TABLE);
    memset(new_blk,0,sizeof(HANDLE_BLOCK));
    InsertTailList(&(Process->HandleTable.ListHead),
                  &new_blk->entry);
index def67d5..be409b8 100644 (file)
@@ -1,3 +1,4 @@
+
 /*
  * COPYRIGHT:      See COPYING in the top level directory
  * PROJECT:        ReactOS kernel
@@ -14,6 +15,7 @@
 #include <ddk/ntddk.h>
 #include <internal/ob.h>
 #include <internal/io.h>
+#include <internal/pool.h>
 
 #define NDEBUG
 #include <internal/debug.h>
@@ -308,6 +310,7 @@ VOID ObInit(VOID)
    
    ObDirectoryType = ExAllocatePool(NonPagedPool,sizeof(OBJECT_TYPE));
    
+   ObDirectoryType->Tag = TAG('D', 'I', 'R', 'T');
    ObDirectoryType->TotalObjects = 0;
    ObDirectoryType->TotalHandles = 0;
    ObDirectoryType->MaxObjects = ULONG_MAX;
index 211d9a6..fcc4cc4 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: object.c,v 1.33 2001/02/03 23:25:06 ekohl Exp $
+/* $Id: object.c,v 1.34 2001/03/07 16:48:45 dwelch Exp $
  * 
  * COPYRIGHT:     See COPYING in the top level directory
  * PROJECT:       ReactOS kernel
@@ -256,8 +256,9 @@ PVOID STDCALL ObCreateObject(PHANDLE Handle,
    RtlMapGenericMask(&DesiredAccess,
                     Type->Mapping);
 
-   Header = (POBJECT_HEADER)ExAllocatePool(NonPagedPool,
-                                          OBJECT_ALLOC_SIZE(Type));
+   Header = (POBJECT_HEADER)ExAllocatePoolWithTag(NonPagedPool,
+                                                 OBJECT_ALLOC_SIZE(Type),
+                                                 Type->Tag);
    ObInitializeObject(Header,
                      Handle,
                      DesiredAccess,
index 588628f..590b055 100644 (file)
@@ -16,6 +16,7 @@
 #include <internal/mm.h>
 #include <internal/ob.h>
 #include <internal/port.h>
+#include <internal/pool.h>
 
 #define NDEBUG
 #include <internal/debug.h>
@@ -30,6 +31,8 @@ extern KSPIN_LOCK PiApcLock;
 
 VOID PsTerminateCurrentThread(NTSTATUS ExitStatus);
 
+#define TAG_TERMINATE_APC   TAG('T', 'A', 'P', 'C')
+
 /* FUNCTIONS *****************************************************************/
 
 VOID 
@@ -177,7 +180,7 @@ PsTerminateOtherThread(PETHREAD Thread, NTSTATUS ExitStatus)
   
   Thread->DeadThread = 1;
   Thread->ExitStatus = ExitStatus;
-  Apc = ExAllocatePool(NonPagedPool, sizeof(KAPC));
+  Apc = ExAllocatePoolWithTag(NonPagedPool, sizeof(KAPC), TAG_TERMINATE_APC);
   KeInitializeApc(Apc,
                  &Thread->Tcb,
                  0,
index 19afcb8..fc74838 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: process.c,v 1.57 2001/02/02 20:47:14 ekohl Exp $
+/* $Id: process.c,v 1.58 2001/03/07 16:48:45 dwelch Exp $
  *
  * COPYRIGHT:         See COPYING in the top level directory
  * PROJECT:           ReactOS kernel
@@ -24,6 +24,7 @@
 #include <napi/dbg.h>
 #include <internal/dbg.h>
 #include <napi/shared_data.h>
+#include <internal/pool.h>
 
 #define NDEBUG
 #include <internal/debug.h>
@@ -174,7 +175,8 @@ VOID PsInitProcessManagment(VOID)
     */   
    
    PsProcessType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
-   
+
+   PsProcessType->Tag = TAG('P', 'R', 'O', 'C');
    PsProcessType->TotalObjects = 0;
    PsProcessType->TotalHandles = 0;
    PsProcessType->MaxObjects = ULONG_MAX;
index 15ae3b2..6fc8f76 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: thread.c,v 1.69 2001/02/10 22:51:11 dwelch Exp $
+/* $Id: thread.c,v 1.70 2001/03/07 16:48:45 dwelch Exp $
  *
  * COPYRIGHT:              See COPYING in the top level directory
  * PROJECT:                ReactOS kernel
@@ -26,6 +26,7 @@
 #include <internal/hal.h>
 #include <internal/ps.h>
 #include <internal/ob.h>
+#include <internal/pool.h>
 
 #define NDEBUG
 #include <internal/debug.h>
@@ -272,6 +273,7 @@ PsInitThreadManagment(VOID)
    
    RtlInitUnicodeString(&PsThreadType->TypeName, L"Thread");
    
+   PsThreadType->Tag = TAG('T', 'H', 'R', 'T');
    PsThreadType->TotalObjects = 0;
    PsThreadType->TotalHandles = 0;
    PsThreadType->MaxObjects = 0;
index 164886f..c8ebbfe 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: token.c,v 1.10 2001/02/02 20:47:43 ekohl Exp $
+/* $Id: token.c,v 1.11 2001/03/07 16:48:45 dwelch Exp $
  *
  * COPYRIGHT:         See COPYING in the top level directory
  * PROJECT:           ReactOS kernel
@@ -14,6 +14,7 @@
 #include <limits.h>
 #include <ddk/ntddk.h>
 #include <internal/ps.h>
+#include <internal/pool.h>
 
 #include <internal/debug.h>
 
@@ -226,6 +227,7 @@ VOID SeInitializeTokenManager(VOID)
    
    SeTokenType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
    
+   SeTokenType->Tag = TAG('T', 'O', 'K', 'T');
    SeTokenType->MaxObjects = ULONG_MAX;
    SeTokenType->MaxHandles = ULONG_MAX;
    SeTokenType->TotalObjects = 0;