diff --git a/reactos/ntoskrnl/io/cleanup.c b/reactos/ntoskrnl/io/cleanup.c index 4a6ad23675e..5b537da3544 100644 --- a/reactos/ntoskrnl/io/cleanup.c +++ b/reactos/ntoskrnl/io/cleanup.c @@ -37,6 +37,7 @@ VOID IoReadWriteCompletion(PDEVICE_OBJECT DeviceObject, DPRINT("Copying buffered io back to user\n"); memcpy(Irp->UserBuffer,Irp->AssociatedIrp.SystemBuffer, IoStack->Parameters.Read.Length); + ExFreePool(Irp->AssociatedIrp.SystemBuffer); } if (DeviceObject->Flags & DO_DIRECT_IO) { diff --git a/reactos/ntoskrnl/io/create.c b/reactos/ntoskrnl/io/create.c index 0e5483a6648..32021103fbd 100644 --- a/reactos/ntoskrnl/io/create.c +++ b/reactos/ntoskrnl/io/create.c @@ -17,7 +17,7 @@ #include #include -//#define NDEBUG +#define NDEBUG #include /* FUNCTIONS *************************************************************/ diff --git a/reactos/ntoskrnl/ke/dpc.c b/reactos/ntoskrnl/ke/dpc.c index 8b280c7e244..ce73885fd6f 100644 --- a/reactos/ntoskrnl/ke/dpc.c +++ b/reactos/ntoskrnl/ke/dpc.c @@ -25,6 +25,7 @@ static LIST_ENTRY DpcQueueHead={NULL,NULL}; static KSPIN_LOCK DpcQueueLock={0,}; +ULONG DpcQueueSize = 0; /* FUNCTIONS ****************************************************************/ @@ -68,6 +69,7 @@ void KeDrainDpcQueue(void) current->Lock=FALSE; KeRaiseIrql(HIGH_LEVEL,&oldlvl); current_entry = RemoveHeadList(&DpcQueueHead); + DpcQueueSize--; KeLowerIrql(oldlvl); current = CONTAINING_RECORD(¤t_entry,KDPC,DpcListEntry); } @@ -88,6 +90,7 @@ BOOLEAN KeRemoveQueueDpc(PKDPC Dpc) return(FALSE); } RemoveEntryList(&Dpc->DpcListEntry); + DpcQueueSize--; Dpc->Lock=0; return(TRUE); } @@ -117,6 +120,7 @@ BOOLEAN KeInsertQueueDpc(PKDPC dpc, PVOID SystemArgument1, } KeAcquireSpinLockAtDpcLevel(&DpcQueueLock); InsertHeadList(&DpcQueueHead,&dpc->DpcListEntry); + DpcQueueSize++; KeReleaseSpinLockFromDpcLevel(&DpcQueueLock); dpc->Lock=(PULONG)1; DPRINT("DpcQueueHead.Flink %x\n",DpcQueueHead.Flink); diff --git a/reactos/ntoskrnl/ke/timer.c b/reactos/ntoskrnl/ke/timer.c index 5fb3482a1da..b3dd8a17203 100644 --- a/reactos/ntoskrnl/ke/timer.c +++ b/reactos/ntoskrnl/ke/timer.c @@ -17,6 +17,7 @@ #include #include +#include #define NDEBUG #include @@ -413,6 +414,8 @@ static void HandleExpiredTimer(PKTIMER current) { if (current->dpc!=NULL) { + DPRINT("current->dpc->DeferredRoutine %x\n", + current->dpc->DeferredRoutine); current->dpc->DeferredRoutine(current->dpc, current->dpc->DeferredContext, current->dpc->SystemArgument1, @@ -457,13 +460,15 @@ void KeExpireTimers(void) KeReleaseSpinLock(&timer_list_lock,oldlvl); } +extern unsigned int nr_used_blocks; + VOID KiTimerInterrupt(VOID) /* * FUNCTION: Handles a timer interrupt */ { - char str[16]; - char* vidmem=(char *)physical_to_linear(0xb8000 + 160 - 16); + char str[36]; + char* vidmem=(char *)physical_to_linear(0xb8000 + 160 - 36); int i; /* @@ -476,8 +481,8 @@ VOID KiTimerInterrupt(VOID) * Display the tick count in the top left of the screen as a debugging * aid */ - sprintf(str,"%.8u",ticks); - for (i=0;i<8;i++) + sprintf(str,"%.8u %.8u",nr_used_blocks,ticks); + for (i=0;i<17;i++) { *vidmem=str[i]; vidmem++; diff --git a/reactos/ntoskrnl/mm/npool.c b/reactos/ntoskrnl/mm/npool.c index c9549ea20c2..27159b2dc4e 100644 --- a/reactos/ntoskrnl/mm/npool.c +++ b/reactos/ntoskrnl/mm/npool.c @@ -58,7 +58,7 @@ static unsigned int kernel_pool_base = 0; static block_hdr* free_list_head = NULL; static block_hdr* used_list_head = NULL; static unsigned int nr_free_blocks = 0; -static unsigned int nr_used_blocks = 0; +unsigned int nr_used_blocks = 0; #define ALLOC_MAP_SIZE (NONPAGED_POOL_SIZE / PAGESIZE) diff --git a/reactos/ntoskrnl/mm/virtual.c b/reactos/ntoskrnl/mm/virtual.c index 1cff82f21c4..89f0e40a6e9 100644 --- a/reactos/ntoskrnl/mm/virtual.c +++ b/reactos/ntoskrnl/mm/virtual.c @@ -310,7 +310,7 @@ ZwAllocateVirtualMemory( ULONG Type; NTSTATUS Status; - DbgPrint("ZwAllocateVirtualMemory(ProcessHandle %x, *BaseAddress %x, " + DPRINT("ZwAllocateVirtualMemory(ProcessHandle %x, *BaseAddress %x, " "ZeroBits %d, RegionSize %d, AllocationType %x, Protect %x)\n", ProcessHandle,*BaseAddress,ZeroBits,*RegionSize,AllocationType, Protect); @@ -323,7 +323,7 @@ ZwAllocateVirtualMemory( NULL); if (Status != STATUS_SUCCESS) { - DbgPrint("ZwAllocateVirtualMemory() = %x\n",Status); + DPRINT("ZwAllocateVirtualMemory() = %x\n",Status); return(Status); } @@ -347,7 +347,7 @@ ZwAllocateVirtualMemory( { MemoryArea->Type = Type; MemoryArea->Attributes =Protect; - DbgPrint("*BaseAddress %x\n",*BaseAddress); + DPRINT("*BaseAddress %x\n",*BaseAddress); return(STATUS_SUCCESS); } @@ -357,7 +357,7 @@ ZwAllocateVirtualMemory( *RegionSize, Type, Protect); - DbgPrint("*BaseAddress %x\n",*BaseAddress); + DPRINT("*BaseAddress %x\n",*BaseAddress); return(STATUS_SUCCESS); } } @@ -375,11 +375,11 @@ ZwAllocateVirtualMemory( if (Status != STATUS_SUCCESS) { - DbgPrint("ZwAllocateVirtualMemory() = %x\n",Status); + DPRINT("ZwAllocateVirtualMemory() = %x\n",Status); return(Status); } - DbgPrint("*BaseAddress %x\n",*BaseAddress); + DPRINT("*BaseAddress %x\n",*BaseAddress); return(STATUS_SUCCESS); } diff --git a/reactos/ntoskrnl/ps/idle.c b/reactos/ntoskrnl/ps/idle.c index 88f15c9503c..1db76a21ae6 100644 --- a/reactos/ntoskrnl/ps/idle.c +++ b/reactos/ntoskrnl/ps/idle.c @@ -17,14 +17,23 @@ /* GLOBALS *******************************************************************/ HANDLE IdleThreadHandle = NULL; +extern ULONG DpcQueueSize; /* FUNCTIONS *****************************************************************/ static VOID PsIdleThreadMain(PVOID Context) { + KIRQL oldlvl; + for(;;) { // DbgPrint("Idling.... "); + if (DpcQueueSize > 0) + { + KeRaiseIrql(DISPATCH_LEVEL,&oldlvl); + KeDrainDpcQueue(); + KeLowerIrql(oldlvl); + } ZwYieldExecution(); } }