Author: pschweitzer Date: Fri Nov 19 06:46:59 2010 New Revision: 49618
URL: http://svn.reactos.org/svn/reactos?rev=49618&view=rev Log: [NTOSKRNL] Simplify code, which should bring some fixing
Modified: trunk/reactos/ntoskrnl/ke/i386/thrdini.c
Modified: trunk/reactos/ntoskrnl/ke/i386/thrdini.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/thrdini.c?... ============================================================================== --- trunk/reactos/ntoskrnl/ke/i386/thrdini.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/i386/thrdini.c [iso-8859-1] Fri Nov 19 06:46:59 2010 @@ -334,7 +334,6 @@ PKPROCESS OldProcess, NewProcess; PKGDTENTRY GdtEntry; PKTHREAD NewThread; - PKUINIT_FRAME InitFrame;
/* We are on the new thread stack now */ NewThread = Pcr->PrcbData.CurrentThread; @@ -366,12 +365,12 @@ GdtEntry->HighWord.Bytes.BaseHi = (UCHAR)((ULONG_PTR)NewThread->Teb >> 24);
/* Set new TSS fields */ - InitFrame = (PKUINIT_FRAME)NewThread->InitialStack - 1; - Pcr->TSS->Esp0 = (ULONG_PTR)&InitFrame->TrapFrame; - if (!(InitFrame->TrapFrame.EFlags & EFLAGS_V86_MASK)) + Pcr->TSS->Esp0 = (ULONG_PTR)NewThread->InitialStack; + if (!((KeGetTrapFrame(NewThread))->EFlags & EFLAGS_V86_MASK)) { Pcr->TSS->Esp0 -= (FIELD_OFFSET(KTRAP_FRAME, V86Gs) - FIELD_OFFSET(KTRAP_FRAME, HardwareSegSs)); } + Pcr->TSS->Esp0 -= NPX_FRAME_LENGTH; Pcr->TSS->IoMapBase = NewProcess->IopmOffset;
/* Increase thread context switches */ @@ -443,7 +442,7 @@ Cr0 = __readcr0(); NewCr0 = NewThread->NpxState | (Cr0 & ~(CR0_MP | CR0_EM | CR0_TS)) | - ((PKUINIT_FRAME)NewThread->InitialStack - 1)->FxSaveArea.Cr0NpxState; + KiGetThreadNpxArea(NewThread)->Cr0NpxState; if (Cr0 != NewCr0) __writecr0(NewCr0);
/* Now enable interrupts and do the switch */