--- trunk/reactos/ntoskrnl/ke/i386/ctxswitch.S 2006-01-16 16:45:27 UTC (rev 20913)
+++ trunk/reactos/ntoskrnl/ke/i386/ctxswitch.S 2006-01-16 17:05:50 UTC (rev 20914)
@@ -171,8 +171,11 @@
NoAdjust:
/* Set new ESP0 */
- mov [ebp+KTSS_ESP0], eax
+ //mov [ebp+KTSS_ESP0], eax
+ /* Save it */
+ push [ebp+KTSS_ESP0]
+
/* Set TEB pointer */
mov eax, [esi+KTHREAD_TEB]
mov [ebx+KPCR_TEB], eax
@@ -257,6 +260,9 @@
mov cr0, eax
4:
+ /* Restore ESP0 */
+ pop [ebp+KTSS_ESP0]
+
/* Restore exception list */
pop [ebx+KPCR_EXCEPTION_LIST]
--- trunk/reactos/ntoskrnl/ke/i386/thread.c 2006-01-16 16:45:27 UTC (rev 20913)
+++ trunk/reactos/ntoskrnl/ke/i386/thread.c 2006-01-16 17:05:50 UTC (rev 20914)
@@ -14,6 +14,7 @@
typedef struct _KSHARED_CTXSWITCH_FRAME
{
+ ULONG Esp0;
PVOID ExceptionList;
PVOID RetEip;
} KSHARED_CTXSWITCH_FRAME, *PKSHARED_CTXSWITCH_FRAME;
@@ -231,6 +232,9 @@
/* And set up the Context Switch Frame */
CtxSwitchFrame->RetEip = KiThreadStartup;
+ CtxSwitchFrame->Esp0 = (ULONG_PTR)Thread->InitialStack -
+ sizeof(FX_SAVE_AREA) -
+ 0x10;
CtxSwitchFrame->ExceptionList = (PVOID)0xFFFFFFFF;
/* Save back the new value of the kernel stack. */