mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 09:46:18 +00:00
Use MmDeleteKernelStack and remove KeReleaseThread
svn path=/trunk/; revision=14695
This commit is contained in:
parent
cf1a2b10ac
commit
c683236f8a
2 changed files with 4 additions and 43 deletions
|
@ -917,47 +917,6 @@ KeQueryRuntimeThread(IN PKTHREAD Thread,
|
||||||
return Thread->KernelTime;
|
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
|
* @implemented
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -176,6 +176,7 @@ PspDeleteThread(PVOID ObjectBody)
|
||||||
{
|
{
|
||||||
PETHREAD Thread = (PETHREAD)ObjectBody;
|
PETHREAD Thread = (PETHREAD)ObjectBody;
|
||||||
PEPROCESS Process = Thread->ThreadsProcess;
|
PEPROCESS Process = Thread->ThreadsProcess;
|
||||||
|
extern unsigned int init_stack;
|
||||||
|
|
||||||
DPRINT("PiDeleteThread(ObjectBody 0x%x, process 0x%x)\n",ObjectBody, Thread->ThreadsProcess);
|
DPRINT("PiDeleteThread(ObjectBody 0x%x, process 0x%x)\n",ObjectBody, Thread->ThreadsProcess);
|
||||||
|
|
||||||
|
@ -191,8 +192,9 @@ PspDeleteThread(PVOID ObjectBody)
|
||||||
/* Free the W32THREAD structure if present */
|
/* Free the W32THREAD structure if present */
|
||||||
if(Thread->Tcb.Win32Thread != NULL) ExFreePool (Thread->Tcb.Win32Thread);
|
if(Thread->Tcb.Win32Thread != NULL) ExFreePool (Thread->Tcb.Win32Thread);
|
||||||
|
|
||||||
/* Release the Thread */
|
/* Release the Kernel Stack */
|
||||||
KeReleaseThread(ETHREAD_TO_KTHREAD(Thread));
|
if (Thread->Tcb.StackLimit != (ULONG_PTR)init_stack)
|
||||||
|
MmDeleteKernelStack((PVOID)Thread->Tcb.StackLimit, FALSE);
|
||||||
|
|
||||||
/* Dereference the Process */
|
/* Dereference the Process */
|
||||||
ObDereferenceObject(Process);
|
ObDereferenceObject(Process);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue