- Implement KdpGetStateChange.
authorAlex Ionescu <aionescu@gmail.com>
Tue, 20 Feb 2007 04:57:43 +0000 (04:57 +0000)
committerAlex Ionescu <aionescu@gmail.com>
Tue, 20 Feb 2007 04:57:43 +0000 (04:57 +0000)
- Implement DbgKdContinueApi and DbgKdContinueApi2 cases.
- Remove several while (TRUE);s which started being hit since our code is working fine.
- WinDBG gets notifications for all the drivers/symbols being loaded and ROS now boots to bootvid logo, but we don't yet break-in.

svn path=/branches/alex-kd-branch/; revision=25855

reactos/ntoskrnl/include/internal/kd.h
reactos/ntoskrnl/kd64/kdapi.c
reactos/ntoskrnl/kd64/kddata.c
reactos/ntoskrnl/kd64/kdinit.c
reactos/ntoskrnl/kd64/kdprint.c

index d6e9234..15295c1 100644 (file)
@@ -210,3 +210,4 @@ extern ULONG KdpBreakpointInstruction;
 extern BOOLEAN KdpOweBreakpoint;
 extern BOOLEAN BreakpointsSuspended;
 extern ULONG KdpNumInternalBreakpoints;
+extern ULONG KdpCurrentSymbolStart, KdpCurrentSymbolEnd;
index d69bb22..c008a3f 100644 (file)
 \r
 /* PRIVATE FUNCTIONS *********************************************************/\r
 \r
+VOID\r
+NTAPI\r
+KdpGetStateChange(IN PDBGKD_MANIPULATE_STATE64 State,\r
+                  IN PCONTEXT Context)\r
+{\r
+    PKPRCB Prcb;\r
+    ULONG i;\r
+\r
+    /* Check for success */\r
+    if (NT_SUCCESS(State->u.Continue2.ContinueStatus))\r
+    {\r
+        /* Check if we're tracing */\r
+        if (State->u.Continue2.ControlSet.TraceFlag)\r
+        {\r
+            /* Enable TF */\r
+            Context->EFlags |= EFLAGS_TF;\r
+        }\r
+        else\r
+        {\r
+            /* Remove it */\r
+            Context->EFlags &= ~EFLAGS_TF;\r
+        }\r
+\r
+        /* Loop all processors */\r
+        for (i = 0; i < KeNumberProcessors; i++)\r
+        {\r
+            /* Get the PRCB and update DR7 and DR6 */\r
+            Prcb = KiProcessorBlock[i];\r
+            Prcb->ProcessorState.SpecialRegisters.KernelDr7 =\r
+                State->u.Continue2.ControlSet.Dr7;\r
+            Prcb->ProcessorState.SpecialRegisters.KernelDr6 = 0;\r
+        }\r
+\r
+        /* Check if we have new symbol information */\r
+        if (State->u.Continue2.ControlSet.CurrentSymbolStart != 1)\r
+        {\r
+            /* Update it */\r
+            KdpCurrentSymbolStart =\r
+                State->u.Continue2.ControlSet.CurrentSymbolStart;\r
+            KdpCurrentSymbolEnd= State->u.Continue2.ControlSet.CurrentSymbolEnd;\r
+        }\r
+    }\r
+}\r
+\r
 VOID\r
 NTAPI\r
 KdpSetCommonState(IN ULONG NewState,\r
@@ -507,10 +551,8 @@ SendPacket:
 \r
             case DbgKdContinueApi:\r
 \r
-                /* FIXME: TODO */\r
-                Ke386SetCr2(DbgKdContinueApi);\r
-                while (TRUE);\r
-                break;\r
+                /* Simply continue */\r
+                return NT_SUCCESS(ManipulateState.u.Continue.ContinueStatus);\r
 \r
             case DbgKdReadControlSpaceApi:\r
 \r
@@ -547,9 +589,18 @@ SendPacket:
 \r
             case DbgKdContinueApi2:\r
 \r
-                /* FIXME: TODO */\r
-                Ke386SetCr2(DbgKdContinueApi2);\r
-                while (TRUE);\r
+                /* Check if caller reports success */\r
+                if (NT_SUCCESS(ManipulateState.u.Continue2.ContinueStatus))\r
+                {\r
+                    /* Update the state */\r
+                    KdpGetStateChange(&ManipulateState, Context);\r
+                    return ContinueSuccess;\r
+                }\r
+                else\r
+                {\r
+                    /* Return an error */\r
+                    return ContinueError;\r
+                }\r
                 break;\r
 \r
             case DbgKdReadPhysicalMemoryApi:\r
@@ -817,7 +868,6 @@ KdpReportLoadSymbolsStateChange(IN PSTRING PathName,
     } while(Status == ContinueProcessorReselected);\r
 \r
     /* Return status */\r
-    while (TRUE);\r
     return Status;\r
 }\r
 \r
index d51cf99..d1389f4 100644 (file)
@@ -54,6 +54,8 @@ BOOLEAN KdpOweBreakpoint;
 BOOLEAN BreakpointsSuspended;\r
 ULONG KdpNumInternalBreakpoints;\r
 \r
+ULONG KdpCurrentSymbolStart, KdpCurrentSymbolEnd;\r
+\r
 //\r
 // Time Slip Support\r
 //\r
index 1c0c9bf..ad96f7d 100644 (file)
@@ -248,7 +248,6 @@ KdInitSystem(IN ULONG BootPhase,
 \r
         /* Check for incoming breakin and break on symbol load if we have it*/\r
         KdBreakAfterSymbolLoad = KdPollBreakIn();\r
-        while (TRUE);\r
     }\r
     else\r
     {\r
index 16e0f17..2f35592 100644 (file)
@@ -101,7 +101,7 @@ KdpSymbol(IN PSTRING DllPath,
     RtlCopyMemory(ContextRecord,\r
                   &Prcb->ProcessorState.ContextFrame,\r
                   sizeof(CONTEXT));\r
-    KiRestoreProcessorControlState(&Prcb->ProcessorState);\r
+    //KiRestoreProcessorControlState(&Prcb->ProcessorState);\r
 \r
     /* Exit the debugger and clear the CTRL-C state */\r
     KdExitDebugger(Entered);\r