[ros-diffs] [tkreuzer] 52487: [KDCOM] Revert r52482, it didn't really work. Instead grab the StallScaleFactor from the PCR and use this as a base for the repeat count.

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Tue Jun 28 15:12:03 UTC 2011


Author: tkreuzer
Date: Tue Jun 28 15:12:02 2011
New Revision: 52487

URL: http://svn.reactos.org/svn/reactos?rev=52487&view=rev
Log:
[KDCOM]
Revert r52482, it didn't really work. Instead grab the StallScaleFactor from the PCR and use this as a base for the repeat count.

Modified:
    trunk/reactos/drivers/base/kddll/kdcom.c
    trunk/reactos/drivers/base/kddll/kddll.c
    trunk/reactos/drivers/base/kddll/kddll.h

Modified: trunk/reactos/drivers/base/kddll/kdcom.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/base/kddll/kdcom.c?rev=52487&r1=52486&r2=52487&view=diff
==============================================================================
--- trunk/reactos/drivers/base/kddll/kdcom.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/base/kddll/kdcom.c [iso-8859-1] Tue Jun 28 15:12:02 2011
@@ -8,9 +8,6 @@
 
 #include "kddll.h"
 #include "kdcom.h"
-
-/* Define wait timeout value. */
-#define REPEAT_COUNT 100
 
 /* serial debug connection */
 #define DEFAULT_DEBUG_PORT      2 /* COM2 */
@@ -126,6 +123,10 @@
     /* Check if e have a LoaderBlock */
     if (LoaderBlock)
     {
+        /* HACK */
+        KdpDbgPrint = LoaderBlock->u.I386.CommonDataArea;
+        KDDEBUG("KdDebuggerInitialize0\n");
+
         /* Get the Command Line */
         CommandLine = LoaderBlock->LoadOptions;
 
@@ -248,7 +249,7 @@
 NTAPI
 KdpReceiveByte(OUT PBYTE OutByte)
 {
-    ULONG Repeats = REPEAT_COUNT;
+    ULONG Repeats = KdpStallScaleFactor * 100;
 
     while (Repeats--)
     {
@@ -258,20 +259,6 @@
             /* We successfully got a byte */
             return KDP_PACKET_RECEIVED;
         }
-
-        /* Check if phase 1 is complete */
-        if (KdpPhase1Complete)
-        {
-            /* Use hal to wait 1ms */
-            KeStallExecutionProcessor(1000);
-        }
-        else
-        {
-            volatile unsigned long i;
-
-            /* Do some busy waiting */
-            for (i = 0; i < 1000; i++);
-        }
     }
 
     /* Timed out */

Modified: trunk/reactos/drivers/base/kddll/kddll.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/base/kddll/kddll.c?rev=52487&r1=52486&r2=52487&view=diff
==============================================================================
--- trunk/reactos/drivers/base/kddll/kddll.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/base/kddll/kddll.c [iso-8859-1] Tue Jun 28 15:12:02 2011
@@ -6,7 +6,6 @@
  * PROGRAMMER:      Timo Kreuzer (timo.kreuzer at ewactos.org)
  */
 
-//#define KDDEBUG /* uncomment to enable debugging this dll */
 #include "kddll.h"
 
 /* GLOBALS ********************************************************************/
@@ -15,6 +14,7 @@
 ULONG CurrentPacketId = INITIAL_PACKET_ID | SYNC_PACKET_ID;
 ULONG RemotePacketId = 0;
 BOOLEAN KdpPhase1Complete = FALSE;
+ULONG KdpStallScaleFactor = 1000;
 
 
 /* PRIVATE FUNCTIONS **********************************************************/
@@ -89,6 +89,7 @@
 KdDebuggerInitialize1(
     IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)
 {
+    KdpStallScaleFactor = KeGetPcr()->StallScaleFactor * 100;
     KdpPhase1Complete = TRUE;
 
     return STATUS_SUCCESS;

Modified: trunk/reactos/drivers/base/kddll/kddll.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/base/kddll/kddll.h?rev=52487&r1=52486&r2=52487&view=diff
==============================================================================
--- trunk/reactos/drivers/base/kddll/kddll.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/base/kddll/kddll.h [iso-8859-1] Tue Jun 28 15:12:02 2011
@@ -7,6 +7,8 @@
  */
 
 #pragma once
+
+//#define KDDEBUG /* uncomment to enable debugging this dll */
 
 #define NOEXTAPI
 #include <ntifs.h>
@@ -26,6 +28,7 @@
 typedef ULONG (*PFNDBGPRNT)(const char *Format, ...);
 extern PFNDBGPRNT KdpDbgPrint;
 extern BOOLEAN KdpPhase1Complete;
+extern ULONG KdpStallScaleFactor;
 
 typedef enum
 {




More information about the Ros-diffs mailing list