Revert r52482, it didn't really work. Instead grab the StallScaleFactor from the PCR and use this as a base for the repeat count.

svn path=/trunk/; revision=52487
This commit is contained in:
Timo Kreuzer
2011-06-28 15:12:02 +00:00
parent 7d7c3abd4d
commit a4f75706d0
3 changed files with 10 additions and 19 deletions
+5 -18
View File
@@ -9,9 +9,6 @@
#include "kddll.h"
#include "kdcom.h"
/* Define wait timeout value. */
#define REPEAT_COUNT 100
/* serial debug connection */
#define DEFAULT_DEBUG_PORT 2 /* COM2 */
#define DEFAULT_DEBUG_COM1_IRQ 4 /* COM1 IRQ */
@@ -126,6 +123,10 @@ KdDebuggerInitialize0(
/* 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 @@ KDP_STATUS
NTAPI
KdpReceiveByte(OUT PBYTE OutByte)
{
ULONG Repeats = REPEAT_COUNT;
ULONG Repeats = KdpStallScaleFactor * 100;
while (Repeats--)
{
@@ -258,20 +259,6 @@ KdpReceiveByte(OUT PBYTE OutByte)
/* 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 */
+2 -1
View File
@@ -6,7 +6,6 @@
* PROGRAMMER: Timo Kreuzer ([email protected])
*/
//#define KDDEBUG /* uncomment to enable debugging this dll */
#include "kddll.h"
/* GLOBALS ********************************************************************/
@@ -15,6 +14,7 @@ PFNDBGPRNT KdpDbgPrint = NULL;
ULONG CurrentPacketId = INITIAL_PACKET_ID | SYNC_PACKET_ID;
ULONG RemotePacketId = 0;
BOOLEAN KdpPhase1Complete = FALSE;
ULONG KdpStallScaleFactor = 1000;
/* PRIVATE FUNCTIONS **********************************************************/
@@ -89,6 +89,7 @@ NTAPI
KdDebuggerInitialize1(
IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)
{
KdpStallScaleFactor = KeGetPcr()->StallScaleFactor * 100;
KdpPhase1Complete = TRUE;
return STATUS_SUCCESS;
+3
View File
@@ -8,6 +8,8 @@
#pragma once
//#define KDDEBUG /* uncomment to enable debugging this dll */
#define NOEXTAPI
#include <ntifs.h>
#define NDEBUG
@@ -26,6 +28,7 @@ typedef UCHAR BYTE, *PBYTE;
typedef ULONG (*PFNDBGPRNT)(const char *Format, ...);
extern PFNDBGPRNT KdpDbgPrint;
extern BOOLEAN KdpPhase1Complete;
extern ULONG KdpStallScaleFactor;
typedef enum
{