Use MmDeleteKernelStack and remove KeReleaseThread
Modified: trunk/reactos/ntoskrnl/ke/kthread.c
Modified: trunk/reactos/ntoskrnl/ps/kill.c
_____
Modified: trunk/reactos/ntoskrnl/ke/kthread.c
--- trunk/reactos/ntoskrnl/ke/kthread.c 2005-04-19 05:01:47 UTC (rev
14694)
+++ trunk/reactos/ntoskrnl/ke/kthread.c 2005-04-19 06:22:36 UTC (rev
14695)
@@ -917,48 +917,7 @@
return Thread->KernelTime;
}
-VOID
-KeFreeStackPage(PVOID Context,
- MEMORY_AREA* MemoryArea,
- PVOID Address,
- PFN_TYPE Page,
- SWAPENTRY SwapEntry,
- BOOLEAN Dirty)
-{
- ASSERT(SwapEntry == 0);
- if (Page) MmReleasePageMemoryConsumer(MC_NPPOOL, Page);
-}
-
-NTSTATUS
-KeReleaseThread(PKTHREAD Thread)
/*
- * FUNCTION: Releases the resource allocated for a thread by
- * KeInitializeThread
- * NOTE: The thread had better not be running when this is called
- */
-{
- extern unsigned int init_stack;
-
- /* FIXME - lock the process */
- RemoveEntryList(&Thread->ThreadListEntry);
-
- if (Thread->StackLimit != (ULONG_PTR)init_stack)
- {
- MmLockAddressSpace(MmGetKernelAddressSpace());
- MmFreeMemoryAreaByPtr(MmGetKernelAddressSpace(),
- (PVOID)Thread->StackLimit,
- KeFreeStackPage,
- NULL);
- MmUnlockAddressSpace(MmGetKernelAddressSpace());
- }
- Thread->StackLimit = 0;
- Thread->InitialStack = NULL;
- Thread->StackBase = NULL;
- Thread->KernelStack = NULL;
- return(STATUS_SUCCESS);
-}
-
-/*
* @implemented
*/
BOOLEAN
_____
Modified: trunk/reactos/ntoskrnl/ps/kill.c
--- trunk/reactos/ntoskrnl/ps/kill.c 2005-04-19 05:01:47 UTC (rev
14694)
+++ trunk/reactos/ntoskrnl/ps/kill.c 2005-04-19 06:22:36 UTC (rev
14695)
@@ -176,6 +176,7 @@
{
PETHREAD Thread = (PETHREAD)ObjectBody;
PEPROCESS Process = Thread->ThreadsProcess;
+ extern unsigned int init_stack;
DPRINT("PiDeleteThread(ObjectBody 0x%x, process
0x%x)\n",ObjectBody, Thread->ThreadsProcess);
@@ -191,8 +192,9 @@
/* Free the W32THREAD structure if present */
if(Thread->Tcb.Win32Thread != NULL) ExFreePool
(Thread->Tcb.Win32Thread);
- /* Release the Thread */
- KeReleaseThread(ETHREAD_TO_KTHREAD(Thread));
+ /* Release the Kernel Stack */
+ if (Thread->Tcb.StackLimit != (ULONG_PTR)init_stack)
+ MmDeleteKernelStack((PVOID)Thread->Tcb.StackLimit, FALSE);
/* Dereference the Process */
ObDereferenceObject(Process);