#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;
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;
#!/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
* 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
#include <ddk/ntifs.h>
#include <internal/mm.h>
#include <internal/cc.h>
+#include <internal/pool.h>
#define NDEBUG
#include <internal/debug.h>
#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
KeReleaseSpinLock(&Bcb->BcbLock, oldirql);
- current = ExAllocatePool(NonPagedPool, sizeof(CACHE_SEGMENT));
+ current = ExAllocatePoolWithTag(NonPagedPool, sizeof(CACHE_SEGMENT),
+ TAG_CSEG);
current->BaseAddress = NULL;
MmCreateMemoryArea(KernelMode,
MmGetKernelAddressSpace(),
{
DPRINT("CcInitializeFileCache(FileObject %x)\n",FileObject);
- (*Bcb) = ExAllocatePool(NonPagedPool, sizeof(BCB));
+ (*Bcb) = ExAllocatePoolWithTag(NonPagedPool, sizeof(BCB), TAG_BCB);
if ((*Bcb) == NULL)
{
return(STATUS_UNSUCCESSFUL);
-/* $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 *****************************************************************/
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);
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);
return(ExInitializeResourceLite(Resource));
}
-NTSTATUS
-STDCALL
-ExInitializeResourceLite (
- PERESOURCE Resource
- )
+NTSTATUS STDCALL
+ExInitializeResourceLite (PERESOURCE Resource)
{
DPRINT("ExInitializeResourceLite(Resource %x)\n", Resource);
memset(Resource,0,sizeof(ERESOURCE));
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);
-/* $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 *********************************************************/
DPRINT("HalpAllocateBusHandler()\n");
- BusHandler = ExAllocatePool (NonPagedPool, sizeof(BUS_HANDLER));
+ BusHandler =
+ ExAllocatePoolWithTag(NonPagedPool, sizeof(BUS_HANDLER), TAG_BUS);
if (BusHandler == NULL)
return NULL;
} MM_PAGEOP, *PMM_PAGEOP;
VOID
-MiDebugDumpNonPagedPool(VOID);
+MiDebugDumpNonPagedPool(BOOLEAN NewOnly);
+VOID
+MiDebugDumpNonPagedPoolStats(BOOLEAN NewOnly);
#endif
ULONG size,
ULONG Tag);
+#define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
+
#endif /* __INTERNAL_POOL_H */
-/* $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,
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);
if (BufferLength)
{
Irp->AssociatedIrp.SystemBuffer = (PVOID)
- ExAllocatePool(NonPagedPool,BufferLength);
+ ExAllocatePoolWithTag(NonPagedPool,BufferLength, TAG_SYS_BUF);
if (Irp->AssociatedIrp.SystemBuffer == NULL)
{
if (InputBuffer && InputBufferLength)
{
Irp->AssociatedIrp.SystemBuffer = (PVOID)
- ExAllocatePool(NonPagedPool,InputBufferLength);
+ ExAllocatePoolWithTag(NonPagedPool,InputBufferLength,
+ TAG_SYS_BUF);
if (Irp->AssociatedIrp.SystemBuffer == NULL)
{
if (InputBuffer && InputBufferLength)
{
Irp->AssociatedIrp.SystemBuffer = (PVOID)
- ExAllocatePool(NonPagedPool,InputBufferLength);
+ ExAllocatePoolWithTag(NonPagedPool,InputBufferLength,
+ TAG_SYS_BUF);
if (Irp->AssociatedIrp.SystemBuffer==NULL)
{
-/* $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
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;
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);
-/* $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 *************************************************************/
/**********************************************************************
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;
-/* $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 ***************************************************************/
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;
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);
-/* $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
#include <ddk/ntddk.h>
#include <internal/io.h>
+#include <internal/pool.h>
#define NDEBUG
#include <internal/debug.h>
static KSPIN_LOCK FileSystemListLock;
static LIST_ENTRY FileSystemListHead;
+#define TAG_FILE_SYSTEM TAG('F', 'S', 'Y', 'S')
+
/* FUNCTIONS *****************************************************************/
NTSTATUS
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;
-/* $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 ********************************************************************/
/*
* 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;
sizeof (OBJECT_TYPE)
);
+ IoFileObjectType->Tag = TAG_FILE_TYPE;
IoFileObjectType->TotalObjects = 0;
IoFileObjectType->TotalHandles = 0;
IoFileObjectType->MaxObjects = ULONG_MAX;
-/* $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 ****************************************************************/
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)
-/* $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
{
// 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)
-/* $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
static LIST_ENTRY ShutdownListHead;
static KSPIN_LOCK ShutdownListLock;
+#define TAG_SHUTDOWN_ENTRY TAG('S', 'H', 'U', 'T')
/* FUNCTIONS *****************************************************************/
{
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;
-/* $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
#include <limits.h>
#include <ddk/ntddk.h>
#include <internal/ob.h>
+#include <internal/pool.h>
#define NDEBUG
#include <internal/debug.h>
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 *****************************************************************/
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);
{
IoSymbolicLinkType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
+ IoSymbolicLinkType->Tag = TAG('S', 'Y', 'M', 'T');
IoSymbolicLinkType->TotalObjects = 0;
IoSymbolicLinkType->TotalHandles = 0;
IoSymbolicLinkType->MaxObjects = ULONG_MAX;
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
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
-/* $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
* 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);
-/* $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
#include <ddk/ntddk.h>
#include <internal/io.h>
+#include <internal/pool.h>
#define NDEBUG
#include <internal/debug.h>
static KSPIN_LOCK IoVpbLock;
+#define TAG_VPB TAG('V', 'P', 'B', ' ')
+
/* FUNCTIONS *****************************************************************/
VOID
{
PVPB Vpb;
- Vpb = ExAllocatePool(NonPagedPool,sizeof(VPB));
+ Vpb = ExAllocatePoolWithTag(NonPagedPool, sizeof(VPB), TAG_VPB);
if (Vpb==NULL)
{
return(STATUS_UNSUCCESSFUL);
-/* $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
{
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 */
-exports.c
+*.d
\ No newline at end of file
#include <internal/ps.h>
#include <internal/ke.h>
#include <internal/ldr.h>
+#include <internal/pool.h>
#define NDEBUG
#include <internal/debug.h>
VOID PsTerminateCurrentThread(NTSTATUS ExitStatus);
+#define TAG_KAPC TAG('K', 'A', 'P', 'C')
+
/* FUNCTIONS *****************************************************************/
VOID KiRundownThread(VOID)
return(Status);
}
- Apc = ExAllocatePool(NonPagedPool, sizeof(KAPC));
+ Apc = ExAllocatePoolWithTag(NonPagedPool, sizeof(KAPC), TAG_KAPC);
if (Apc == NULL)
{
ObDereferenceObject(Thread);
-/* $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
#include <internal/ke.h>
#include <internal/ps.h>
#include <internal/i386/segment.h>
+#include <internal/pool.h>
#define NDEBUG
#include <internal/debug.h>
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 ****************************************************************/
}
else
{
- isr_lock[Vector]=ExAllocatePool(NonPagedPool,sizeof(KSPIN_LOCK));
+ isr_lock[Vector] =
+ ExAllocatePoolWithTag(NonPagedPool, sizeof(KSPIN_LOCK),
+ TAG_ISR_LOCK);
KeInitializeSpinLock(isr_lock[Vector]);
}
/*
* Initialize interrupt object
*/
- Interrupt=ExAllocatePool(NonPagedPool,sizeof(KINTERRUPT));
+ Interrupt=ExAllocatePoolWithTag(NonPagedPool,sizeof(KINTERRUPT),
+ TAG_KINTERRUPT);
if (Interrupt==NULL)
{
return(STATUS_INSUFFICIENT_RESOURCES);
#include <internal/ke.h>
#include <internal/ps.h>
#include <internal/id.h>
+#include <internal/pool.h>
#define NDEBUG
#include <internal/debug.h>
PVOID SystemArgument1,
PVOID SystemArgument2);
+/* GLOBALS *******************************************************************/
+
+#define TAG_THREAD_STACK TAG('T', 'S', 'T', 'K')
+
/* FUNCTIONS *****************************************************************/
VOID
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;
-/* $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
#include <internal/ob.h>
#include <internal/ps.h>
#include <internal/ldr.h>
+#include <internal/pool.h>
#define NDEBUG
#include <internal/debug.h>
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);
/* 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;
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)
{
{
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)
-/* $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
*/
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;
-/* $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
#include <internal/ob.h>
#include <internal/port.h>
#include <internal/dbg.h>
+#include <internal/pool.h>
#define NDEBUG
#include <internal/debug.h>
RtlInitUnicodeString(&ExPortType->TypeName,L"Port");
+ ExPortType->Tag = TAG('L', 'P', 'R', 'T');
ExPortType->MaxObjects = ULONG_MAX;
ExPortType->MaxHandles = ULONG_MAX;
ExPortType->TotalObjects = 0;
-/* $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 *****************************************************************/
/**********************************************************************
KeBugCheck(0);
}
- MessageReply = ExAllocatePool(NonPagedPool, sizeof(QUEUEDMESSAGE));
+ MessageReply = ExAllocatePoolWithTag(NonPagedPool, sizeof(QUEUEDMESSAGE),
+ TAG_LPC_MESSAGE);
MessageReply->Sender = Sender;
if (LpcReply != NULL)
-/* $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
#include <ddk/ntddk.h>
#include <internal/mm.h>
#include <internal/ps.h>
+#include <internal/pool.h>
#include <internal/debug.h>
STATIC MADDRESS_SPACE KernelAddressSpace;
+#define TAG_PTRC TAG('P', 'T', 'R', 'C')
+
/* FUNCTIONS *****************************************************************/
VOID
if (Process != NULL)
{
AddressSpace->PageTableRefCountTable =
- ExAllocatePool(NonPagedPool, 768 * sizeof(USHORT));
+ ExAllocatePoolWithTag(NonPagedPool, 768 * sizeof(USHORT),
+ TAG_PTRC);
AddressSpace->PageTableRefCountTableSize = 768;
}
else
NTSTATUS
MmDestroyAddressSpace(PMADDRESS_SPACE AddressSpace)
{
+ if (AddressSpace->PageTableRefCountTable != NULL)
+ {
+ ExFreePool(AddressSpace->PageTableRefCountTable);
+ }
return(STATUS_SUCCESS);
}
#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)
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;
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)
}
}
- *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;
-/* $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
Mmi386ReleaseMmInfo(Process);
MmUnlockAddressSpace(&Process->AddressSpace);
+ MmDestroyAddressSpace(&Process->AddressSpace);
DPRINT("Finished MmReleaseMmInfo()\n");
return(STATUS_SUCCESS);
-/* $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
#define NDEBUG
#include <internal/debug.h>
-
-
#if 0
#define VALIDATE_POOL validate_kernel_pool()
#else
/* 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)
struct _BLOCK_HDR* next;
ULONG Tag;
PVOID Caller;
+ struct _BLOCK_HDR* tag_next;
+ BOOLEAN Dumped;
} BLOCK_HDR;
/* GLOBALS *****************************************************************/
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;
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");
{
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);
{
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);
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);
* 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)
* 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&¤t->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&¤t->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--;
}
{
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);
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);
used_blk->Tag = Tag;
used_blk->Caller = Caller;
+ used_blk->Dumped = FALSE;
+ MiAddToTagHashTable(used_blk);
VALIDATE_POOL;
return(used_blk);
*/
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)
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;
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));
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);
/*
* 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;
-/* $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
KSPIN_LOCK MmPageOpHashTableLock;
PMM_PAGEOP MmPageOpHashTable[PAGEOP_HASH_TABLE_SIZE];
+#define TAG_MM_PAGEOP TAG('M', 'P', 'O', 'P')
+
/* FUNCTIONS *****************************************************************/
VOID
/*
* 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);
-/* $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
#include <internal/ob.h>
#include <internal/io.h>
#include <internal/ps.h>
+#include <internal/pool.h>
#include <ddk/ntifs.h>
#define NDEBUG
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
{
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);
}
{
DPRINT("MmpCloseSection(OB %x, HC %d) RC %d\n",
ObjectBody, HandleCount, ObGetReferenceCount(ObjectBody));
+
}
NTSTATUS MmpCreateSection(PVOID ObjectBody,
RtlInitUnicodeString(&MmSectionObjectType->TypeName, L"Section");
+ MmSectionObjectType->Tag = TAG('S', 'E', 'C', 'T');
MmSectionObjectType->TotalObjects = 0;
MmSectionObjectType->TotalHandles = 0;
MmSectionObjectType->MaxObjects = ULONG_MAX;
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);
*/
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);
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);
FileObject->SectionObjectPointers->ImageSectionObject =
(PVOID)SectionSegments;
+ ExFreePool(ImageSections);
}
else
{
-/* $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
#include <internal/ob.h>
#include <internal/io.h>
#include <internal/ps.h>
+#include <internal/pool.h>
#define NDEBUG
#include <internal/debug.h>
LIST_ENTRY SegmentListEntry;
} MM_SEGMENT, *PMM_SEGMENT;
+/* GLOBALS *******************************************************************/
+
+#define TAG_MM_SEGMENT TAG('M', 'S', 'E', 'G')
+
/* FUNCTIONS *****************************************************************/
PMM_SEGMENT
* 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);
* 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);
* 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);
}
}
- Segment = ExAllocatePool(NonPagedPool, sizeof(MM_SEGMENT));
+ Segment = ExAllocatePoolWithTag(NonPagedPool, sizeof(MM_SEGMENT),
+ TAG_MM_SEGMENT);
if (Segment == NULL)
{
MmUnlockAddressSpace(AddressSpace);
-zw.c
+*.d
\ No newline at end of file
#include <internal/ob.h>
#include <internal/id.h>
#include <ntos/synch.h>
+#include <internal/pool.h>
#define NDEBUG
#include <internal/debug.h>
RtlCreateUnicodeString(&ExEventObjectType->TypeName, L"Event");
+ ExEventObjectType->Tag = TAG('E', 'V', 'T', 'T');
ExEventObjectType->MaxObjects = ULONG_MAX;
ExEventObjectType->MaxHandles = ULONG_MAX;
ExEventObjectType->TotalObjects = 0;
-/* $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
#include <ddk/ntddk.h>
#include <internal/ob.h>
#include <ntos/synch.h>
+#include <internal/pool.h>
#define NDEBUG
#include <internal/debug.h>
RtlCreateUnicodeString(&ExSemaphoreType->TypeName, L"Semaphore");
+ ExSemaphoreType->Tag = TAG('S', 'E', 'M', 'T');
ExSemaphoreType->MaxObjects = ULONG_MAX;
ExSemaphoreType->MaxHandles = ULONG_MAX;
ExSemaphoreType->TotalObjects = 0;
-/* $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
#include <internal/ob.h>
#include <internal/ke.h>
#include <limits.h>
-
+#include <internal/pool.h>
#include <internal/debug.h>
RtlCreateUnicodeString(&ExTimerType->TypeName, L"Timer");
+ ExTimerType->Tag = TAG('T', 'I', 'M', 'T');
ExTimerType->MaxObjects = ULONG_MAX;
ExTimerType->MaxHandles = ULONG_MAX;
ExTimerType->TotalObjects = 0;
-/* $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
#include <ddk/ntddk.h>
#include <internal/ob.h>
#include <internal/ps.h>
+#include <internal/pool.h>
#define NDEBUG
#include <internal/debug.h>
HANDLE_REP handles[HANDLE_BLOCK_ENTRIES];
} HANDLE_BLOCK, *PHANDLE_BLOCK;
+/* GLOBALS *******************************************************************/
+
+#define TAG_HANDLE_TABLE TAG('H', 'T', 'B', 'L')
+
/* FUNCTIONS ***************************************************************/
/*
* 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);
+
/*
* 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>
ObDirectoryType = ExAllocatePool(NonPagedPool,sizeof(OBJECT_TYPE));
+ ObDirectoryType->Tag = TAG('D', 'I', 'R', 'T');
ObDirectoryType->TotalObjects = 0;
ObDirectoryType->TotalHandles = 0;
ObDirectoryType->MaxObjects = ULONG_MAX;
-/* $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
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,
#include <internal/mm.h>
#include <internal/ob.h>
#include <internal/port.h>
+#include <internal/pool.h>
#define NDEBUG
#include <internal/debug.h>
VOID PsTerminateCurrentThread(NTSTATUS ExitStatus);
+#define TAG_TERMINATE_APC TAG('T', 'A', 'P', 'C')
+
/* FUNCTIONS *****************************************************************/
VOID
Thread->DeadThread = 1;
Thread->ExitStatus = ExitStatus;
- Apc = ExAllocatePool(NonPagedPool, sizeof(KAPC));
+ Apc = ExAllocatePoolWithTag(NonPagedPool, sizeof(KAPC), TAG_TERMINATE_APC);
KeInitializeApc(Apc,
&Thread->Tcb,
0,
-/* $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
#include <napi/dbg.h>
#include <internal/dbg.h>
#include <napi/shared_data.h>
+#include <internal/pool.h>
#define NDEBUG
#include <internal/debug.h>
*/
PsProcessType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
-
+
+ PsProcessType->Tag = TAG('P', 'R', 'O', 'C');
PsProcessType->TotalObjects = 0;
PsProcessType->TotalHandles = 0;
PsProcessType->MaxObjects = ULONG_MAX;
-/* $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
#include <internal/hal.h>
#include <internal/ps.h>
#include <internal/ob.h>
+#include <internal/pool.h>
#define NDEBUG
#include <internal/debug.h>
RtlInitUnicodeString(&PsThreadType->TypeName, L"Thread");
+ PsThreadType->Tag = TAG('T', 'H', 'R', 'T');
PsThreadType->TotalObjects = 0;
PsThreadType->TotalHandles = 0;
PsThreadType->MaxObjects = 0;
-/* $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
#include <limits.h>
#include <ddk/ntddk.h>
#include <internal/ps.h>
+#include <internal/pool.h>
#include <internal/debug.h>
SeTokenType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
+ SeTokenType->Tag = TAG('T', 'O', 'K', 'T');
SeTokenType->MaxObjects = ULONG_MAX;
SeTokenType->MaxHandles = ULONG_MAX;
SeTokenType->TotalObjects = 0;