Modified: trunk/reactos/ntoskrnl/ke/kthread.c
Modified: trunk/reactos/ntoskrnl/ps/idle.c
Modified: trunk/reactos/ntoskrnl/ps/kill.c
Modified: trunk/reactos/ntoskrnl/ps/thread.c
Modified: trunk/reactos/ntoskrnl/ps/win32.c
--- trunk/reactos/ntoskrnl/ke/kthread.c 2006-01-13 20:37:55 UTC (rev 20837)
+++ trunk/reactos/ntoskrnl/ke/kthread.c 2006-01-13 21:56:51 UTC (rev 20838)
@@ -853,9 +853,9 @@
Thread->Teb = Teb;
/* Set the Thread Stacks */
- Thread->InitialStack = (PCHAR)KernelStack + KERNEL_STACK_SIZE;
- Thread->StackBase = (PCHAR)KernelStack + KERNEL_STACK_SIZE;
- Thread->StackLimit = (ULONG_PTR)KernelStack;
+ Thread->InitialStack = (PCHAR)KernelStack;
+ Thread->StackBase = (PCHAR)KernelStack;
+ Thread->StackLimit = (ULONG_PTR)KernelStack - KERNEL_STACK_SIZE;
Thread->KernelStackResident = TRUE;
/*
--- trunk/reactos/ntoskrnl/ps/idle.c 2006-01-13 20:37:55 UTC (rev 20837)
+++ trunk/reactos/ntoskrnl/ps/idle.c 2006-01-13 21:56:51 UTC (rev 20838)
@@ -63,7 +63,7 @@
BOOLEAN First)
{
PETHREAD Thread;
- PVOID KernelStack;
+ ULONG_PTR KernelStack;
extern unsigned int init_stack;
Thread = ExAllocatePool(NonPagedPool, sizeof(ETHREAD));
@@ -71,11 +71,11 @@
Thread->ThreadsProcess = Process;
if (First)
{
- KernelStack = (PVOID)init_stack;
+ KernelStack = init_stack;
}
else
{
- KernelStack = MmCreateKernelStack(FALSE);
+ KernelStack = (ULONG_PTR)MmCreateKernelStack(FALSE) + KERNEL_STACK_SIZE;
}
KeInitializeThread(&Process->Pcb,
&Thread->Tcb,
@@ -84,8 +84,7 @@
NULL,
NULL,
NULL,
- KernelStack);
- Thread->Tcb.ApcQueueable = TRUE;
+ (PVOID)KernelStack);
InitializeListHead(&Thread->IrpList);
*ThreadPtr = Thread;
return STATUS_SUCCESS;
--- trunk/reactos/ntoskrnl/ps/kill.c 2006-01-13 20:37:55 UTC (rev 20837)
+++ trunk/reactos/ntoskrnl/ps/kill.c 2006-01-13 21:56:51 UTC (rev 20838)
@@ -194,7 +194,7 @@
if(Thread->Tcb.Win32Thread != NULL) ExFreePool (Thread->Tcb.Win32Thread);
/* Release the Kernel Stack */
- //MmDeleteKernelStack((PVOID)Thread->Tcb.StackLimit, FALSE);
+ MmDeleteKernelStack((PVOID)Thread->Tcb.StackLimit, Thread->Tcb.StackLimit);
/* Dereference the Process */
ObDereferenceObject(Process);
--- trunk/reactos/ntoskrnl/ps/thread.c 2006-01-13 20:37:55 UTC (rev 20837)
+++ trunk/reactos/ntoskrnl/ps/thread.c 2006-01-13 21:56:51 UTC (rev 20838)
@@ -116,7 +116,7 @@
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
NTSTATUS Status;
HANDLE_TABLE_ENTRY CidEntry;
- PVOID KernelStack;
+ ULONG_PTR KernelStack;
/* Reference the Process by handle or pointer, depending on what we got */
DPRINT("PspCreateThread: %x, %x, %x\n", ProcessHandle, TargetProcess, ThreadContext);
@@ -206,7 +206,7 @@
/* Allocate Stack for non-GUI Thread */
DPRINT("Initialliazing Thread Stack\n");
- KernelStack = MmCreateKernelStack(FALSE);
+ KernelStack = (ULONG_PTR)MmCreateKernelStack(FALSE) + KERNEL_STACK_SIZE;
/* Set the Process CID */
DPRINT("Initialliazing Thread PID and Parent Process\n");
@@ -236,7 +236,7 @@
NULL,
ThreadContext,
TebBase,
- KernelStack);
+ (PVOID)KernelStack);
} else {
@@ -254,7 +254,7 @@
StartContext,
NULL,
NULL,
- KernelStack);
+ (PVOID)KernelStack);
}
/*
@@ -269,10 +269,6 @@
DPRINT("Running Thread Notify \n");
PspRunCreateThreadNotifyRoutines(Thread, TRUE);
- /* FIXME: Use Lock */
- DPRINT("Apcs Queueable: %d \n", Thread->Tcb.ApcQueueable);
- Thread->Tcb.ApcQueueable = TRUE;
-
/* Suspend the Thread if we have to */
if (CreateSuspended) {
--- trunk/reactos/ntoskrnl/ps/win32.c 2006-01-13 20:37:55 UTC (rev 20837)
+++ trunk/reactos/ntoskrnl/ps/win32.c 2006-01-13 21:56:51 UTC (rev 20838)
@@ -71,7 +71,8 @@
NTAPI
PsConvertToGuiThread(VOID)
{
- PVOID NewStack, OldStack;
+ ULONG_PTR NewStack;
+ PVOID OldStack;
PETHREAD Thread = PsGetCurrentThread();
PEPROCESS Process = PsGetCurrentProcess();
NTSTATUS Status;
@@ -102,7 +103,7 @@
if (!Thread->Tcb.LargeStack)
{
/* We don't create one */
- NewStack = MmCreateKernelStack(TRUE);
+ NewStack = (ULONG_PTR)MmCreateKernelStack(TRUE) + KERNEL_LARGE_STACK_SIZE;
if (!NewStack)
{
/* Panic in user-mode */
@@ -114,8 +115,8 @@
KeEnterCriticalRegion();
/* Switch stacks */
- OldStack = KeSwitchKernelStack((PVOID)((ULONG_PTR)NewStack + 0x3000),
- NewStack);
+ OldStack = KeSwitchKernelStack((PVOID)NewStack,
+ (PVOID)(NewStack - KERNEL_STACK_SIZE));
/* Leave the critical region */
KeLeaveCriticalRegion();