don't receive the previous mode before the current thread was created, this should finally fix the boot.

svn path=/trunk/; revision=14044
This commit is contained in:
Thomas Bluemel 2005-03-14 01:47:18 +00:00
parent 78dbb934c2
commit 865a496525
5 changed files with 21 additions and 8 deletions

View file

@ -455,6 +455,7 @@ NTSTATUS
PsInitializeThread(PEPROCESS Process,
PETHREAD* ThreadPtr,
POBJECT_ATTRIBUTES ObjectAttributes,
KPROCESSOR_MODE AccessMode,
BOOLEAN First);
PACCESS_TOKEN PsReferenceEffectiveToken(PETHREAD Thread,
@ -532,6 +533,8 @@ VOID
PsApplicationProcessorInit(VOID);
VOID
PsPrepareForApplicationProcessorInit(ULONG Id);
VOID
PsInitReaperThread(VOID);
VOID STDCALL
PsIdleThreadMain(PVOID Context);

View file

@ -399,17 +399,15 @@ NTSTATUS
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 @@ PsInitializeThread(PEPROCESS Process,
/*
* Create and initialize thread
*/
Status = ObCreateObject(PreviousMode,
Status = ObCreateObject(AccessMode,
PsThreadType,
ObjectAttributes,
KernelMode,
@ -730,6 +728,7 @@ NtCreateThread(OUT PHANDLE ThreadHandle,
Status = PsInitializeThread(Process,
&Thread,
ObjectAttributes,
PreviousMode,
FALSE);
ObDereferenceObject(Process);
@ -877,6 +876,7 @@ PsCreateSystemThread(PHANDLE ThreadHandle,
Status = PsInitializeThread(NULL,
&Thread,
ObjectAttributes,
KernelMode,
FALSE);
if (!NT_SUCCESS(Status))
{

View file

@ -57,6 +57,7 @@ PsInitIdleThread(VOID)
Status = PsInitializeThread(NULL,
&IdleThread,
NULL,
KernelMode,
FALSE);
if (!NT_SUCCESS(Status))
{

View file

@ -30,6 +30,7 @@ PiInitProcessManager(VOID)
PsInitProcessManagment();
PsInitThreadManagment();
PsInitIdleThread();
PsInitReaperThread();
PsInitialiseSuspendImplementation();
PsInitialiseW32Call();
}

View file

@ -709,6 +709,7 @@ PsPrepareForApplicationProcessorInit(ULONG Id)
PsInitializeThread(NULL,
&IdleThread,
NULL,
KernelMode,
FALSE);
IdleThread->Tcb.State = THREAD_STATE_RUNNING;
IdleThread->Tcb.FreezeCount = 0;
@ -731,10 +732,8 @@ PsInitThreadManagment(VOID)
* 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 @@ PsInitThreadManagment(VOID)
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 @@ PsInitThreadManagment(VOID)
DPRINT("FirstThread %x\n",FirstThread);
DoneInitYet = TRUE;
}
VOID
PsInitReaperThread(VOID)
{
PETHREAD ReaperThread;
KIRQL oldIrql;
NTSTATUS Status;
/*
* Create the reaper thread
*/
@ -785,6 +792,7 @@ PsInitThreadManagment(VOID)
Status = PsInitializeThread(NULL,
&ReaperThread,
NULL,
KernelMode,
FALSE);
if (!NT_SUCCESS(Status))
{