mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Patch by Skywing:
- fixes issues with object manager calling object deletion callbacks at raised IRQL [which creates a ton of problems] - move kernel debugger init to after ExInit svn path=/trunk/; revision=6128
This commit is contained in:
parent
0ae09914df
commit
07a35efe80
2 changed files with 67 additions and 7 deletions
|
@ -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: main.c,v 1.170 2003/08/27 21:28:08 dwelch Exp $
|
/* $Id: main.c,v 1.171 2003/09/25 05:12:24 vizzini Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: ntoskrnl/ke/main.c
|
* FILE: ntoskrnl/ke/main.c
|
||||||
|
@ -501,8 +501,6 @@ ExpInitializeExecutive(VOID)
|
||||||
|
|
||||||
PiInitProcessManager();
|
PiInitProcessManager();
|
||||||
|
|
||||||
KdInit1();
|
|
||||||
|
|
||||||
if (KdPollBreakIn ())
|
if (KdPollBreakIn ())
|
||||||
{
|
{
|
||||||
DbgBreakPointWithStatus (DBG_STATUS_CONTROL_C);
|
DbgBreakPointWithStatus (DBG_STATUS_CONTROL_C);
|
||||||
|
@ -536,6 +534,7 @@ ExpInitializeExecutive(VOID)
|
||||||
HalInitSystem(1, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
|
HalInitSystem(1, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
|
||||||
|
|
||||||
ExInit();
|
ExInit();
|
||||||
|
KdInit1();
|
||||||
IoInit();
|
IoInit();
|
||||||
PoInit();
|
PoInit();
|
||||||
LdrInitModuleManagement();
|
LdrInitModuleManagement();
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
/* $Id: object.c,v 1.67 2003/09/14 10:48:39 hbirr Exp $
|
/* $Id: object.c,v 1.68 2003/09/25 05:12:24 vizzini Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: ntoskrnl/ob/object.c
|
* FILE: ntoskrnl/ob/object.c
|
||||||
* PURPOSE: Implements generic object managment functions
|
* PURPOSE: Implements generic object managment functions
|
||||||
* PROGRAMMER: David Welch (welch@cwcom.net)
|
* PROGRAMMERS David Welch (welch@cwcom.net), Skywing (skywing@valhallalegends.com)
|
||||||
* UPDATE HISTORY:
|
* UPDATE HISTORY:
|
||||||
* 10/06/98: Created
|
* 10/06/98: Created
|
||||||
|
* 09/13/03: Fixed various ObXxx routines to not call retention
|
||||||
|
* checks directly at a raised IRQL.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* INCLUDES *****************************************************************/
|
/* INCLUDES *****************************************************************/
|
||||||
|
@ -609,6 +611,12 @@ ObpPerformRetentionChecks(POBJECT_HEADER Header)
|
||||||
{
|
{
|
||||||
// DPRINT("ObPerformRetentionChecks(Header %x), RefCount %d, HandleCount %d\n",
|
// DPRINT("ObPerformRetentionChecks(Header %x), RefCount %d, HandleCount %d\n",
|
||||||
// Header,Header->RefCount,Header->HandleCount);
|
// Header,Header->RefCount,Header->HandleCount);
|
||||||
|
if(KeGetCurrentIrql() != PASSIVE_LEVEL)
|
||||||
|
{
|
||||||
|
DPRINT("ObpPerformRetentionChecks called at an unsupported IRQL. Use ObpPerformRetentionChecksDpcLevel instead.\n");
|
||||||
|
KEBUGCHECK(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (Header->RefCount < 0)
|
if (Header->RefCount < 0)
|
||||||
{
|
{
|
||||||
|
@ -649,6 +657,59 @@ ObpPerformRetentionChecks(POBJECT_HEADER Header)
|
||||||
return(STATUS_SUCCESS);
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef struct _RETENTION_CHECK_PARAMS {
|
||||||
|
WORK_QUEUE_ITEM WorkItem;
|
||||||
|
POBJECT_HEADER ObjectHeader;
|
||||||
|
} RETENTION_CHECK_PARAMS, *PRETENTION_CHECK_PARAMS;
|
||||||
|
|
||||||
|
VOID
|
||||||
|
STDCALL
|
||||||
|
ObpPerformRetentionChecksWorkRoutine(
|
||||||
|
IN PVOID Parameter
|
||||||
|
)
|
||||||
|
{
|
||||||
|
PRETENTION_CHECK_PARAMS Params = (PRETENTION_CHECK_PARAMS)Parameter;
|
||||||
|
/* ULONG Tag; */ /* See below */
|
||||||
|
|
||||||
|
assert(Params);
|
||||||
|
assert(KeGetCurrentIrql() == PASSIVE_LEVEL); /* We need PAGED_CODE somewhere... */
|
||||||
|
|
||||||
|
/* Turn this on when we have ExFreePoolWithTag
|
||||||
|
Tag = Params->ObjectHeader->ObjectType->Tag; */
|
||||||
|
ObpPerformRetentionChecks(Params->ObjectHeader);
|
||||||
|
ExFreePool(Params);
|
||||||
|
/* ExFreePoolWithTag(Params, Tag); */
|
||||||
|
}
|
||||||
|
|
||||||
|
static NTSTATUS
|
||||||
|
ObpPerformRetentionChecksDpcLevel(IN POBJECT_HEADER ObjectHeader)
|
||||||
|
{
|
||||||
|
switch(KeGetCurrentIrql()) {
|
||||||
|
|
||||||
|
case PASSIVE_LEVEL:
|
||||||
|
return ObpPerformRetentionChecks(ObjectHeader);
|
||||||
|
|
||||||
|
case APC_LEVEL:
|
||||||
|
case DISPATCH_LEVEL:
|
||||||
|
{
|
||||||
|
/* Can we get rid of this NonPagedPoolMustSucceed call and still be a 'must succeed' function? I don't like to bugcheck on no memory! */
|
||||||
|
PRETENTION_CHECK_PARAMS Params = (PRETENTION_CHECK_PARAMS)ExAllocatePoolWithTag(NonPagedPoolMustSucceed, sizeof(RETENTION_CHECK_PARAMS),
|
||||||
|
ObjectHeader->ObjectType->Tag);
|
||||||
|
Params->ObjectHeader = ObjectHeader;
|
||||||
|
ExInitializeWorkItem(&Params->WorkItem, ObpPerformRetentionChecksWorkRoutine, (PVOID)Params);
|
||||||
|
ExQueueWorkItem(&Params->WorkItem, CriticalWorkQueue);
|
||||||
|
}
|
||||||
|
return STATUS_PENDING;
|
||||||
|
|
||||||
|
default:
|
||||||
|
DPRINT("ObpPerformRetentionChecksDpcLevel called at unsupported IRQL %u!\n", KeGetCurrentIrql());
|
||||||
|
KEBUGCHECK(0);
|
||||||
|
return STATUS_UNSUCCESSFUL;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* NAME EXPORTED
|
* NAME EXPORTED
|
||||||
|
@ -681,7 +742,7 @@ ObfReferenceObject(IN PVOID Object)
|
||||||
}
|
}
|
||||||
InterlockedIncrement(&Header->RefCount);
|
InterlockedIncrement(&Header->RefCount);
|
||||||
|
|
||||||
ObpPerformRetentionChecks(Header);
|
ObpPerformRetentionChecksDpcLevel(Header);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -726,7 +787,7 @@ ObfDereferenceObject(IN PVOID Object)
|
||||||
|
|
||||||
InterlockedDecrement(&Header->RefCount);
|
InterlockedDecrement(&Header->RefCount);
|
||||||
|
|
||||||
ObpPerformRetentionChecks(Header);
|
ObpPerformRetentionChecksDpcLevel(Header);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue