don't receive the previous mode before the current thread was created, this should finally fix the boot.
Modified: trunk/reactos/ntoskrnl/include/internal/ps.h
Modified: trunk/reactos/ntoskrnl/ps/create.c
Modified: trunk/reactos/ntoskrnl/ps/idle.c
Modified: trunk/reactos/ntoskrnl/ps/psmgr.c
Modified: trunk/reactos/ntoskrnl/ps/thread.c

Modified: trunk/reactos/ntoskrnl/include/internal/ps.h
--- trunk/reactos/ntoskrnl/include/internal/ps.h	2005-03-14 00:36:02 UTC (rev 14043)
+++ trunk/reactos/ntoskrnl/include/internal/ps.h	2005-03-14 01:47:18 UTC (rev 14044)
@@ -455,6 +455,7 @@
 PsInitializeThread(PEPROCESS Process,
 		   PETHREAD* ThreadPtr,
 		   POBJECT_ATTRIBUTES ObjectAttributes,
+		   KPROCESSOR_MODE AccessMode,
 		   BOOLEAN First);
 
 PACCESS_TOKEN PsReferenceEffectiveToken(PETHREAD Thread,
@@ -532,6 +533,8 @@
 PsApplicationProcessorInit(VOID);
 VOID
 PsPrepareForApplicationProcessorInit(ULONG Id);
+VOID
+PsInitReaperThread(VOID);
 VOID STDCALL
 PsIdleThreadMain(PVOID Context);
 

Modified: trunk/reactos/ntoskrnl/ps/create.c
--- trunk/reactos/ntoskrnl/ps/create.c	2005-03-14 00:36:02 UTC (rev 14043)
+++ trunk/reactos/ntoskrnl/ps/create.c	2005-03-14 01:47:18 UTC (rev 14044)
@@ -399,17 +399,15 @@
 PsInitializeThread(PEPROCESS Process,
 		   PETHREAD* ThreadPtr,
 		   POBJECT_ATTRIBUTES ObjectAttributes,
+		   KPROCESSOR_MODE AccessMode,
 		   BOOLEAN First)
 {
    PETHREAD Thread;
    NTSTATUS Status;
-   KPROCESSOR_MODE PreviousMode;
    KIRQL oldIrql;
    
    PAGED_CODE();
    
-   PreviousMode = ExGetPreviousMode();
-   
    if (Process == NULL)
      {
 	Process = PsInitialSystemProcess;
@@ -418,7 +416,7 @@
    /*
     * Create and initialize thread
     */
-   Status = ObCreateObject(PreviousMode,
+   Status = ObCreateObject(AccessMode,
 			   PsThreadType,
 			   ObjectAttributes,
 			   KernelMode,
@@ -730,6 +728,7 @@
   Status = PsInitializeThread(Process,
 			      &Thread,
 			      ObjectAttributes,
+			      PreviousMode,
 			      FALSE);
 
   ObDereferenceObject(Process);
@@ -877,6 +876,7 @@
    Status = PsInitializeThread(NULL,
 			       &Thread,
 			       ObjectAttributes,
+			       KernelMode,
 			       FALSE);
    if (!NT_SUCCESS(Status))
      {

Modified: trunk/reactos/ntoskrnl/ps/idle.c
--- trunk/reactos/ntoskrnl/ps/idle.c	2005-03-14 00:36:02 UTC (rev 14043)
+++ trunk/reactos/ntoskrnl/ps/idle.c	2005-03-14 01:47:18 UTC (rev 14044)
@@ -57,6 +57,7 @@
    Status = PsInitializeThread(NULL,
 			       &IdleThread,
 			       NULL,
+			       KernelMode,
 			       FALSE);
    if (!NT_SUCCESS(Status))
      {

Modified: trunk/reactos/ntoskrnl/ps/psmgr.c
--- trunk/reactos/ntoskrnl/ps/psmgr.c	2005-03-14 00:36:02 UTC (rev 14043)
+++ trunk/reactos/ntoskrnl/ps/psmgr.c	2005-03-14 01:47:18 UTC (rev 14044)
@@ -30,6 +30,7 @@
    PsInitProcessManagment();
    PsInitThreadManagment();
    PsInitIdleThread();
+   PsInitReaperThread();
    PsInitialiseSuspendImplementation();
    PsInitialiseW32Call();
 }

Modified: trunk/reactos/ntoskrnl/ps/thread.c
--- trunk/reactos/ntoskrnl/ps/thread.c	2005-03-14 00:36:02 UTC (rev 14043)
+++ trunk/reactos/ntoskrnl/ps/thread.c	2005-03-14 01:47:18 UTC (rev 14044)
@@ -709,6 +709,7 @@
   PsInitializeThread(NULL,
 		     &IdleThread,
 		     NULL,
+		     KernelMode,
 		     FALSE);
   IdleThread->Tcb.State = THREAD_STATE_RUNNING;
   IdleThread->Tcb.FreezeCount = 0;
@@ -731,10 +732,8 @@
  * FUNCTION: Initialize thread managment
  */
 {
-   PETHREAD FirstThread, ReaperThread;
+   PETHREAD FirstThread;
    ULONG i;
-   KIRQL oldIrql;
-   NTSTATUS Status;
 
    for (i=0; i < MAXIMUM_PRIORITY; i++)
      {
@@ -766,7 +765,7 @@
 
    ObpCreateTypeObject(PsThreadType);
 
-   PsInitializeThread(NULL, &FirstThread, NULL, TRUE);
+   PsInitializeThread(NULL, &FirstThread, NULL, KernelMode, TRUE);
    FirstThread->Tcb.State = THREAD_STATE_RUNNING;
    FirstThread->Tcb.FreezeCount = 0;
    FirstThread->Tcb.UserAffinity = (1 << 0);   /* Set the affinity of the first thread to the boot processor */
@@ -776,7 +775,15 @@
    DPRINT("FirstThread %x\n",FirstThread);
 
    DoneInitYet = TRUE;
+}
 
+VOID
+PsInitReaperThread(VOID)
+{
+   PETHREAD ReaperThread;
+   KIRQL oldIrql;
+   NTSTATUS Status;
+   
    /*
     * Create the reaper thread
     */
@@ -785,6 +792,7 @@
    Status = PsInitializeThread(NULL,
 			       &ReaperThread,
 			       NULL,
+			       KernelMode,
 			       FALSE);
    if (!NT_SUCCESS(Status))
      {