3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/ps/i386/continue.c
6 * PURPOSE: i386 implementation of NtContinue()
7 * PROGRAMMER: Royce Mitchell III, kjk_hyperion
12 /* INCLUDES ****************************************************************/
16 #include <internal/debug.h>
20 KeRosTrapReturn ( PKTRAP_FRAME TrapFrame
, PKTRAP_FRAME PrevTrapFrame
);
23 KeRosDumpStackFrames ( PULONG Frame
, ULONG FrameCount
);
33 PKTRAP_FRAME TrapFrame
= KeGetCurrentThread()->TrapFrame
;
34 PKTRAP_FRAME PrevTrapFrame
= (PKTRAP_FRAME
)TrapFrame
->Edx
;
35 PFX_SAVE_AREA FxSaveArea
;
38 DPRINT("NtContinue: Context: Eip=0x%x, Esp=0x%x\n", Context
->Eip
, Context
->Esp
);
40 __asm__("mov %%ebp, %%ebx" : "=b" (Frame
) : );
41 DPRINT( "NtContinue(): Ebp=%x, prev/TF=%x/%x\n", Frame
, Frame
[0], TrapFrame
);
43 KeRosDumpStackFrames(NULL
,5);
46 if ( Context
== NULL
)
48 DPRINT1("NtContinue called with NULL Context\n");
49 return STATUS_INVALID_PARAMETER
;
52 if ( TrapFrame
== NULL
)
54 CPRINT("NtContinue called but TrapFrame was NULL\n");
59 * Copy the supplied context over the register information that was saved
60 * on entry to kernel mode, it will then be restored on exit
61 * FIXME: Validate the context
63 KeContextToTrapFrame ( Context
, TrapFrame
);
65 /* Put the floating point context into the thread's FX_SAVE_AREA
66 * and make sure it is reloaded when needed.
68 FxSaveArea
= (PFX_SAVE_AREA
)((ULONG_PTR
)KeGetCurrentThread()->InitialStack
- sizeof(FX_SAVE_AREA
));
69 if (KiContextToFxSaveArea(FxSaveArea
, Context
))
71 KeGetCurrentThread()->NpxState
= NPX_STATE_VALID
;
72 KeRaiseIrql(DISPATCH_LEVEL
, &oldIrql
);
73 if (KeGetCurrentKPCR()->PrcbData
.NpxThread
== KeGetCurrentThread())
75 KeGetCurrentKPCR()->PrcbData
.NpxThread
= NULL
;
76 Ke386SetCr0(Ke386GetCr0() | X86_CR0_TS
);
80 ASSERT((Ke386GetCr0() & X86_CR0_TS
) == X86_CR0_TS
);
85 KeRosTrapReturn ( TrapFrame
, PrevTrapFrame
);
87 return STATUS_SUCCESS
; /* this doesn't actually happen b/c KeRosTrapReturn() won't return */