Author: tkreuzer
Date: Mon Jun 27 16:51:00 2011
New Revision: 52482
URL:
http://svn.reactos.org/svn/reactos?rev=52482&view=rev
Log:
[KDCOM]
Use KeStallExecutionProcessor, once its ready (after KdDebuggerInitialize1 was called) for
the receive timeout. Repeat 100 times with 1 ms wait. This seems to work quite well, but
might be tuned for better values.
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…
==============================================================================
--- trunk/reactos/drivers/base/kddll/kdcom.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/base/kddll/kdcom.c [iso-8859-1] Mon Jun 27 16:51:00 2011
@@ -10,7 +10,7 @@
#include "kdcom.h"
/* Define wait timeout value. */
-#define REPEAT_COUNT (1000 * 1000)
+#define REPEAT_COUNT 100
/* serial debug connection */
#define DEFAULT_DEBUG_PORT 2 /* COM2 */
@@ -258,6 +258,20 @@
/* 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…
==============================================================================
--- trunk/reactos/drivers/base/kddll/kddll.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/base/kddll/kddll.c [iso-8859-1] Mon Jun 27 16:51:00 2011
@@ -14,6 +14,7 @@
PFNDBGPRNT KdpDbgPrint = NULL;
ULONG CurrentPacketId = INITIAL_PACKET_ID | SYNC_PACKET_ID;
ULONG RemotePacketId = 0;
+BOOLEAN KdpPhase1Complete = FALSE;
/* PRIVATE FUNCTIONS **********************************************************/
@@ -88,11 +89,9 @@
KdDebuggerInitialize1(
IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)
{
- // HACK: misuse this function to get a pointer to FrLdrDbgPrint
- KdpDbgPrint = (PVOID)LoaderBlock;
- KDDBGPRINT("KdDebuggerInitialize1\n");
-
- return STATUS_NOT_IMPLEMENTED;
+ KdpPhase1Complete = TRUE;
+
+ return STATUS_SUCCESS;
}
@@ -198,7 +197,7 @@
switch (Packet.PacketType)
{
case PACKET_TYPE_KD_ACKNOWLEDGE:
- /* Are we waiting for an ACK packet? */
+ /* Are we waiting for an ACK packet? */
if (PacketType == PACKET_TYPE_KD_ACKNOWLEDGE &&
Packet.PacketId == (CurrentPacketId & ~SYNC_PACKET_ID))
{
@@ -276,7 +275,7 @@
if (MessageData)
{
/* Set the length of the message data */
- MessageData->Length = *DataLength;
+ MessageData->Length = (USHORT)*DataLength;
/* Do we have data? */
if (MessageData->Length)
@@ -359,7 +358,7 @@
/* Initialize a KD_PACKET */
Packet.PacketLeader = PACKET_LEADER;
- Packet.PacketType = PacketType;
+ Packet.PacketType = (USHORT)PacketType;
Packet.ByteCount = MessageHeader->Length;
Packet.Checksum = KdpCalculateChecksum(MessageHeader->Buffer,
MessageHeader->Length);
Modified: trunk/reactos/drivers/base/kddll/kddll.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/base/kddll/kddll.h…
==============================================================================
--- trunk/reactos/drivers/base/kddll/kddll.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/base/kddll/kddll.h [iso-8859-1] Mon Jun 27 16:51:00 2011
@@ -25,6 +25,7 @@
typedef ULONG (*PFNDBGPRNT)(const char *Format, ...);
extern PFNDBGPRNT KdpDbgPrint;
+extern BOOLEAN KdpPhase1Complete;
typedef enum
{