- Use correct trapframe during set/get context. Thanks to blight for noticing the...
authorAlex Ionescu <aionescu@gmail.com>
Wed, 2 Nov 2005 23:57:38 +0000 (23:57 +0000)
committerAlex Ionescu <aionescu@gmail.com>
Wed, 2 Nov 2005 23:57:38 +0000 (23:57 +0000)
svn path=/trunk/; revision=18963

reactos/ntoskrnl/ps/debug.c

index 9e99424..82dcf7d 100644 (file)
@@ -44,23 +44,30 @@ PspGetOrSetContextKernelRoutine(PKAPC Apc,
     PKEVENT Event;
     PCONTEXT Context;
     KPROCESSOR_MODE Mode;
     PKEVENT Event;
     PCONTEXT Context;
     KPROCESSOR_MODE Mode;
+    PETHREAD Thread;
+    PKTRAP_FRAME TrapFrame;
 
     /* Get the Context Structure */
     GetSetContext = CONTAINING_RECORD(Apc, GET_SET_CTX_CONTEXT, Apc);
     Context = &GetSetContext->Context;
     Event = &GetSetContext->Event;
     Mode = GetSetContext->Mode;
 
     /* Get the Context Structure */
     GetSetContext = CONTAINING_RECORD(Apc, GET_SET_CTX_CONTEXT, Apc);
     Context = &GetSetContext->Context;
     Event = &GetSetContext->Event;
     Mode = GetSetContext->Mode;
+    Thread = SystemArgument2;
 
 
-    /* Check if it's a set or get */
-    if (SystemArgument1) {
+    /* Get trap frame */
+    TrapFrame = (PKTRAP_FRAME)((ULONG_PTR)Thread->Tcb.InitialStack -
+                               sizeof(KTRAP_FRAME) - sizeof(FX_SAVE_AREA));
 
 
+    /* Check if it's a set or get */
+    if (SystemArgument1)
+    {
         /* Get the Context */
         /* Get the Context */
-        KeTrapFrameToContext(KeGetCurrentThread()->TrapFrame, NULL, Context);
-
-    } else {
-
+        KeTrapFrameToContext(TrapFrame, NULL, Context);
+    }
+    else
+    {
         /* Set the Context */
         /* Set the Context */
-        KeContextToTrapFrame(Context, NULL, KeGetCurrentThread()->TrapFrame, Mode);
+        KeContextToTrapFrame(Context, NULL, TrapFrame, Mode);
     }
 
     /* Notify the Native API that we are done */
     }
 
     /* Notify the Native API that we are done */