2004-08-15 Casper S. Hornstrup <chorns@users.sourceforge.net>
[reactos.git] / reactos / ntoskrnl / ps / i386 / continue.c
1 /* $Id: continue.c,v 1.5 2004/08/15 16:39:11 chorns Exp $
2 *
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
8 * REVISION HISTORY:
9 * 29/06/04: Created
10 */
11
12 /* INCLUDES ****************************************************************/
13
14 #include <ntoskrnl.h>
15 #define NDEBUG
16 #include <internal/debug.h>
17
18 VOID
19 FASTCALL
20 KeRosTrapReturn ( PKTRAP_FRAME TrapFrame, PKTRAP_FRAME PrevTrapFrame );
21
22 VOID STDCALL
23 KeRosDumpStackFrames ( PULONG Frame, ULONG FrameCount );
24
25 /*
26 * @implemented
27 */
28 NTSTATUS STDCALL
29 NtContinue (
30 IN PCONTEXT Context,
31 IN BOOLEAN TestAlert)
32 {
33 PKTRAP_FRAME TrapFrame = KeGetCurrentThread()->TrapFrame;
34 PKTRAP_FRAME PrevTrapFrame = (PKTRAP_FRAME)TrapFrame->Edx;
35
36 DPRINT("NtContinue: Context: Eip=0x%x, Esp=0x%x\n", Context->Eip, Context->Esp );
37 PULONG Frame = 0;
38 __asm__("mov %%ebp, %%ebx" : "=b" (Frame) : );
39 DPRINT( "NtContinue(): Ebp=%x, prev/TF=%x/%x\n", Frame, Frame[0], TrapFrame );
40 #ifndef NDEBUG
41 KeRosDumpStackFrames(NULL,5);
42 #endif
43
44 if ( Context == NULL )
45 {
46 DPRINT1("NtContinue called with NULL Context\n");
47 return STATUS_INVALID_PARAMETER;
48 }
49
50 if ( TrapFrame == NULL )
51 {
52 CPRINT("NtContinue called but TrapFrame was NULL\n");
53 KEBUGCHECK(0);
54 }
55
56 /*
57 * Copy the supplied context over the register information that was saved
58 * on entry to kernel mode, it will then be restored on exit
59 * FIXME: Validate the context
60 */
61 KeContextToTrapFrame ( Context, TrapFrame );
62
63 KeRosTrapReturn ( TrapFrame, PrevTrapFrame );
64
65 return STATUS_SUCCESS; /* this doesn't actually happen b/c KeRosTrapReturn() won't return */
66 }