Added tagging of most allocates

Added facility to print out newly allocated blocks from the non paged pool

svn path=/trunk/; revision=1673
This commit is contained in:
David Welch 2001-03-07 16:48:45 +00:00
parent 05428a2fea
commit c706428a2b
46 changed files with 653 additions and 261 deletions

View file

@ -1,6 +1,6 @@
#ifndef _INCLUDE_DDK_OBTYPES_H #ifndef _INCLUDE_DDK_OBTYPES_H
#define _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 _DIRECTORY_OBJECT;
struct _OBJECT_ATTRIBUTES; struct _OBJECT_ATTRIBUTES;
@ -13,76 +13,81 @@ typedef struct _OBJECT_HANDLE_INFORMATION {
typedef struct _OBJECT_TYPE typedef struct _OBJECT_TYPE
{ {
/* /*
* PURPOSE: Name of the type * PURPOSE: Tag to be used when allocating objects of this type
*/ */
UNICODE_STRING TypeName; ULONG Tag;
/* /*
* PURPOSE: Total number of objects of this type * PURPOSE: Name of the type
*/ */
ULONG TotalObjects; UNICODE_STRING TypeName;
/* /*
* PURPOSE: Total number of handles of this type * PURPOSE: Total number of objects of this type
*/ */
ULONG TotalHandles; ULONG TotalObjects;
/* /*
* PURPOSE: Maximum objects of this type * PURPOSE: Total number of handles of this type
*/ */
ULONG MaxObjects; ULONG TotalHandles;
/*
* PURPOSE: Maximum objects of this type
*/
ULONG MaxObjects;
/* /*
* PURPOSE: Maximum handles of this type * PURPOSE: Maximum handles of this type
*/ */
ULONG MaxHandles; ULONG MaxHandles;
/* /*
* PURPOSE: Paged pool charge * PURPOSE: Paged pool charge
*/ */
ULONG PagedPoolCharge; ULONG PagedPoolCharge;
/* /*
* PURPOSE: Nonpaged pool charge * PURPOSE: Nonpaged pool charge
*/ */
ULONG NonpagedPoolCharge; ULONG NonpagedPoolCharge;
/* /*
* PURPOSE: Mapping of generic access rights * PURPOSE: Mapping of generic access rights
*/ */
PGENERIC_MAPPING Mapping; PGENERIC_MAPPING Mapping;
/* /*
* PURPOSE: Dumps the object * PURPOSE: Dumps the object
* NOTE: To be defined * NOTE: To be defined
*/ */
VOID (*Dump)(VOID); VOID (*Dump)(VOID);
/* /*
* PURPOSE: Opens the object * PURPOSE: Opens the object
* NOTE: To be defined * NOTE: To be defined
*/ */
VOID (*Open)(VOID); VOID (*Open)(VOID);
/* /*
* PURPOSE: Called to close an object if OkayToClose returns true * PURPOSE: Called to close an object if OkayToClose returns true
*/ */
VOID (*Close)(PVOID ObjectBody, ULONG HandleCount); VOID (*Close)(PVOID ObjectBody, ULONG HandleCount);
/* /*
* PURPOSE: Called to delete an object when the last reference is removed * PURPOSE: Called to delete an object when the last reference is removed
*/ */
VOID (*Delete)(PVOID ObjectBody); VOID (*Delete)(PVOID ObjectBody);
/* /*
* PURPOSE: Called when an open attempts to open a file apparently * PURPOSE: Called when an open attempts to open a file apparently
* residing within the object * residing within the object
* RETURNS * RETURNS
* STATUS_SUCCESS NextObject was found * STATUS_SUCCESS NextObject was found
* STATUS_UNSUCCESSFUL NextObject not found * STATUS_UNSUCCESSFUL NextObject not found
* STATUS_REPARSE Path changed, restart parsing the path * STATUS_REPARSE Path changed, restart parsing the path
*/ */
NTSTATUS (*Parse)(PVOID ParsedObject, NTSTATUS (*Parse)(PVOID ParsedObject,
PVOID *NextObject, PVOID *NextObject,
PUNICODE_STRING FullPath, PUNICODE_STRING FullPath,
@ -91,25 +96,24 @@ typedef struct _OBJECT_TYPE
/* /*
*/ */
NTSTATUS (*Security)(PVOID Object, NTSTATUS (*Security)(PVOID Object,
ULONG InfoClass, ULONG InfoClass,
PVOID Info, PVOID Info,
PULONG InfoLength); PULONG InfoLength);
/* /*
*/ */
VOID (*QueryName)(VOID); VOID (*QueryName)(VOID);
/* /*
* PURPOSE: Called when a process asks to close the object * PURPOSE: Called when a process asks to close the object
*/ */
VOID (*OkayToClose)(VOID); VOID (*OkayToClose)(VOID);
NTSTATUS (*Create)(PVOID ObjectBody,
PVOID Parent,
PWSTR RemainingPath,
struct _OBJECT_ATTRIBUTES* ObjectAttributes);
NTSTATUS (*Create)(PVOID ObjectBody,
PVOID Parent,
PWSTR RemainingPath,
struct _OBJECT_ATTRIBUTES* ObjectAttributes);
} OBJECT_TYPE, *POBJECT_TYPE; } OBJECT_TYPE, *POBJECT_TYPE;

View file

@ -1,4 +1,5 @@
#!/bin/sh #!/bin/sh
/sbin/modprobe loop
#echo "Installing to floppy." #echo "Installing to floppy."
#mount -t vfat /bochs/1.44a /mnt/floppy -o loop,rw #mount -t vfat /bochs/1.44a /mnt/floppy -o loop,rw
#./install-system.sh /mnt/floppy #./install-system.sh /mnt/floppy

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -55,6 +55,7 @@
#include <ddk/ntifs.h> #include <ddk/ntifs.h>
#include <internal/mm.h> #include <internal/mm.h>
#include <internal/cc.h> #include <internal/cc.h>
#include <internal/pool.h>
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
@ -64,6 +65,9 @@
#define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S)) #define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S))
#define ROUND_DOWN(N, S) (ROUND_UP(N, 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 *****************************************************************/ /* FUNCTIONS *****************************************************************/
NTSTATUS STDCALL NTSTATUS STDCALL
@ -153,7 +157,8 @@ CcRequestCacheSegment(PBCB Bcb,
KeReleaseSpinLock(&Bcb->BcbLock, oldirql); KeReleaseSpinLock(&Bcb->BcbLock, oldirql);
current = ExAllocatePool(NonPagedPool, sizeof(CACHE_SEGMENT)); current = ExAllocatePoolWithTag(NonPagedPool, sizeof(CACHE_SEGMENT),
TAG_CSEG);
current->BaseAddress = NULL; current->BaseAddress = NULL;
MmCreateMemoryArea(KernelMode, MmCreateMemoryArea(KernelMode,
MmGetKernelAddressSpace(), MmGetKernelAddressSpace(),
@ -252,7 +257,7 @@ CcInitializeFileCache(PFILE_OBJECT FileObject,
{ {
DPRINT("CcInitializeFileCache(FileObject %x)\n",FileObject); DPRINT("CcInitializeFileCache(FileObject %x)\n",FileObject);
(*Bcb) = ExAllocatePool(NonPagedPool, sizeof(BCB)); (*Bcb) = ExAllocatePoolWithTag(NonPagedPool, sizeof(BCB), TAG_BCB);
if ((*Bcb) == NULL) if ((*Bcb) == NULL)
{ {
return(STATUS_UNSUCCESSFUL); return(STATUS_UNSUCCESSFUL);

View 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -40,10 +40,17 @@
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <internal/ke.h> #include <internal/ke.h>
#include <internal/pool.h>
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #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 *****************************************************************/ /* FUNCTIONS *****************************************************************/
@ -230,8 +237,9 @@ static BOOLEAN EiAddSharedOwner(PERESOURCE Resource)
DPRINT("Creating owner table\n"); DPRINT("Creating owner table\n");
/* allocate ownertable,memset to 0, initialize first entry */ /* allocate ownertable,memset to 0, initialize first entry */
Resource->OwnerTable = ExAllocatePool(NonPagedPool, Resource->OwnerTable =
sizeof(OWNER_ENTRY)*3); ExAllocatePoolWithTag(NonPagedPool, sizeof(OWNER_ENTRY)*3,
TAG_OWNER_TABLE);
if (Resource->OwnerTable == NULL) if (Resource->OwnerTable == NULL)
{ {
KeBugCheck(0); KeBugCheck(0);
@ -277,9 +285,11 @@ static BOOLEAN EiAddSharedOwner(PERESOURCE Resource)
DPRINT("Allocating new entry\n"); DPRINT("Allocating new entry\n");
/* reallocate ownertable with one more entry */ /* reallocate ownertable with one more entry */
freeEntry = ExAllocatePool(NonPagedPool, freeEntry =
sizeof(OWNER_ENTRY)* ExAllocatePoolWithTag(NonPagedPool,
(Resource->OwnerThreads[1].a.TableSize+1)); sizeof(OWNER_ENTRY)*
(Resource->OwnerThreads[1].a.TableSize+1),
TAG_OWNER_TABLE);
if (freeEntry == NULL) if (freeEntry == NULL)
{ {
KeBugCheck(0); KeBugCheck(0);
@ -563,11 +573,8 @@ ExInitializeResource (
return(ExInitializeResourceLite(Resource)); return(ExInitializeResourceLite(Resource));
} }
NTSTATUS NTSTATUS STDCALL
STDCALL ExInitializeResourceLite (PERESOURCE Resource)
ExInitializeResourceLite (
PERESOURCE Resource
)
{ {
DPRINT("ExInitializeResourceLite(Resource %x)\n", Resource); DPRINT("ExInitializeResourceLite(Resource %x)\n", Resource);
memset(Resource,0,sizeof(ERESOURCE)); memset(Resource,0,sizeof(ERESOURCE));
@ -575,11 +582,13 @@ ExInitializeResourceLite (
Resource->NumberOfExclusiveWaiters = 0; Resource->NumberOfExclusiveWaiters = 0;
KeInitializeSpinLock(&Resource->SpinLock); KeInitializeSpinLock(&Resource->SpinLock);
Resource->Flag = 0; Resource->Flag = 0;
Resource->ExclusiveWaiters = ExAllocatePool(NonPagedPool, sizeof(KEVENT)); Resource->ExclusiveWaiters =
ExAllocatePoolWithTag(NonPagedPool, sizeof(KEVENT), TAG_EXCLUSIVE_LOCK);
KeInitializeEvent(Resource->ExclusiveWaiters, KeInitializeEvent(Resource->ExclusiveWaiters,
SynchronizationEvent, SynchronizationEvent,
FALSE); FALSE);
Resource->SharedWaiters = ExAllocatePool(NonPagedPool ,sizeof(KSEMAPHORE)); Resource->SharedWaiters =
ExAllocatePoolWithTag(NonPagedPool ,sizeof(KSEMAPHORE), TAG_SHARED_SEM);
KeInitializeSemaphore(Resource->SharedWaiters,0,0x7fffffff); KeInitializeSemaphore(Resource->SharedWaiters,0,0x7fffffff);
Resource->ActiveCount = 0; Resource->ActiveCount = 0;
return(0); return(0);

View 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -17,10 +17,14 @@
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <internal/hal.h> #include <internal/hal.h>
#include <internal/pool.h>
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
/* GLOBALS *******************************************************************/
#define TAG_BUS TAG('B', 'U', 'S', 'H')
/* TYPE DEFINITIONS *********************************************************/ /* TYPE DEFINITIONS *********************************************************/
@ -215,7 +219,8 @@ HalpAllocateBusHandler (
DPRINT("HalpAllocateBusHandler()\n"); DPRINT("HalpAllocateBusHandler()\n");
BusHandler = ExAllocatePool (NonPagedPool, sizeof(BUS_HANDLER)); BusHandler =
ExAllocatePoolWithTag(NonPagedPool, sizeof(BUS_HANDLER), TAG_BUS);
if (BusHandler == NULL) if (BusHandler == NULL)
return NULL; return NULL;

View file

@ -413,6 +413,8 @@ typedef struct _MM_PAGEOP
} MM_PAGEOP, *PMM_PAGEOP; } MM_PAGEOP, *PMM_PAGEOP;
VOID VOID
MiDebugDumpNonPagedPool(VOID); MiDebugDumpNonPagedPool(BOOLEAN NewOnly);
VOID
MiDebugDumpNonPagedPoolStats(BOOLEAN NewOnly);
#endif #endif

View file

@ -10,4 +10,6 @@ PVOID STDCALL ExAllocatePagedPoolWithTag (POOL_TYPE Type,
ULONG size, ULONG size,
ULONG Tag); ULONG Tag);
#define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
#endif /* __INTERNAL_POOL_H */ #endif /* __INTERNAL_POOL_H */

View 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -13,10 +13,15 @@
/* INCLUDES *****************************************************************/ /* INCLUDES *****************************************************************/
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <internal/pool.h>
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
/* GLOBALS ******************************************************************/
#define TAG_SYS_BUF TAG('S', 'B', 'U', 'F')
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
NTSTATUS IoPrepareIrpBuffer(PIRP Irp, NTSTATUS IoPrepareIrpBuffer(PIRP Irp,
@ -32,8 +37,8 @@ NTSTATUS IoPrepareIrpBuffer(PIRP Irp,
if (DeviceObject->Flags & DO_BUFFERED_IO) if (DeviceObject->Flags & DO_BUFFERED_IO)
{ {
DPRINT("Doing buffer i/o\n"); DPRINT("Doing buffer i/o\n");
Irp->AssociatedIrp.SystemBuffer = (PVOID) Irp->AssociatedIrp.SystemBuffer =
ExAllocatePool(NonPagedPool,Length); (PVOID)ExAllocatePoolWithTag(NonPagedPool,Length, TAG_SYS_BUF);
if (Irp->AssociatedIrp.SystemBuffer==NULL) if (Irp->AssociatedIrp.SystemBuffer==NULL)
{ {
IoFreeIrp(Irp); IoFreeIrp(Irp);
@ -290,7 +295,7 @@ PIRP STDCALL IoBuildDeviceIoControlRequest(ULONG IoControlCode,
if (BufferLength) if (BufferLength)
{ {
Irp->AssociatedIrp.SystemBuffer = (PVOID) Irp->AssociatedIrp.SystemBuffer = (PVOID)
ExAllocatePool(NonPagedPool,BufferLength); ExAllocatePoolWithTag(NonPagedPool,BufferLength, TAG_SYS_BUF);
if (Irp->AssociatedIrp.SystemBuffer == NULL) if (Irp->AssociatedIrp.SystemBuffer == NULL)
{ {
@ -315,7 +320,8 @@ PIRP STDCALL IoBuildDeviceIoControlRequest(ULONG IoControlCode,
if (InputBuffer && InputBufferLength) if (InputBuffer && InputBufferLength)
{ {
Irp->AssociatedIrp.SystemBuffer = (PVOID) Irp->AssociatedIrp.SystemBuffer = (PVOID)
ExAllocatePool(NonPagedPool,InputBufferLength); ExAllocatePoolWithTag(NonPagedPool,InputBufferLength,
TAG_SYS_BUF);
if (Irp->AssociatedIrp.SystemBuffer == NULL) if (Irp->AssociatedIrp.SystemBuffer == NULL)
{ {
@ -347,7 +353,8 @@ PIRP STDCALL IoBuildDeviceIoControlRequest(ULONG IoControlCode,
if (InputBuffer && InputBufferLength) if (InputBuffer && InputBufferLength)
{ {
Irp->AssociatedIrp.SystemBuffer = (PVOID) Irp->AssociatedIrp.SystemBuffer = (PVOID)
ExAllocatePool(NonPagedPool,InputBufferLength); ExAllocatePoolWithTag(NonPagedPool,InputBufferLength,
TAG_SYS_BUF);
if (Irp->AssociatedIrp.SystemBuffer==NULL) if (Irp->AssociatedIrp.SystemBuffer==NULL)
{ {

View 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -12,9 +12,16 @@
/* INCLUDES *****************************************************************/ /* INCLUDES *****************************************************************/
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <internal/pool.h>
#include <internal/debug.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 ********************************************************************/ /* TYPES ********************************************************************/
typedef struct typedef struct
@ -54,7 +61,9 @@ IoAllocateController(PCONTROLLER_OBJECT ControllerObject,
assert_irql(DISPATCH_LEVEL); assert_irql(DISPATCH_LEVEL);
entry=ExAllocatePool(NonPagedPool,sizeof(CONTROLLER_QUEUE_ENTRY)); entry =
ExAllocatePoolWithTag(NonPagedPool, sizeof(CONTROLLER_QUEUE_ENTRY),
TAG_CQE);
assert(entry!=NULL); assert(entry!=NULL);
entry->DeviceObject = DeviceObject; entry->DeviceObject = DeviceObject;
@ -88,13 +97,16 @@ IoCreateController(ULONG Size)
assert_irql(PASSIVE_LEVEL); assert_irql(PASSIVE_LEVEL);
controller = ExAllocatePool(NonPagedPool,sizeof(CONTROLLER_OBJECT)); controller =
ExAllocatePoolWithTag(NonPagedPool, sizeof(CONTROLLER_OBJECT),
TAG_CONTROLLER);
if (controller==NULL) if (controller==NULL)
{ {
return(NULL); return(NULL);
} }
controller->ControllerExtension=ExAllocatePool(NonPagedPool,Size); controller->ControllerExtension =
ExAllocatePoolWithTag(NonPagedPool, Size, TAG_CONTROLLER_EXTENSION);
if (controller->ControllerExtension==NULL) if (controller->ControllerExtension==NULL)
{ {
ExFreePool(controller); ExFreePool(controller);

View 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -15,10 +15,15 @@
#include <internal/ob.h> #include <internal/ob.h>
#include <internal/io.h> #include <internal/io.h>
#include <internal/id.h> #include <internal/id.h>
#include <internal/pool.h>
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
/* GLOBALS *******************************************************************/
#define TAG_FILE_NAME TAG('F', 'N', 'A', 'M')
/* FUNCTIONS *************************************************************/ /* FUNCTIONS *************************************************************/
/********************************************************************** /**********************************************************************
@ -98,8 +103,10 @@ IopCreateFile (PVOID ObjectBody,
if (NULL == RemainingPath) if (NULL == RemainingPath)
{ {
FileObject->Flags = FileObject->Flags | FO_DIRECT_DEVICE_OPEN; FileObject->Flags = FileObject->Flags | FO_DIRECT_DEVICE_OPEN;
FileObject->FileName.Buffer = ExAllocatePool(NonPagedPool, FileObject->FileName.Buffer =
(ObjectAttributes->ObjectName->Length+1)*2); ExAllocatePoolWithTag(NonPagedPool,
(ObjectAttributes->ObjectName->Length+1)*2,
TAG_FILE_NAME);
FileObject->FileName.Length = ObjectAttributes->ObjectName->Length; FileObject->FileName.Length = ObjectAttributes->ObjectName->Length;
FileObject->FileName.MaximumLength = FileObject->FileName.MaximumLength =
ObjectAttributes->ObjectName->MaximumLength; ObjectAttributes->ObjectName->MaximumLength;

View 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -17,10 +17,15 @@
#include <internal/ldr.h> #include <internal/ldr.h>
#include <internal/id.h> #include <internal/id.h>
#include <internal/ps.h> #include <internal/ps.h>
#include <internal/pool.h>
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
/* GLOBALS *******************************************************************/
#define TAG_DRIVER TAG('D', 'R', 'V', 'R')
#define TAG_DEVICE_EXTENSION TAG('D', 'E', 'X', 'T')
/* FUNCTIONS ***************************************************************/ /* FUNCTIONS ***************************************************************/
@ -252,7 +257,8 @@ IoInitializeDriver(PDRIVER_INITIALIZE DriverEntry)
PDRIVER_OBJECT DriverObject; PDRIVER_OBJECT DriverObject;
ULONG i; ULONG i;
DriverObject = ExAllocatePool(NonPagedPool,sizeof(DRIVER_OBJECT)); DriverObject =
ExAllocatePoolWithTag(NonPagedPool, sizeof(DRIVER_OBJECT), TAG_DRIVER);
if (DriverObject == NULL) if (DriverObject == NULL)
{ {
return STATUS_INSUFFICIENT_RESOURCES; return STATUS_INSUFFICIENT_RESOURCES;
@ -397,8 +403,9 @@ IoCreateDevice(PDRIVER_OBJECT DriverObject,
CreatedDeviceObject->CurrentIrp = NULL; CreatedDeviceObject->CurrentIrp = NULL;
CreatedDeviceObject->Flags = 0; CreatedDeviceObject->Flags = 0;
CreatedDeviceObject->DeviceExtension = ExAllocatePool(NonPagedPool, CreatedDeviceObject->DeviceExtension =
DeviceExtensionSize); ExAllocatePoolWithTag(NonPagedPool, DeviceExtensionSize,
TAG_DEVICE_EXTENSION);
if (DeviceExtensionSize > 0 && CreatedDeviceObject->DeviceExtension == NULL) if (DeviceExtensionSize > 0 && CreatedDeviceObject->DeviceExtension == NULL)
{ {
ExFreePool(CreatedDeviceObject); ExFreePool(CreatedDeviceObject);

View 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -13,6 +13,7 @@
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <internal/io.h> #include <internal/io.h>
#include <internal/pool.h>
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
@ -30,6 +31,8 @@ typedef struct
static KSPIN_LOCK FileSystemListLock; static KSPIN_LOCK FileSystemListLock;
static LIST_ENTRY FileSystemListHead; static LIST_ENTRY FileSystemListHead;
#define TAG_FILE_SYSTEM TAG('F', 'S', 'Y', 'S')
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
NTSTATUS NTSTATUS
@ -243,7 +246,8 @@ VOID STDCALL IoRegisterFileSystem(PDEVICE_OBJECT DeviceObject)
DPRINT("IoRegisterFileSystem(DeviceObject %x)\n",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); assert(fs!=NULL);
fs->DeviceObject = DeviceObject; fs->DeviceObject = DeviceObject;

View 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -15,12 +15,16 @@
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <internal/ob.h> #include <internal/ob.h>
#include <internal/io.h> #include <internal/io.h>
#include <internal/pool.h>
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
/* GLOBALS *******************************************************************/ /* GLOBALS *******************************************************************/
#define TAG_DEVICE_TYPE TAG('D', 'E', 'V', 'T')
#define TAG_FILE_TYPE TAG('F', 'I', 'L', 'E')
/* DATA ********************************************************************/ /* DATA ********************************************************************/
@ -115,11 +119,10 @@ VOID IoInit (VOID)
/* /*
* Register iomgr types: DeviceObjectType * Register iomgr types: DeviceObjectType
*/ */
IoDeviceObjectType = ExAllocatePool ( IoDeviceObjectType = ExAllocatePool (NonPagedPool,
NonPagedPool, sizeof (OBJECT_TYPE));
sizeof (OBJECT_TYPE)
);
IoDeviceObjectType->Tag = TAG_DEVICE_TYPE;
IoDeviceObjectType->TotalObjects = 0; IoDeviceObjectType->TotalObjects = 0;
IoDeviceObjectType->TotalHandles = 0; IoDeviceObjectType->TotalHandles = 0;
IoDeviceObjectType->MaxObjects = ULONG_MAX; IoDeviceObjectType->MaxObjects = ULONG_MAX;
@ -151,6 +154,7 @@ VOID IoInit (VOID)
sizeof (OBJECT_TYPE) sizeof (OBJECT_TYPE)
); );
IoFileObjectType->Tag = TAG_FILE_TYPE;
IoFileObjectType->TotalObjects = 0; IoFileObjectType->TotalObjects = 0;
IoFileObjectType->TotalHandles = 0; IoFileObjectType->TotalHandles = 0;
IoFileObjectType->MaxObjects = ULONG_MAX; IoFileObjectType->MaxObjects = ULONG_MAX;

View 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -33,10 +33,15 @@
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <internal/io.h> #include <internal/io.h>
#include <internal/ps.h> #include <internal/ps.h>
#include <internal/pool.h>
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
/* GLOBALS *******************************************************************/
#define TAG_IRP TAG('I', 'R', 'P', ' ')
/* FUNCTIONS ****************************************************************/ /* FUNCTIONS ****************************************************************/
@ -150,11 +155,13 @@ IoAllocateIrp (CCHAR StackSize, BOOLEAN ChargeQuota)
if (ChargeQuota) if (ChargeQuota)
{ {
// Irp = ExAllocatePoolWithQuota(NonPagedPool,IoSizeOfIrp(StackSize)); // Irp = ExAllocatePoolWithQuota(NonPagedPool,IoSizeOfIrp(StackSize));
Irp = ExAllocatePool(NonPagedPool,IoSizeOfIrp(StackSize)); Irp = ExAllocatePoolWithTag(NonPagedPool, IoSizeOfIrp(StackSize),
TAG_IRP);
} }
else else
{ {
Irp = ExAllocatePool(NonPagedPool,IoSizeOfIrp(StackSize)); Irp = ExAllocatePoolWithTag(NonPagedPool,IoSizeOfIrp(StackSize),
TAG_IRP);
} }
if (Irp==NULL) if (Irp==NULL)

View 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -13,9 +13,14 @@
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <internal/mmhal.h> #include <internal/mmhal.h>
#include <internal/pool.h>
#include <internal/debug.h> #include <internal/debug.h>
/* GLOBALS *******************************************************************/
#define TAG_MDL TAG('M', 'D', 'L', ' ')
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
PMDL PMDL
@ -32,11 +37,15 @@ IoAllocateMdl(PVOID VirtualAddress,
{ {
// Mdl = ExAllocatePoolWithQuota(NonPagedPool, // Mdl = ExAllocatePoolWithQuota(NonPagedPool,
// MmSizeOfMdl(VirtualAddress,Length)); // MmSizeOfMdl(VirtualAddress,Length));
Mdl = ExAllocatePool(NonPagedPool,MmSizeOfMdl(VirtualAddress,Length)); Mdl = ExAllocatePoolWithTag(NonPagedPool,
MmSizeOfMdl(VirtualAddress,Length),
TAG_MDL);
} }
else else
{ {
Mdl = ExAllocatePool(NonPagedPool,MmSizeOfMdl(VirtualAddress,Length)); Mdl = ExAllocatePoolWithTag(NonPagedPool,
MmSizeOfMdl(VirtualAddress,Length),
TAG_MDL);
} }
MmInitializeMdl(Mdl,VirtualAddress,Length); MmInitializeMdl(Mdl,VirtualAddress,Length);
if (Irp!=NULL && !SecondaryBuffer) if (Irp!=NULL && !SecondaryBuffer)

View 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -12,10 +12,10 @@
/* INCLUDES *****************************************************************/ /* INCLUDES *****************************************************************/
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <internal/pool.h>
#include <internal/debug.h> #include <internal/debug.h>
/* LOCAL DATA ***************************************************************/ /* LOCAL DATA ***************************************************************/
typedef struct _SHUTDOWN_ENTRY typedef struct _SHUTDOWN_ENTRY
@ -27,6 +27,7 @@ typedef struct _SHUTDOWN_ENTRY
static LIST_ENTRY ShutdownListHead; static LIST_ENTRY ShutdownListHead;
static KSPIN_LOCK ShutdownListLock; static KSPIN_LOCK ShutdownListLock;
#define TAG_SHUTDOWN_ENTRY TAG('S', 'H', 'U', 'T')
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
@ -81,7 +82,8 @@ NTSTATUS STDCALL IoRegisterShutdownNotification(PDEVICE_OBJECT DeviceObject)
{ {
PSHUTDOWN_ENTRY Entry; PSHUTDOWN_ENTRY Entry;
Entry = ExAllocatePool(NonPagedPool, sizeof(SHUTDOWN_ENTRY)); Entry = ExAllocatePoolWithTag(NonPagedPool, sizeof(SHUTDOWN_ENTRY),
TAG_SHUTDOWN_ENTRY);
if (Entry == NULL) if (Entry == NULL)
return STATUS_INSUFFICIENT_RESOURCES; return STATUS_INSUFFICIENT_RESOURCES;

View 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -14,6 +14,7 @@
#include <limits.h> #include <limits.h>
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <internal/ob.h> #include <internal/ob.h>
#include <internal/pool.h>
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
@ -36,6 +37,9 @@ static GENERIC_MAPPING IopSymbolicLinkMapping = {
STANDARD_RIGHTS_EXECUTE|SYMBOLIC_LINK_QUERY, STANDARD_RIGHTS_EXECUTE|SYMBOLIC_LINK_QUERY,
SYMBOLIC_LINK_ALL_ACCESS}; SYMBOLIC_LINK_ALL_ACCESS};
#define TAG_SYMLINK_TTARGET TAG('S', 'Y', 'T', 'T')
#define TAG_SYMLINK_TARGET TAG('S', 'Y', 'M', 'T')
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
@ -134,8 +138,9 @@ IopParseSymbolicLink (
if (RemainingPath && *RemainingPath) if (RemainingPath && *RemainingPath)
TargetPath.MaximumLength += (wcslen (*RemainingPath) * sizeof(WCHAR)); TargetPath.MaximumLength += (wcslen (*RemainingPath) * sizeof(WCHAR));
TargetPath.Length = TargetPath.MaximumLength - sizeof(WCHAR); TargetPath.Length = TargetPath.MaximumLength - sizeof(WCHAR);
TargetPath.Buffer = ExAllocatePool (NonPagedPool, TargetPath.Buffer = ExAllocatePoolWithTag (NonPagedPool,
TargetPath.MaximumLength); TargetPath.MaximumLength,
TAG_SYMLINK_TTARGET);
wcscpy (TargetPath.Buffer, SymlinkObject->TargetName.Buffer); wcscpy (TargetPath.Buffer, SymlinkObject->TargetName.Buffer);
if (RemainingPath && *RemainingPath) if (RemainingPath && *RemainingPath)
wcscat (TargetPath.Buffer, *RemainingPath); wcscat (TargetPath.Buffer, *RemainingPath);
@ -171,6 +176,7 @@ VOID IoInitSymbolicLinkImplementation (VOID)
{ {
IoSymbolicLinkType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE)); IoSymbolicLinkType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
IoSymbolicLinkType->Tag = TAG('S', 'Y', 'M', 'T');
IoSymbolicLinkType->TotalObjects = 0; IoSymbolicLinkType->TotalObjects = 0;
IoSymbolicLinkType->TotalHandles = 0; IoSymbolicLinkType->TotalHandles = 0;
IoSymbolicLinkType->MaxObjects = ULONG_MAX; IoSymbolicLinkType->MaxObjects = ULONG_MAX;
@ -381,10 +387,9 @@ IoCreateSymbolicLink (
SymbolicLink->TargetName.MaximumLength = SymbolicLink->TargetName.MaximumLength =
((wcslen(DeviceName->Buffer) + 1) * sizeof(WCHAR)); ((wcslen(DeviceName->Buffer) + 1) * sizeof(WCHAR));
SymbolicLink->TargetName.Buffer = SymbolicLink->TargetName.Buffer =
ExAllocatePool( ExAllocatePoolWithTag(NonPagedPool,
NonPagedPool, SymbolicLink->TargetName.MaximumLength,
SymbolicLink->TargetName.MaximumLength TAG_SYMLINK_TARGET);
);
RtlCopyUnicodeString( RtlCopyUnicodeString(
& (SymbolicLink->TargetName), & (SymbolicLink->TargetName),
DeviceName DeviceName
@ -502,10 +507,9 @@ NtCreateSymbolicLinkObject (
SymbolicLink->TargetName.MaximumLength = SymbolicLink->TargetName.MaximumLength =
((wcslen(DeviceName->Buffer) + 1) * sizeof(WCHAR)); ((wcslen(DeviceName->Buffer) + 1) * sizeof(WCHAR));
SymbolicLink->TargetName.Buffer = SymbolicLink->TargetName.Buffer =
ExAllocatePool( ExAllocatePoolWithTag(NonPagedPool,
NonPagedPool, SymbolicLink->TargetName.MaximumLength,
SymbolicLink->TargetName.MaximumLength TAG_SYMLINK_TARGET);
);
RtlCopyUnicodeString( RtlCopyUnicodeString(
& (SymbolicLink->TargetName), & (SymbolicLink->TargetName),
DeviceName DeviceName

View 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -12,10 +12,15 @@
/* INCLUDES *****************************************************************/ /* INCLUDES *****************************************************************/
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <internal/pool.h>
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
/* GLBOALS *******************************************************************/
#define TAG_IO_TIMER TAG('I', 'O', 'T', 'M')
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
NTSTATUS NTSTATUS
@ -34,7 +39,8 @@ IoInitializeTimer(PDEVICE_OBJECT DeviceObject,
* RETURNS: Status * RETURNS: Status
*/ */
{ {
DeviceObject->Timer = ExAllocatePool(NonPagedPool,sizeof(IO_TIMER)); DeviceObject->Timer = ExAllocatePoolWithTag(NonPagedPool, sizeof(IO_TIMER),
TAG_IO_TIMER);
KeInitializeTimer(&(DeviceObject->Timer->timer)); KeInitializeTimer(&(DeviceObject->Timer->timer));
KeInitializeDpc(&(DeviceObject->Timer->dpc), KeInitializeDpc(&(DeviceObject->Timer->dpc),
(PKDEFERRED_ROUTINE)TimerRoutine,Context); (PKDEFERRED_ROUTINE)TimerRoutine,Context);

View 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -13,6 +13,7 @@
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <internal/io.h> #include <internal/io.h>
#include <internal/pool.h>
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
@ -21,6 +22,8 @@
static KSPIN_LOCK IoVpbLock; static KSPIN_LOCK IoVpbLock;
#define TAG_VPB TAG('V', 'P', 'B', ' ')
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
VOID VOID
@ -35,7 +38,7 @@ NTSTATUS IoAttachVpb(PDEVICE_OBJECT DeviceObject)
{ {
PVPB Vpb; PVPB Vpb;
Vpb = ExAllocatePool(NonPagedPool,sizeof(VPB)); Vpb = ExAllocatePoolWithTag(NonPagedPool, sizeof(VPB), TAG_VPB);
if (Vpb==NULL) if (Vpb==NULL)
{ {
return(STATUS_UNSUCCESSFUL); return(STATUS_UNSUCCESSFUL);

View 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -342,12 +342,24 @@ KdSystemDebugControl(ULONG Code)
{ {
if (Code == 0) if (Code == 0)
{ {
MiDebugDumpNonPagedPool(); MiDebugDumpNonPagedPool(FALSE);
} }
if (Code == 1) else if (Code == 1)
{ {
KeBugCheck(0); KeBugCheck(0);
} }
else if (Code == 2)
{
MiDebugDumpNonPagedPoolStats(FALSE);
}
else if (Code == 3)
{
MiDebugDumpNonPagedPool(TRUE);
}
else if (Code == 4)
{
MiDebugDumpNonPagedPoolStats(TRUE);
}
} }
/* EOF */ /* EOF */

View file

@ -1 +1 @@
exports.c *.d

View file

@ -16,6 +16,7 @@
#include <internal/ps.h> #include <internal/ps.h>
#include <internal/ke.h> #include <internal/ke.h>
#include <internal/ldr.h> #include <internal/ldr.h>
#include <internal/pool.h>
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
@ -31,6 +32,8 @@ extern KSPIN_LOCK PiThreadListLock;
VOID PsTerminateCurrentThread(NTSTATUS ExitStatus); VOID PsTerminateCurrentThread(NTSTATUS ExitStatus);
#define TAG_KAPC TAG('K', 'A', 'P', 'C')
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
VOID KiRundownThread(VOID) VOID KiRundownThread(VOID)
@ -467,7 +470,7 @@ NTSTATUS STDCALL NtQueueApcThread(HANDLE ThreadHandle,
return(Status); return(Status);
} }
Apc = ExAllocatePool(NonPagedPool, sizeof(KAPC)); Apc = ExAllocatePoolWithTag(NonPagedPool, sizeof(KAPC), TAG_KAPC);
if (Apc == NULL) if (Apc == NULL)
{ {
ObDereferenceObject(Thread); ObDereferenceObject(Thread);

View 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -23,6 +23,7 @@
#include <internal/ke.h> #include <internal/ke.h>
#include <internal/ps.h> #include <internal/ps.h>
#include <internal/i386/segment.h> #include <internal/i386/segment.h>
#include <internal/pool.h>
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #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 PKSPIN_LOCK isr_lock[NR_IRQS] = {NULL,};
static KSPIN_LOCK isr_table_lock = {0,}; 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 ****************************************************************/ /* FUNCTIONS ****************************************************************/
@ -264,7 +267,9 @@ KeConnectInterrupt(PKINTERRUPT InterruptObject)
} }
else else
{ {
isr_lock[Vector]=ExAllocatePool(NonPagedPool,sizeof(KSPIN_LOCK)); isr_lock[Vector] =
ExAllocatePoolWithTag(NonPagedPool, sizeof(KSPIN_LOCK),
TAG_ISR_LOCK);
KeInitializeSpinLock(isr_lock[Vector]); KeInitializeSpinLock(isr_lock[Vector]);
} }
@ -397,7 +402,8 @@ IoConnectInterrupt(PKINTERRUPT* InterruptObject,
/* /*
* Initialize interrupt object * Initialize interrupt object
*/ */
Interrupt=ExAllocatePool(NonPagedPool,sizeof(KINTERRUPT)); Interrupt=ExAllocatePoolWithTag(NonPagedPool,sizeof(KINTERRUPT),
TAG_KINTERRUPT);
if (Interrupt==NULL) if (Interrupt==NULL)
{ {
return(STATUS_INSUFFICIENT_RESOURCES); return(STATUS_INSUFFICIENT_RESOURCES);

View file

@ -30,6 +30,7 @@
#include <internal/ke.h> #include <internal/ke.h>
#include <internal/ps.h> #include <internal/ps.h>
#include <internal/id.h> #include <internal/id.h>
#include <internal/pool.h>
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
@ -51,6 +52,10 @@ PiSuspendThreadNormalRoutine(PVOID NormalContext,
PVOID SystemArgument1, PVOID SystemArgument1,
PVOID SystemArgument2); PVOID SystemArgument2);
/* GLOBALS *******************************************************************/
#define TAG_THREAD_STACK TAG('T', 'S', 'T', 'K')
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
VOID VOID
@ -70,7 +75,8 @@ KeInitializeThread(PKPROCESS Process, PKTHREAD Thread, BOOLEAN First)
InitializeListHead(&Thread->MutantListHead); InitializeListHead(&Thread->MutantListHead);
if (!First) if (!First)
{ {
KernelStack = ExAllocatePool(NonPagedPool, MM_STACK_SIZE); KernelStack = ExAllocatePoolWithTag(NonPagedPool, MM_STACK_SIZE,
TAG_THREAD_STACK);
Thread->InitialStack = KernelStack + MM_STACK_SIZE; Thread->InitialStack = KernelStack + MM_STACK_SIZE;
Thread->StackBase = KernelStack + MM_STACK_SIZE; Thread->StackBase = KernelStack + MM_STACK_SIZE;
Thread->StackLimit = (ULONG)KernelStack; Thread->StackLimit = (ULONG)KernelStack;

View 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -29,6 +29,7 @@
#include <internal/ob.h> #include <internal/ob.h>
#include <internal/ps.h> #include <internal/ps.h>
#include <internal/ldr.h> #include <internal/ldr.h>
#include <internal/pool.h>
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
@ -46,6 +47,9 @@ NTSTATUS IoInitializeDriver(PDRIVER_INITIALIZE DriverEntry);
LIST_ENTRY ModuleListHead; LIST_ENTRY ModuleListHead;
POBJECT_TYPE EXPORTED IoDriverObjectType = NULL; 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 ******************************************************/ /* FORWARD DECLARATIONS ******************************************************/
PMODULE_OBJECT LdrLoadModule(PUNICODE_STRING Filename); PMODULE_OBJECT LdrLoadModule(PUNICODE_STRING Filename);
@ -82,6 +86,7 @@ VOID LdrInitModuleManagement(VOID)
/* Register the process object type */ /* Register the process object type */
IoDriverObjectType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE)); IoDriverObjectType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
IoDriverObjectType->Tag = TAG('D', 'R', 'V', 'T');
IoDriverObjectType->TotalObjects = 0; IoDriverObjectType->TotalObjects = 0;
IoDriverObjectType->TotalHandles = 0; IoDriverObjectType->TotalHandles = 0;
IoDriverObjectType->MaxObjects = ULONG_MAX; IoDriverObjectType->MaxObjects = ULONG_MAX;
@ -340,8 +345,9 @@ LdrLoadModule(PUNICODE_STRING Filename)
CHECKPOINT; CHECKPOINT;
/* Allocate nonpageable memory for driver */ /* Allocate nonpageable memory for driver */
ModuleLoadBase = ExAllocatePool(NonPagedPool, ModuleLoadBase = ExAllocatePoolWithTag(NonPagedPool,
FileStdInfo.EndOfFile.u.LowPart); FileStdInfo.EndOfFile.u.LowPart,
TAG_DRIVER_MEM);
if (ModuleLoadBase == NULL) if (ModuleLoadBase == NULL)
{ {
@ -789,7 +795,7 @@ LdrPEProcessModule(PVOID ModuleLoadBase, PUNICODE_STRING FileName)
{ {
PIMAGE_IMPORT_MODULE_DIRECTORY ImportModuleDirectory; PIMAGE_IMPORT_MODULE_DIRECTORY ImportModuleDirectory;
SymbolNameBuf = ExAllocatePool(NonPagedPool, 512); SymbolNameBuf = ExAllocatePoolWithTag(NonPagedPool, 512, TAG_SYM_BUF);
/* Process each import module */ /* Process each import module */
ImportModuleDirectory = (PIMAGE_IMPORT_MODULE_DIRECTORY) ImportModuleDirectory = (PIMAGE_IMPORT_MODULE_DIRECTORY)

View 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -15,10 +15,16 @@
#include <internal/ob.h> #include <internal/ob.h>
#include <internal/port.h> #include <internal/port.h>
#include <internal/dbg.h> #include <internal/dbg.h>
#include <internal/pool.h>
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
/* GLOBALS *******************************************************************/
#define TAG_LPC_CONNECT_MESSAGE TAG('L', 'P', 'C', 'C')
/* FUNCTIONS *****************************************************************/
/********************************************************************** /**********************************************************************
* NAME EXPORTED * NAME EXPORTED
@ -98,8 +104,9 @@ NtConnectPort (PHANDLE ConnectedPort,
*/ */
DPRINT("Creating request message\n"); DPRINT("Creating request message\n");
Request = ExAllocatePool (NonPagedPool, Request = ExAllocatePoolWithTag (NonPagedPool,
(sizeof (LPC_MESSAGE) + ConnectInfoLength)); (sizeof (LPC_MESSAGE) + ConnectInfoLength),
TAG_LPC_CONNECT_MESSAGE);
Request->DataSize = ConnectInfoLength; Request->DataSize = ConnectInfoLength;
Request->MessageSize = sizeof(LPC_MESSAGE) + ConnectInfoLength; Request->MessageSize = sizeof(LPC_MESSAGE) + ConnectInfoLength;

View 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -20,6 +20,7 @@
#include <internal/ob.h> #include <internal/ob.h>
#include <internal/port.h> #include <internal/port.h>
#include <internal/dbg.h> #include <internal/dbg.h>
#include <internal/pool.h>
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
@ -45,6 +46,7 @@ NTSTATUS NiInitPort (VOID)
RtlInitUnicodeString(&ExPortType->TypeName,L"Port"); RtlInitUnicodeString(&ExPortType->TypeName,L"Port");
ExPortType->Tag = TAG('L', 'P', 'R', 'T');
ExPortType->MaxObjects = ULONG_MAX; ExPortType->MaxObjects = ULONG_MAX;
ExPortType->MaxHandles = ULONG_MAX; ExPortType->MaxHandles = ULONG_MAX;
ExPortType->TotalObjects = 0; ExPortType->TotalObjects = 0;

View 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -15,10 +15,15 @@
#include <internal/ob.h> #include <internal/ob.h>
#include <internal/port.h> #include <internal/port.h>
#include <internal/dbg.h> #include <internal/dbg.h>
#include <internal/pool.h>
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
/* GLOBALS *******************************************************************/
#define TAG_LPC_MESSAGE TAG('L', 'P', 'C', 'M')
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
/********************************************************************** /**********************************************************************
@ -47,7 +52,8 @@ EiReplyOrRequestPort (IN PEPORT Port,
KeBugCheck(0); KeBugCheck(0);
} }
MessageReply = ExAllocatePool(NonPagedPool, sizeof(QUEUEDMESSAGE)); MessageReply = ExAllocatePoolWithTag(NonPagedPool, sizeof(QUEUEDMESSAGE),
TAG_LPC_MESSAGE);
MessageReply->Sender = Sender; MessageReply->Sender = Sender;
if (LpcReply != NULL) if (LpcReply != NULL)

View 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -14,6 +14,7 @@
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <internal/mm.h> #include <internal/mm.h>
#include <internal/ps.h> #include <internal/ps.h>
#include <internal/pool.h>
#include <internal/debug.h> #include <internal/debug.h>
@ -21,6 +22,8 @@
STATIC MADDRESS_SPACE KernelAddressSpace; STATIC MADDRESS_SPACE KernelAddressSpace;
#define TAG_PTRC TAG('P', 'T', 'R', 'C')
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
VOID VOID
@ -77,7 +80,8 @@ MmInitializeAddressSpace(PEPROCESS Process,
if (Process != NULL) if (Process != NULL)
{ {
AddressSpace->PageTableRefCountTable = AddressSpace->PageTableRefCountTable =
ExAllocatePool(NonPagedPool, 768 * sizeof(USHORT)); ExAllocatePoolWithTag(NonPagedPool, 768 * sizeof(USHORT),
TAG_PTRC);
AddressSpace->PageTableRefCountTableSize = 768; AddressSpace->PageTableRefCountTableSize = 768;
} }
else else
@ -91,5 +95,9 @@ MmInitializeAddressSpace(PEPROCESS Process,
NTSTATUS NTSTATUS
MmDestroyAddressSpace(PMADDRESS_SPACE AddressSpace) MmDestroyAddressSpace(PMADDRESS_SPACE AddressSpace)
{ {
if (AddressSpace->PageTableRefCountTable != NULL)
{
ExFreePool(AddressSpace->PageTableRefCountTable);
}
return(STATUS_SUCCESS); return(STATUS_SUCCESS);
} }

View file

@ -14,10 +14,15 @@
#include <internal/mm.h> #include <internal/mm.h>
#include <internal/mmhal.h> #include <internal/mmhal.h>
#include <internal/ps.h> #include <internal/ps.h>
#include <internal/pool.h>
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
/* GLOBALS *******************************************************************/
#define TAG_MAREA TAG('M', 'A', 'R', 'E')
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
VOID MmDumpMemoryAreas(PLIST_ENTRY ListHead) VOID MmDumpMemoryAreas(PLIST_ENTRY ListHead)
@ -333,7 +338,8 @@ PMEMORY_AREA MmSplitMemoryArea(PEPROCESS Process,
PMEMORY_AREA Result; PMEMORY_AREA Result;
PMEMORY_AREA Split; PMEMORY_AREA Split;
Result = ExAllocatePool(NonPagedPool,sizeof(MEMORY_AREA)); Result = ExAllocatePoolWithTag(NonPagedPool, sizeof(MEMORY_AREA),
TAG_MAREA);
RtlZeroMemory(Result,sizeof(MEMORY_AREA)); RtlZeroMemory(Result,sizeof(MEMORY_AREA));
Result->Type = NewType; Result->Type = NewType;
Result->BaseAddress = BaseAddress; Result->BaseAddress = BaseAddress;
@ -358,7 +364,8 @@ PMEMORY_AREA MmSplitMemoryArea(PEPROCESS Process,
return(Result); return(Result);
} }
Split = ExAllocatePool(NonPagedPool,sizeof(MEMORY_AREA)); Split = ExAllocatePoolWithTag(NonPagedPool, sizeof(MEMORY_AREA),
TAG_MAREA);
RtlCopyMemory(Split,OriginalMemoryArea,sizeof(MEMORY_AREA)); RtlCopyMemory(Split,OriginalMemoryArea,sizeof(MEMORY_AREA));
Split->BaseAddress = BaseAddress + Length; Split->BaseAddress = BaseAddress + Length;
Split->Length = OriginalMemoryArea->Length - (((ULONG)BaseAddress) 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)); RtlZeroMemory(*Result,sizeof(MEMORY_AREA));
(*Result)->Type = Type; (*Result)->Type = Type;
(*Result)->BaseAddress = *BaseAddress; (*Result)->BaseAddress = *BaseAddress;

View 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 * COPYRIGHT: See COPYING in the top directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -88,6 +88,7 @@ NTSTATUS MmReleaseMmInfo(PEPROCESS Process)
Mmi386ReleaseMmInfo(Process); Mmi386ReleaseMmInfo(Process);
MmUnlockAddressSpace(&Process->AddressSpace); MmUnlockAddressSpace(&Process->AddressSpace);
MmDestroyAddressSpace(&Process->AddressSpace);
DPRINT("Finished MmReleaseMmInfo()\n"); DPRINT("Finished MmReleaseMmInfo()\n");
return(STATUS_SUCCESS); return(STATUS_SUCCESS);

View 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -26,8 +26,6 @@
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
#if 0 #if 0
#define VALIDATE_POOL validate_kernel_pool() #define VALIDATE_POOL validate_kernel_pool()
#else #else
@ -42,7 +40,8 @@
/* TYPES *******************************************************************/ /* 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) * 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; struct _BLOCK_HDR* next;
ULONG Tag; ULONG Tag;
PVOID Caller; PVOID Caller;
struct _BLOCK_HDR* tag_next;
BOOLEAN Dumped;
} BLOCK_HDR; } BLOCK_HDR;
/* GLOBALS *****************************************************************/ /* GLOBALS *****************************************************************/
@ -80,17 +81,166 @@ unsigned int EiUsedNonPagedPool = 0;
unsigned int unsigned int
alloc_pool_region(unsigned int nr_pages); alloc_pool_region(unsigned int nr_pages);
#define TAG_HASH_TABLE_SIZE (1024)
static BLOCK_HDR* tag_hash_table[TAG_HASH_TABLE_SIZE];
/* FUNCTIONS ***************************************************************/ /* 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) VOID ExInitNonPagedPool(ULONG BaseAddress)
{ {
kernel_pool_base = BaseAddress; kernel_pool_base = BaseAddress;
KeInitializeSpinLock(&MmNpoolLock); KeInitializeSpinLock(&MmNpoolLock);
MmInitKernelMap((PVOID)BaseAddress); 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 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; BLOCK_HDR* current = used_list_head;
KIRQL oldIrql; KIRQL oldIrql;
@ -100,12 +250,28 @@ MiDebugDumpNonPagedPool(VOID)
DbgPrint("******* Dumping non paging pool contents ******\n"); DbgPrint("******* Dumping non paging pool contents ******\n");
while (current != NULL) while (current != NULL)
{ {
DbgPrint("Size 0x%x Tag 0x%x (%c%c%c%c) Allocator 0x%x\n", if (!NewOnly || !current->Dumped)
current->size, current->Tag, {
current->Tag >> 24, (current->Tag >> 16) & 0xFF, CHAR c1, c2, c3, c4;
(current->Tag >> 8) & 0xFF, current->Tag & 0xFF,
current->Caller);
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; current=current->next;
} }
DbgPrint("***************** Dump Complete ***************\n"); DbgPrint("***************** Dump Complete ***************\n");
@ -125,7 +291,7 @@ static void validate_free_list(void)
{ {
unsigned int base_addr = (int)current; 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", DbgPrint("Bad block magic (probable pool corruption) at %x\n",
current); current);
@ -173,7 +339,7 @@ static void validate_used_list(void)
{ {
unsigned int base_addr = (int)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", DbgPrint("Bad block magic (probable pool corruption) at %x\n",
current); current);
@ -217,7 +383,7 @@ static void check_duplicates(BLOCK_HDR* blk)
BLOCK_HDR* current=free_list_head; BLOCK_HDR* current=free_list_head;
while (current!=NULL) 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", DbgPrint("Bad block magic (probable pool corruption) at %x\n",
current); current);
@ -288,14 +454,14 @@ static void add_to_free_list(BLOCK_HDR* blk)
* FUNCTION: add the block to the free list (internal) * FUNCTION: add the block to the free list (internal)
*/ */
{ {
blk->next=free_list_head; blk->next=free_list_head;
blk->previous=NULL; blk->previous=NULL;
if (free_list_head!=NULL) if (free_list_head!=NULL)
{ {
free_list_head->previous=blk; free_list_head->previous=blk;
} }
free_list_head=blk; free_list_head=blk;
nr_free_blocks++; nr_free_blocks++;
} }
static void add_to_used_list(BLOCK_HDR* blk) 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) * FUNCTION: add the block to the used list (internal)
*/ */
{ {
blk->next=used_list_head; blk->next=used_list_head;
blk->previous=NULL; blk->previous=NULL;
if (used_list_head!=NULL) if (used_list_head!=NULL)
{ {
used_list_head->previous=blk; used_list_head->previous=blk;
} }
used_list_head=blk; used_list_head=blk;
EiNrUsedBlocks++; EiNrUsedBlocks++;
} }
static void remove_from_free_list(BLOCK_HDR* current) static void remove_from_free_list(BLOCK_HDR* current)
{ {
if (current->next==NULL&&current->previous==NULL) if (current->next==NULL&&current->previous==NULL)
{ {
free_list_head=NULL; free_list_head=NULL;
} }
else else
{ {
if (current->next==NULL) if (current->next==NULL)
{ {
current->previous->next=NULL; current->previous->next=NULL;
} }
else if (current->previous==NULL) else if (current->previous==NULL)
{ {
current->next->previous=NULL; current->next->previous=NULL;
free_list_head=current->next; free_list_head=current->next;
} }
else else
{ {
current->next->previous=current->previous; current->next->previous=current->previous;
current->previous->next=current->next; current->previous->next=current->next;
} }
} }
nr_free_blocks--; 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; used_blk = (struct _BLOCK_HDR *)start;
OLD_DPRINT("Creating block at %x\n",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; used_blk->size = size;
add_to_used_list(used_blk); add_to_used_list(used_blk);
free_blk = (BLOCK_HDR *)(start + sizeof(BLOCK_HDR) + size); free_blk = (BLOCK_HDR *)(start + sizeof(BLOCK_HDR) + size);
OLD_DPRINT("Creating block at %x\n",free_blk); 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); free_blk->size = (nr_pages * PAGESIZE) -((sizeof(BLOCK_HDR)*2) + size);
add_to_free_list(free_blk); add_to_free_list(free_blk);
@ -437,7 +603,7 @@ static BLOCK_HDR* grow_kernel_pool(unsigned int size, ULONG Tag, PVOID Caller)
else else
{ {
used_blk = (struct _BLOCK_HDR *)start; 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); used_blk->size = (nr_pages * PAGESIZE) - sizeof(BLOCK_HDR);
add_to_used_list(used_blk); 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->Tag = Tag;
used_blk->Caller = Caller; used_blk->Caller = Caller;
used_blk->Dumped = FALSE;
MiAddToTagHashTable(used_blk);
VALIDATE_POOL; VALIDATE_POOL;
return(used_blk); return(used_blk);
@ -477,7 +645,7 @@ static void* take_block(BLOCK_HDR* current, unsigned int size,
*/ */
free_blk = (BLOCK_HDR *)(((int)current) free_blk = (BLOCK_HDR *)(((int)current)
+ sizeof(BLOCK_HDR) + size); + sizeof(BLOCK_HDR) + size);
free_blk->magic = BLOCK_HDR_MAGIC; free_blk->magic = BLOCK_HDR_FREE_MAGIC;
free_blk->next = current->next; free_blk->next = current->next;
free_blk->previous = current->previous; free_blk->previous = current->previous;
if (current->next) if (current->next)
@ -496,6 +664,11 @@ static void* take_block(BLOCK_HDR* current, unsigned int size,
current->size=size; current->size=size;
add_to_used_list(current); 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; EiUsedNonPagedPool = EiUsedNonPagedPool + current->size;
EiFreeNonPagedPool = EiFreeNonPagedPool + free_blk->size; EiFreeNonPagedPool = EiFreeNonPagedPool + free_blk->size;
@ -513,8 +686,11 @@ static void* take_block(BLOCK_HDR* current, unsigned int size,
EiFreeNonPagedPool = EiFreeNonPagedPool - current->size; EiFreeNonPagedPool = EiFreeNonPagedPool - current->size;
EiUsedNonPagedPool = EiUsedNonPagedPool + current->size; EiUsedNonPagedPool = EiUsedNonPagedPool + current->size;
current->magic = BLOCK_HDR_USED_MAGIC;
current->Tag = Tag; current->Tag = Tag;
current->Caller = Caller; current->Caller = Caller;
current->Dumped = FALSE;
MiAddToTagHashTable(current);
VALIDATE_POOL; VALIDATE_POOL;
return(block_to_address(current)); return(block_to_address(current));
@ -539,7 +715,7 @@ VOID STDCALL ExFreePool (PVOID block)
VALIDATE_POOL; VALIDATE_POOL;
if (blk->magic != BLOCK_HDR_MAGIC) if (blk->magic != BLOCK_HDR_USED_MAGIC)
{ {
DbgPrint("ExFreePool of non-allocated address %x\n",block); DbgPrint("ExFreePool of non-allocated address %x\n",block);
KeBugCheck(0); KeBugCheck(0);
@ -551,8 +727,10 @@ VOID STDCALL ExFreePool (PVOID block)
/* /*
* Please don't change the order * Please don't change the order
*/ */
MiRemoveFromTagHashTable(blk);
remove_from_used_list(blk); remove_from_used_list(blk);
add_to_free_list(blk); add_to_free_list(blk);
blk->magic = BLOCK_HDR_FREE_MAGIC;
EiUsedNonPagedPool = EiUsedNonPagedPool - blk->size; EiUsedNonPagedPool = EiUsedNonPagedPool - blk->size;
EiFreeNonPagedPool = EiFreeNonPagedPool + blk->size; EiFreeNonPagedPool = EiFreeNonPagedPool + blk->size;

View 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -25,6 +25,8 @@
KSPIN_LOCK MmPageOpHashTableLock; KSPIN_LOCK MmPageOpHashTableLock;
PMM_PAGEOP MmPageOpHashTable[PAGEOP_HASH_TABLE_SIZE]; PMM_PAGEOP MmPageOpHashTable[PAGEOP_HASH_TABLE_SIZE];
#define TAG_MM_PAGEOP TAG('M', 'P', 'O', 'P')
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
VOID VOID
@ -138,7 +140,8 @@ MmGetPageOp(PMEMORY_AREA MArea, ULONG Pid, PVOID Address,
/* /*
* Otherwise add a new pageop. * Otherwise add a new pageop.
*/ */
PageOp = ExAllocatePool(NonPagedPool, sizeof(MM_PAGEOP)); PageOp = ExAllocatePoolWithTag(NonPagedPool, sizeof(MM_PAGEOP),
TAG_MM_PAGEOP);
if (PageOp == NULL) if (PageOp == NULL)
{ {
KeReleaseSpinLock(&MmPageOpHashTableLock, oldIrql); KeReleaseSpinLock(&MmPageOpHashTableLock, oldIrql);

View 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -17,6 +17,7 @@
#include <internal/ob.h> #include <internal/ob.h>
#include <internal/io.h> #include <internal/io.h>
#include <internal/ps.h> #include <internal/ps.h>
#include <internal/pool.h>
#include <ddk/ntifs.h> #include <ddk/ntifs.h>
#define NDEBUG #define NDEBUG
@ -32,6 +33,9 @@ static GENERIC_MAPPING MmpSectionMapping = {
STANDARD_RIGHTS_EXECUTE | SECTION_MAP_EXECUTE, STANDARD_RIGHTS_EXECUTE | SECTION_MAP_EXECUTE,
SECTION_ALL_ACCESS}; SECTION_ALL_ACCESS};
#define TAG_MM_SECTION_SEGMENT TAG('M', 'M', 'S', 'S')
#define TAG_SECTION_PAGE_TABLE TAG('M', 'S', 'P', 'T')
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
NTSTATUS NTSTATUS
@ -89,7 +93,8 @@ MmSetPageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
{ {
Table = Table =
Segment->PageDirectory.PageTables[DirectoryOffset] = 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)); memset(Table, 0, sizeof(SECTION_PAGE_TABLE));
DPRINT("Table %x\n", Table); DPRINT("Table %x\n", Table);
} }
@ -666,6 +671,7 @@ MmpCloseSection(PVOID ObjectBody,
{ {
DPRINT("MmpCloseSection(OB %x, HC %d) RC %d\n", DPRINT("MmpCloseSection(OB %x, HC %d) RC %d\n",
ObjectBody, HandleCount, ObGetReferenceCount(ObjectBody)); ObjectBody, HandleCount, ObGetReferenceCount(ObjectBody));
} }
NTSTATUS MmpCreateSection(PVOID ObjectBody, NTSTATUS MmpCreateSection(PVOID ObjectBody,
@ -759,6 +765,7 @@ MmInitSectionImplementation(VOID)
RtlInitUnicodeString(&MmSectionObjectType->TypeName, L"Section"); RtlInitUnicodeString(&MmSectionObjectType->TypeName, L"Section");
MmSectionObjectType->Tag = TAG('S', 'E', 'C', 'T');
MmSectionObjectType->TotalObjects = 0; MmSectionObjectType->TotalObjects = 0;
MmSectionObjectType->TotalHandles = 0; MmSectionObjectType->TotalHandles = 0;
MmSectionObjectType->MaxObjects = ULONG_MAX; MmSectionObjectType->MaxObjects = ULONG_MAX;
@ -832,7 +839,8 @@ MmCreatePageFileSection(PHANDLE SectionHandle,
Section->Flags = 0; Section->Flags = 0;
Section->FileObject = NULL; Section->FileObject = NULL;
Section->MaximumSize = MaximumSize; Section->MaximumSize = MaximumSize;
Segment = ExAllocatePool(NonPagedPool, sizeof(MM_SECTION_SEGMENT)); Segment = ExAllocatePoolWithTag(NonPagedPool, sizeof(MM_SECTION_SEGMENT),
TAG_MM_SECTION_SEGMENT);
if (Segment == NULL) if (Segment == NULL)
{ {
ZwClose(*SectionHandle); ZwClose(*SectionHandle);
@ -989,7 +997,8 @@ MmCreateDataFileSection(PHANDLE SectionHandle,
*/ */
if (FileObject->SectionObjectPointers->DataSectionObject == NULL) 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) if (Segment == NULL)
{ {
KeSetEvent((PVOID)&FileObject->Lock, IO_NO_INCREMENT, FALSE); KeSetEvent((PVOID)&FileObject->Lock, IO_NO_INCREMENT, FALSE);
@ -1309,7 +1318,9 @@ MmCreateImageSection(PHANDLE SectionHandle,
ULONG i; ULONG i;
SectionSegments = SectionSegments =
ExAllocatePool(NonPagedPool, sizeof(MM_SECTION_SEGMENT) * NrSegments); ExAllocatePoolWithTag(NonPagedPool,
sizeof(MM_SECTION_SEGMENT) * NrSegments,
TAG_MM_SECTION_SEGMENT);
if (SectionSegments == NULL) if (SectionSegments == NULL)
{ {
KeSetEvent((PVOID)&FileObject->Lock, IO_NO_INCREMENT, FALSE); KeSetEvent((PVOID)&FileObject->Lock, IO_NO_INCREMENT, FALSE);
@ -1365,6 +1376,7 @@ MmCreateImageSection(PHANDLE SectionHandle,
FileObject->SectionObjectPointers->ImageSectionObject = FileObject->SectionObjectPointers->ImageSectionObject =
(PVOID)SectionSegments; (PVOID)SectionSegments;
ExFreePool(ImageSections);
} }
else else
{ {

View 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 * COPYRIGHT: See COPYING in the top directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -19,6 +19,7 @@
#include <internal/ob.h> #include <internal/ob.h>
#include <internal/io.h> #include <internal/io.h>
#include <internal/ps.h> #include <internal/ps.h>
#include <internal/pool.h>
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
@ -33,6 +34,10 @@ typedef struct _MM_SEGMENT
LIST_ENTRY SegmentListEntry; LIST_ENTRY SegmentListEntry;
} MM_SEGMENT, *PMM_SEGMENT; } MM_SEGMENT, *PMM_SEGMENT;
/* GLOBALS *******************************************************************/
#define TAG_MM_SEGMENT TAG('M', 'S', 'E', 'G')
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
PMM_SEGMENT PMM_SEGMENT
@ -452,7 +457,8 @@ MmSplitSegment(PMADDRESS_SPACE AddressSpace,
* Allocate the segment we might need here because if the allocation * Allocate the segment we might need here because if the allocation
* fails below it will be difficult to undo what we've done already. * 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) if (NewTopSegment == NULL)
{ {
return(STATUS_NO_MEMORY); return(STATUS_NO_MEMORY);
@ -465,7 +471,8 @@ MmSplitSegment(PMADDRESS_SPACE AddressSpace,
* the current segment then create a new segment for the * the current segment then create a new segment for the
* affected portion * affected portion
*/ */
RegionSegment = ExAllocatePool(NonPagedPool, sizeof(MM_SEGMENT)); RegionSegment = ExAllocatePoolWithTag(NonPagedPool, sizeof(MM_SEGMENT),
TAG_MM_SEGMENT);
if (RegionSegment == NULL) if (RegionSegment == NULL)
{ {
ExFreePool(NewTopSegment); ExFreePool(NewTopSegment);
@ -566,7 +573,8 @@ NTSTATUS MmGatherSegment(PMADDRESS_SPACE AddressSpace,
* we need to split it into two segments * 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) if (RegionSegment == NULL)
{ {
return(STATUS_NO_MEMORY); 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) if (Segment == NULL)
{ {
MmUnlockAddressSpace(AddressSpace); MmUnlockAddressSpace(AddressSpace);

View file

@ -1 +1 @@
zw.c *.d

View file

@ -15,6 +15,7 @@
#include <internal/ob.h> #include <internal/ob.h>
#include <internal/id.h> #include <internal/id.h>
#include <ntos/synch.h> #include <ntos/synch.h>
#include <internal/pool.h>
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
@ -61,6 +62,7 @@ NtInitializeEventImplementation(VOID)
RtlCreateUnicodeString(&ExEventObjectType->TypeName, L"Event"); RtlCreateUnicodeString(&ExEventObjectType->TypeName, L"Event");
ExEventObjectType->Tag = TAG('E', 'V', 'T', 'T');
ExEventObjectType->MaxObjects = ULONG_MAX; ExEventObjectType->MaxObjects = ULONG_MAX;
ExEventObjectType->MaxHandles = ULONG_MAX; ExEventObjectType->MaxHandles = ULONG_MAX;
ExEventObjectType->TotalObjects = 0; ExEventObjectType->TotalObjects = 0;

View 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -15,6 +15,7 @@
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <internal/ob.h> #include <internal/ob.h>
#include <ntos/synch.h> #include <ntos/synch.h>
#include <internal/pool.h>
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
@ -58,6 +59,7 @@ VOID NtInitializeSemaphoreImplementation(VOID)
RtlCreateUnicodeString(&ExSemaphoreType->TypeName, L"Semaphore"); RtlCreateUnicodeString(&ExSemaphoreType->TypeName, L"Semaphore");
ExSemaphoreType->Tag = TAG('S', 'E', 'M', 'T');
ExSemaphoreType->MaxObjects = ULONG_MAX; ExSemaphoreType->MaxObjects = ULONG_MAX;
ExSemaphoreType->MaxHandles = ULONG_MAX; ExSemaphoreType->MaxHandles = ULONG_MAX;
ExSemaphoreType->TotalObjects = 0; ExSemaphoreType->TotalObjects = 0;

View 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -16,7 +16,7 @@
#include <internal/ob.h> #include <internal/ob.h>
#include <internal/ke.h> #include <internal/ke.h>
#include <limits.h> #include <limits.h>
#include <internal/pool.h>
#include <internal/debug.h> #include <internal/debug.h>
@ -107,6 +107,7 @@ VOID NtInitializeTimerImplementation(VOID)
RtlCreateUnicodeString(&ExTimerType->TypeName, L"Timer"); RtlCreateUnicodeString(&ExTimerType->TypeName, L"Timer");
ExTimerType->Tag = TAG('T', 'I', 'M', 'T');
ExTimerType->MaxObjects = ULONG_MAX; ExTimerType->MaxObjects = ULONG_MAX;
ExTimerType->MaxHandles = ULONG_MAX; ExTimerType->MaxHandles = ULONG_MAX;
ExTimerType->TotalObjects = 0; ExTimerType->TotalObjects = 0;

View 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -14,6 +14,7 @@
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <internal/ob.h> #include <internal/ob.h>
#include <internal/ps.h> #include <internal/ps.h>
#include <internal/pool.h>
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
@ -31,6 +32,10 @@ typedef struct
HANDLE_REP handles[HANDLE_BLOCK_ENTRIES]; HANDLE_REP handles[HANDLE_BLOCK_ENTRIES];
} HANDLE_BLOCK, *PHANDLE_BLOCK; } HANDLE_BLOCK, *PHANDLE_BLOCK;
/* GLOBALS *******************************************************************/
#define TAG_HANDLE_TABLE TAG('H', 'T', 'B', 'L')
/* FUNCTIONS ***************************************************************/ /* FUNCTIONS ***************************************************************/
@ -433,7 +438,9 @@ NTSTATUS ObCreateHandle(PEPROCESS Process,
/* /*
* Add a new handle block to the end of the list * 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)); memset(new_blk,0,sizeof(HANDLE_BLOCK));
InsertTailList(&(Process->HandleTable.ListHead), InsertTailList(&(Process->HandleTable.ListHead),
&new_blk->entry); &new_blk->entry);

View file

@ -1,3 +1,4 @@
/* /*
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -14,6 +15,7 @@
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <internal/ob.h> #include <internal/ob.h>
#include <internal/io.h> #include <internal/io.h>
#include <internal/pool.h>
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
@ -308,6 +310,7 @@ VOID ObInit(VOID)
ObDirectoryType = ExAllocatePool(NonPagedPool,sizeof(OBJECT_TYPE)); ObDirectoryType = ExAllocatePool(NonPagedPool,sizeof(OBJECT_TYPE));
ObDirectoryType->Tag = TAG('D', 'I', 'R', 'T');
ObDirectoryType->TotalObjects = 0; ObDirectoryType->TotalObjects = 0;
ObDirectoryType->TotalHandles = 0; ObDirectoryType->TotalHandles = 0;
ObDirectoryType->MaxObjects = ULONG_MAX; ObDirectoryType->MaxObjects = ULONG_MAX;

View 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -256,8 +256,9 @@ PVOID STDCALL ObCreateObject(PHANDLE Handle,
RtlMapGenericMask(&DesiredAccess, RtlMapGenericMask(&DesiredAccess,
Type->Mapping); Type->Mapping);
Header = (POBJECT_HEADER)ExAllocatePool(NonPagedPool, Header = (POBJECT_HEADER)ExAllocatePoolWithTag(NonPagedPool,
OBJECT_ALLOC_SIZE(Type)); OBJECT_ALLOC_SIZE(Type),
Type->Tag);
ObInitializeObject(Header, ObInitializeObject(Header,
Handle, Handle,
DesiredAccess, DesiredAccess,

View file

@ -16,6 +16,7 @@
#include <internal/mm.h> #include <internal/mm.h>
#include <internal/ob.h> #include <internal/ob.h>
#include <internal/port.h> #include <internal/port.h>
#include <internal/pool.h>
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
@ -30,6 +31,8 @@ extern KSPIN_LOCK PiApcLock;
VOID PsTerminateCurrentThread(NTSTATUS ExitStatus); VOID PsTerminateCurrentThread(NTSTATUS ExitStatus);
#define TAG_TERMINATE_APC TAG('T', 'A', 'P', 'C')
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
VOID VOID
@ -177,7 +180,7 @@ PsTerminateOtherThread(PETHREAD Thread, NTSTATUS ExitStatus)
Thread->DeadThread = 1; Thread->DeadThread = 1;
Thread->ExitStatus = ExitStatus; Thread->ExitStatus = ExitStatus;
Apc = ExAllocatePool(NonPagedPool, sizeof(KAPC)); Apc = ExAllocatePoolWithTag(NonPagedPool, sizeof(KAPC), TAG_TERMINATE_APC);
KeInitializeApc(Apc, KeInitializeApc(Apc,
&Thread->Tcb, &Thread->Tcb,
0, 0,

View 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -24,6 +24,7 @@
#include <napi/dbg.h> #include <napi/dbg.h>
#include <internal/dbg.h> #include <internal/dbg.h>
#include <napi/shared_data.h> #include <napi/shared_data.h>
#include <internal/pool.h>
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
@ -175,6 +176,7 @@ VOID PsInitProcessManagment(VOID)
PsProcessType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE)); PsProcessType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
PsProcessType->Tag = TAG('P', 'R', 'O', 'C');
PsProcessType->TotalObjects = 0; PsProcessType->TotalObjects = 0;
PsProcessType->TotalHandles = 0; PsProcessType->TotalHandles = 0;
PsProcessType->MaxObjects = ULONG_MAX; PsProcessType->MaxObjects = ULONG_MAX;

View 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -26,6 +26,7 @@
#include <internal/hal.h> #include <internal/hal.h>
#include <internal/ps.h> #include <internal/ps.h>
#include <internal/ob.h> #include <internal/ob.h>
#include <internal/pool.h>
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
@ -272,6 +273,7 @@ PsInitThreadManagment(VOID)
RtlInitUnicodeString(&PsThreadType->TypeName, L"Thread"); RtlInitUnicodeString(&PsThreadType->TypeName, L"Thread");
PsThreadType->Tag = TAG('T', 'H', 'R', 'T');
PsThreadType->TotalObjects = 0; PsThreadType->TotalObjects = 0;
PsThreadType->TotalHandles = 0; PsThreadType->TotalHandles = 0;
PsThreadType->MaxObjects = 0; PsThreadType->MaxObjects = 0;

View 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -14,6 +14,7 @@
#include <limits.h> #include <limits.h>
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <internal/ps.h> #include <internal/ps.h>
#include <internal/pool.h>
#include <internal/debug.h> #include <internal/debug.h>
@ -226,6 +227,7 @@ VOID SeInitializeTokenManager(VOID)
SeTokenType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE)); SeTokenType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
SeTokenType->Tag = TAG('T', 'O', 'K', 'T');
SeTokenType->MaxObjects = ULONG_MAX; SeTokenType->MaxObjects = ULONG_MAX;
SeTokenType->MaxHandles = ULONG_MAX; SeTokenType->MaxHandles = ULONG_MAX;
SeTokenType->TotalObjects = 0; SeTokenType->TotalObjects = 0;