mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
2002-08-16 David Welch <welch@computer2.darkstar.org>
* ntoskrnl/mm/npool.c (ExAllocateWholePageBlock): Converted to use PHYSICAL_ADDRESS type for page address. 2002-08-16 David Welch <welch@computer2.darkstar.org> * subsys/win32k/ntuser/class.c (W32kCreateClass): Corrected typo when calculating the offset into the class object to put the class name string. 2002-08-16 David Welch <welch@computer2.darkstar.org> * ntoskrnl/ps/thread.c (PsDispatchThreadNoLock): Don't call the reaper function directly; set an event to wake up a seperate reaper thread. * ntoskrnl/ps/thread.c (PsReaperThreadMain): New function that waits for a notification and then calls PsReapThreads. * ntoskrnl/ps/thread.c (PsInitThreadManagement): Create the reaper thread. svn path=/trunk/; revision=3333
This commit is contained in:
parent
a4e3a21cfa
commit
99c4e70f22
7 changed files with 91 additions and 21 deletions
|
@ -1,3 +1,24 @@
|
||||||
|
2002-08-16 David Welch <welch@computer2.darkstar.org>
|
||||||
|
|
||||||
|
* ntoskrnl/mm/npool.c (ExAllocateWholePageBlock): Converted
|
||||||
|
to use PHYSICAL_ADDRESS type for page address.
|
||||||
|
|
||||||
|
2002-08-16 David Welch <welch@computer2.darkstar.org>
|
||||||
|
|
||||||
|
* subsys/win32k/ntuser/class.c (W32kCreateClass): Corrected
|
||||||
|
typo when calculating the offset into the class object to
|
||||||
|
put the class name string.
|
||||||
|
|
||||||
|
2002-08-16 David Welch <welch@computer2.darkstar.org>
|
||||||
|
|
||||||
|
* ntoskrnl/ps/thread.c (PsDispatchThreadNoLock): Don't call
|
||||||
|
the reaper function directly; set an event to wake up a seperate
|
||||||
|
reaper thread.
|
||||||
|
* ntoskrnl/ps/thread.c (PsReaperThreadMain): New function that
|
||||||
|
waits for a notification and then calls PsReapThreads.
|
||||||
|
* ntoskrnl/ps/thread.c (PsInitThreadManagement): Create the
|
||||||
|
reaper thread.
|
||||||
|
|
||||||
2002-08-15 David Welch <welch@computer2.darkstar.org>
|
2002-08-15 David Welch <welch@computer2.darkstar.org>
|
||||||
|
|
||||||
* lib/advapi32/misc/dllmain.c (DllMain): Removed debug message.
|
* lib/advapi32/misc/dllmain.c (DllMain): Removed debug message.
|
||||||
|
|
|
@ -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: ps.h,v 1.39 2002/08/14 20:58:34 dwelch Exp $
|
/* $Id: ps.h,v 1.40 2002/08/16 01:39:16 dwelch Exp $
|
||||||
*
|
*
|
||||||
* FILE: ntoskrnl/ke/kthread.c
|
* FILE: ntoskrnl/ke/kthread.c
|
||||||
* PURPOSE: Process manager definitions
|
* PURPOSE: Process manager definitions
|
||||||
|
@ -502,6 +502,8 @@ PsDispatchThread(ULONG NewThreadStatus);
|
||||||
VOID
|
VOID
|
||||||
PsInitialiseSuspendImplementation(VOID);
|
PsInitialiseSuspendImplementation(VOID);
|
||||||
|
|
||||||
|
extern ULONG PiNrThreadsAwaitingReaping;
|
||||||
|
|
||||||
#endif /* ASSEMBLER */
|
#endif /* ASSEMBLER */
|
||||||
|
|
||||||
#endif /* __INCLUDE_INTERNAL_PS_H */
|
#endif /* __INCLUDE_INTERNAL_PS_H */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: npool.c,v 1.58 2002/06/04 15:26:57 dwelch Exp $
|
/* $Id: npool.c,v 1.59 2002/08/16 01:39:16 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -1007,7 +1007,7 @@ PVOID STDCALL
|
||||||
ExAllocateWholePageBlock(ULONG UserSize)
|
ExAllocateWholePageBlock(ULONG UserSize)
|
||||||
{
|
{
|
||||||
PVOID Address;
|
PVOID Address;
|
||||||
PVOID Page;
|
PHYSICAL_ADDRESS Page;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
ULONG Size;
|
ULONG Size;
|
||||||
ULONG NrPages;
|
ULONG NrPages;
|
||||||
|
@ -1020,14 +1020,14 @@ ExAllocateWholePageBlock(ULONG UserSize)
|
||||||
for (i = 0; i < NrPages; i++)
|
for (i = 0; i < NrPages; i++)
|
||||||
{
|
{
|
||||||
Page = MmAllocPage(MC_NPPOOL, 0);
|
Page = MmAllocPage(MC_NPPOOL, 0);
|
||||||
if (Page == NULL)
|
if (Page.QuadPart == 0LL)
|
||||||
{
|
{
|
||||||
KeBugCheck(0);
|
KeBugCheck(0);
|
||||||
}
|
}
|
||||||
MmCreateVirtualMapping(NULL,
|
MmCreateVirtualMapping(NULL,
|
||||||
Address + (i * PAGESIZE),
|
Address + (i * PAGESIZE),
|
||||||
PAGE_READWRITE | PAGE_SYSTEM,
|
PAGE_READWRITE | PAGE_SYSTEM,
|
||||||
(ULONG)Page,
|
Page,
|
||||||
TRUE);
|
TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: kill.c,v 1.54 2002/06/10 21:37:45 hbirr Exp $
|
/* $Id: kill.c,v 1.55 2002/08/16 01:39:16 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -81,8 +81,6 @@ PsReapThreads(VOID)
|
||||||
PETHREAD current;
|
PETHREAD current;
|
||||||
KIRQL oldIrql;
|
KIRQL oldIrql;
|
||||||
|
|
||||||
// DPRINT1("PsReapThreads()\n");
|
|
||||||
|
|
||||||
KeAcquireSpinLock(&PiThreadListLock, &oldIrql);
|
KeAcquireSpinLock(&PiThreadListLock, &oldIrql);
|
||||||
|
|
||||||
current_entry = PiThreadListHead.Flink;
|
current_entry = PiThreadListHead.Flink;
|
||||||
|
@ -99,19 +97,15 @@ PsReapThreads(VOID)
|
||||||
PEPROCESS Process = current->ThreadsProcess;
|
PEPROCESS Process = current->ThreadsProcess;
|
||||||
NTSTATUS Status = current->ExitStatus;
|
NTSTATUS Status = current->ExitStatus;
|
||||||
|
|
||||||
DPRINT("PsProcessType %x\n", PsProcessType);
|
PiNrThreadsAwaitingReaping--;
|
||||||
DPRINT("Reaping thread %x\n", current);
|
|
||||||
DPRINT("Pointer count %d\n", ObGetObjectPointerCount(Process));
|
|
||||||
current->Tcb.State = THREAD_STATE_TERMINATED_2;
|
current->Tcb.State = THREAD_STATE_TERMINATED_2;
|
||||||
RemoveEntryList(¤t->Tcb.ProcessThreadListEntry);
|
RemoveEntryList(¤t->Tcb.ProcessThreadListEntry);
|
||||||
if (IsListEmpty(&Process->ThreadListHead))
|
if (IsListEmpty(&Process->ThreadListHead))
|
||||||
{
|
{
|
||||||
DPRINT("Last thread terminated, terminating process\n");
|
|
||||||
KeReleaseSpinLock( &PiThreadListLock, oldIrql );
|
KeReleaseSpinLock( &PiThreadListLock, oldIrql );
|
||||||
PiTerminateProcess(Process, Status);
|
PiTerminateProcess(Process, Status);
|
||||||
KeAcquireSpinLock( &PiThreadListLock, &oldIrql );
|
KeAcquireSpinLock( &PiThreadListLock, &oldIrql );
|
||||||
}
|
}
|
||||||
DPRINT("Pointer count %d\n", ObGetObjectPointerCount(Process));
|
|
||||||
KeReleaseSpinLock(&PiThreadListLock, oldIrql);
|
KeReleaseSpinLock(&PiThreadListLock, oldIrql);
|
||||||
ObDereferenceObject(current);
|
ObDereferenceObject(current);
|
||||||
KeAcquireSpinLock(&PiThreadListLock, &oldIrql);
|
KeAcquireSpinLock(&PiThreadListLock, &oldIrql);
|
||||||
|
@ -161,7 +155,7 @@ PsTerminateCurrentThread(NTSTATUS ExitStatus)
|
||||||
KeDispatcherObjectWake(&CurrentThread->Tcb.DispatcherHeader);
|
KeDispatcherObjectWake(&CurrentThread->Tcb.DispatcherHeader);
|
||||||
KeReleaseDispatcherDatabaseLock(FALSE);
|
KeReleaseDispatcherDatabaseLock(FALSE);
|
||||||
|
|
||||||
KeAcquireSpinLock(&PiThreadListLock, &oldIrql);
|
KeAcquireSpinLock(&PiThreadListLock, &oldIrql);
|
||||||
PsDispatchThreadNoLock(THREAD_STATE_TERMINATED_1);
|
PsDispatchThreadNoLock(THREAD_STATE_TERMINATED_1);
|
||||||
KeBugCheck(0);
|
KeBugCheck(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: thread.c,v 1.101 2002/08/14 20:58:38 dwelch Exp $
|
/* $Id: thread.c,v 1.102 2002/08/16 01:39:16 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -49,6 +49,10 @@ static BOOLEAN DoneInitYet = FALSE;
|
||||||
static PETHREAD IdleThreads[MAXIMUM_PROCESSORS];
|
static PETHREAD IdleThreads[MAXIMUM_PROCESSORS];
|
||||||
ULONG PiNrThreads = 0;
|
ULONG PiNrThreads = 0;
|
||||||
ULONG PiNrReadyThreads = 0;
|
ULONG PiNrReadyThreads = 0;
|
||||||
|
static HANDLE PiReaperThreadHandle;
|
||||||
|
static KEVENT PiReaperThreadEvent;
|
||||||
|
static BOOL PiReaperThreadShouldTerminate = FALSE;
|
||||||
|
ULONG PiNrThreadsAwaitingReaping = 0;
|
||||||
|
|
||||||
static GENERIC_MAPPING PiThreadMapping = {THREAD_READ,
|
static GENERIC_MAPPING PiThreadMapping = {THREAD_READ,
|
||||||
THREAD_WRITE,
|
THREAD_WRITE,
|
||||||
|
@ -164,6 +168,30 @@ static PETHREAD PsScanThreadList (KPRIORITY Priority, ULONG Affinity)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID STDCALL
|
||||||
|
PiWakeupReaperThread(VOID)
|
||||||
|
{
|
||||||
|
KeSetEvent(&PiReaperThreadEvent, 0, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
NTSTATUS STDCALL
|
||||||
|
PiReaperThreadMain(PVOID Ignored)
|
||||||
|
{
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
KeWaitForSingleObject(&PiReaperThreadEvent,
|
||||||
|
Executive,
|
||||||
|
KernelMode,
|
||||||
|
FALSE,
|
||||||
|
NULL);
|
||||||
|
if (PiReaperThreadShouldTerminate)
|
||||||
|
{
|
||||||
|
PsTerminateSystemThread(0);
|
||||||
|
}
|
||||||
|
PsReapThreads();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
VOID PsDispatchThreadNoLock (ULONG NewThreadStatus)
|
VOID PsDispatchThreadNoLock (ULONG NewThreadStatus)
|
||||||
{
|
{
|
||||||
KPRIORITY CurrentPriority;
|
KPRIORITY CurrentPriority;
|
||||||
|
@ -182,6 +210,10 @@ VOID PsDispatchThreadNoLock (ULONG NewThreadStatus)
|
||||||
PsInsertIntoThreadList(CurrentThread->Tcb.Priority,
|
PsInsertIntoThreadList(CurrentThread->Tcb.Priority,
|
||||||
CurrentThread);
|
CurrentThread);
|
||||||
}
|
}
|
||||||
|
if (CurrentThread->Tcb.State == THREAD_STATE_TERMINATED_1)
|
||||||
|
{
|
||||||
|
PiNrThreadsAwaitingReaping++;
|
||||||
|
}
|
||||||
|
|
||||||
Affinity = 1 << KeGetCurrentProcessorNumber();
|
Affinity = 1 << KeGetCurrentProcessorNumber();
|
||||||
for (CurrentPriority = HIGH_PRIORITY;
|
for (CurrentPriority = HIGH_PRIORITY;
|
||||||
|
@ -206,8 +238,11 @@ VOID PsDispatchThreadNoLock (ULONG NewThreadStatus)
|
||||||
CurrentThread = Candidate;
|
CurrentThread = Candidate;
|
||||||
|
|
||||||
KeReleaseSpinLockFromDpcLevel(&PiThreadListLock);
|
KeReleaseSpinLockFromDpcLevel(&PiThreadListLock);
|
||||||
|
if (PiNrThreadsAwaitingReaping > 0)
|
||||||
|
{
|
||||||
|
PiWakeupReaperThread();
|
||||||
|
}
|
||||||
KiArchContextSwitch(&CurrentThread->Tcb, &OldThread->Tcb);
|
KiArchContextSwitch(&CurrentThread->Tcb, &OldThread->Tcb);
|
||||||
PsReapThreads();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -229,7 +264,7 @@ PsDispatchThread(ULONG NewThreadStatus)
|
||||||
/*
|
/*
|
||||||
* Save wait IRQL
|
* Save wait IRQL
|
||||||
*/
|
*/
|
||||||
KeGetCurrentKPCR()->CurrentThread->WaitIrql = oldIrql;
|
KeGetCurrentKPCR()->CurrentThread->WaitIrql = oldIrql;
|
||||||
PsDispatchThreadNoLock(NewThreadStatus);
|
PsDispatchThreadNoLock(NewThreadStatus);
|
||||||
KeLowerIrql(oldIrql);
|
KeLowerIrql(oldIrql);
|
||||||
}
|
}
|
||||||
|
@ -367,6 +402,7 @@ PsInitThreadManagment(VOID)
|
||||||
PETHREAD FirstThread;
|
PETHREAD FirstThread;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
HANDLE FirstThreadHandle;
|
HANDLE FirstThreadHandle;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
KeInitializeSpinLock(&PiThreadListLock);
|
KeInitializeSpinLock(&PiThreadListLock);
|
||||||
for (i=0; i < MAXIMUM_PRIORITY; i++)
|
for (i=0; i < MAXIMUM_PRIORITY; i++)
|
||||||
|
@ -409,6 +445,23 @@ PsInitThreadManagment(VOID)
|
||||||
DPRINT("FirstThread %x\n",FirstThread);
|
DPRINT("FirstThread %x\n",FirstThread);
|
||||||
|
|
||||||
DoneInitYet = TRUE;
|
DoneInitYet = TRUE;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create the reaper thread
|
||||||
|
*/
|
||||||
|
KeInitializeEvent(&PiReaperThreadEvent, SynchronizationEvent, FALSE);
|
||||||
|
Status = PsCreateSystemThread(&PiReaperThreadHandle,
|
||||||
|
THREAD_ALL_ACCESS,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
PiReaperThreadMain,
|
||||||
|
NULL);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("PS: Failed to create reaper thread.\n");
|
||||||
|
KeBugCheck(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LONG STDCALL
|
LONG STDCALL
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: class.c,v 1.9 2002/07/17 21:04:57 dwelch Exp $
|
/* $Id: class.c,v 1.10 2002/08/16 01:39:17 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -188,7 +188,7 @@ W32kCreateClass(LPWNDCLASSEX lpwcx,
|
||||||
{
|
{
|
||||||
ClassObject->Class.lpszMenuName = namePtr;
|
ClassObject->Class.lpszMenuName = namePtr;
|
||||||
wcscpy (namePtr, lpwcx->lpszMenuName);
|
wcscpy (namePtr, lpwcx->lpszMenuName);
|
||||||
namePtr += wcslen (lpwcx->lpszMenuName + 1);
|
namePtr += wcslen (lpwcx->lpszMenuName) + 1;
|
||||||
}
|
}
|
||||||
ClassObject->Class.lpszClassName = namePtr;
|
ClassObject->Class.lpszClassName = namePtr;
|
||||||
wcscpy (namePtr, lpwcx->lpszClassName);
|
wcscpy (namePtr, lpwcx->lpszClassName);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: winsta.c,v 1.5 2002/07/17 21:04:57 dwelch Exp $
|
/* $Id: winsta.c,v 1.6 2002/08/16 01:39:17 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,7 +26,7 @@
|
||||||
#include <include/class.h>
|
#include <include/class.h>
|
||||||
#include <include/window.h>
|
#include <include/window.h>
|
||||||
|
|
||||||
//#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
/* GLOBALS *******************************************************************/
|
/* GLOBALS *******************************************************************/
|
||||||
|
|
Loading…
Reference in a new issue