2005-04-25 14:44:48 +00:00
|
|
|
/*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS kernel
|
|
|
|
* FILE: ntoskrnl/kd/kdio.c
|
|
|
|
* PURPOSE: NT Kernel Debugger Input/Output Functions
|
|
|
|
*
|
|
|
|
* PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* INCLUDES ******************************************************************/
|
|
|
|
|
|
|
|
#include <ntoskrnl.h>
|
2008-08-30 16:31:06 +00:00
|
|
|
#include <debug.h>
|
2005-04-25 14:44:48 +00:00
|
|
|
|
|
|
|
/* GLOBALS *******************************************************************/
|
|
|
|
|
2009-10-07 19:57:40 +00:00
|
|
|
#define KdpBufferSize (1024 * 512)
|
|
|
|
BOOLEAN KdpLoggingEnabled = FALSE;
|
|
|
|
PCHAR KdpDebugBuffer = NULL;
|
|
|
|
volatile ULONG KdpCurrentPosition = 0;
|
|
|
|
volatile ULONG KdpFreeBytes = 0;
|
|
|
|
KSPIN_LOCK KdpDebugLogSpinLock;
|
|
|
|
KEVENT KdpLoggerThreadEvent;
|
|
|
|
HANDLE KdpLogFileHandle;
|
2005-04-25 14:44:48 +00:00
|
|
|
|
2009-03-29 13:15:03 +00:00
|
|
|
KSPIN_LOCK KdpSerialSpinLock;
|
2009-10-07 19:57:40 +00:00
|
|
|
KD_PORT_INFORMATION SerialPortInfo = { DEFAULT_DEBUG_PORT, DEFAULT_DEBUG_BAUD_RATE, 0 };
|
2005-04-25 14:44:48 +00:00
|
|
|
|
|
|
|
/* Current Port in use. FIXME: Do we support more then one? */
|
|
|
|
ULONG KdpPort;
|
|
|
|
|
|
|
|
/* DEBUG LOG FUNCTIONS *******************************************************/
|
|
|
|
|
|
|
|
VOID
|
2008-11-29 20:47:48 +00:00
|
|
|
NTAPI
|
2009-10-07 19:57:40 +00:00
|
|
|
KdpLoggerThread(PVOID Context)
|
2005-04-25 14:44:48 +00:00
|
|
|
{
|
2009-10-07 19:57:40 +00:00
|
|
|
ULONG beg, end, num;
|
2005-04-25 14:44:48 +00:00
|
|
|
IO_STATUS_BLOCK Iosb;
|
|
|
|
|
2009-10-07 19:57:40 +00:00
|
|
|
KdpLoggingEnabled = TRUE;
|
|
|
|
|
|
|
|
while (TRUE)
|
|
|
|
{
|
|
|
|
KeWaitForSingleObject(&KdpLoggerThreadEvent, 0, KernelMode, FALSE, NULL);
|
|
|
|
|
|
|
|
/* Bug */
|
|
|
|
end = KdpCurrentPosition;
|
|
|
|
num = KdpFreeBytes;
|
|
|
|
beg = (end + num) % KdpBufferSize;
|
|
|
|
num = KdpBufferSize - num;
|
|
|
|
|
|
|
|
/* Nothing to do? */
|
|
|
|
if (num == 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (end > beg)
|
|
|
|
{
|
|
|
|
NtWriteFile(KdpLogFileHandle, NULL, NULL, NULL, &Iosb,
|
|
|
|
KdpDebugBuffer + beg, num, NULL, NULL);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
NtWriteFile(KdpLogFileHandle, NULL, NULL, NULL, &Iosb,
|
|
|
|
KdpDebugBuffer + beg, KdpBufferSize - beg, NULL, NULL);
|
|
|
|
|
|
|
|
NtWriteFile(KdpLogFileHandle, NULL, NULL, NULL, &Iosb,
|
|
|
|
KdpDebugBuffer, end, NULL, NULL);
|
|
|
|
}
|
|
|
|
|
2009-10-07 20:04:17 +00:00
|
|
|
(VOID)InterlockedExchangeAddUL(&KdpFreeBytes, num);
|
2009-10-07 19:57:40 +00:00
|
|
|
}
|
2005-04-25 14:44:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
VOID
|
2008-11-29 20:47:48 +00:00
|
|
|
NTAPI
|
2009-10-07 19:57:40 +00:00
|
|
|
KdpPrintToLogFile(PCH String,
|
|
|
|
ULONG StringLength)
|
2005-04-25 14:44:48 +00:00
|
|
|
{
|
2009-10-07 19:57:40 +00:00
|
|
|
ULONG beg, end, num;
|
|
|
|
KIRQL OldIrql;
|
|
|
|
|
|
|
|
if (KdpDebugBuffer == NULL) return;
|
|
|
|
|
|
|
|
/* Acquire the printing spinlock without waiting at raised IRQL */
|
|
|
|
while (TRUE)
|
|
|
|
{
|
|
|
|
/* Wait when the spinlock becomes available */
|
|
|
|
while (!KeTestSpinLock(&KdpDebugLogSpinLock));
|
|
|
|
|
|
|
|
/* Spinlock was free, raise IRQL */
|
|
|
|
KeRaiseIrql(HIGH_LEVEL, &OldIrql);
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2009-10-07 19:57:40 +00:00
|
|
|
/* Try to get the spinlock */
|
|
|
|
if (KeTryToAcquireSpinLockAtDpcLevel(&KdpDebugLogSpinLock))
|
|
|
|
break;
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2009-10-07 19:57:40 +00:00
|
|
|
/* Someone else got the spinlock, lower IRQL back */
|
|
|
|
KeLowerIrql(OldIrql);
|
|
|
|
}
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2009-10-07 19:57:40 +00:00
|
|
|
beg = KdpCurrentPosition;
|
|
|
|
num = KdpFreeBytes;
|
|
|
|
if (StringLength < num)
|
|
|
|
num = StringLength;
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2009-10-07 19:57:40 +00:00
|
|
|
if (num != 0)
|
2005-07-26 15:15:18 +00:00
|
|
|
{
|
2009-10-07 19:57:40 +00:00
|
|
|
end = (beg + num) % KdpBufferSize;
|
|
|
|
KdpCurrentPosition = end;
|
|
|
|
KdpFreeBytes -= num;
|
|
|
|
|
|
|
|
if (end > beg)
|
|
|
|
{
|
|
|
|
RtlCopyMemory(KdpDebugBuffer + beg, String, num);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
RtlCopyMemory(KdpDebugBuffer + beg, String, KdpBufferSize - beg);
|
|
|
|
RtlCopyMemory(KdpDebugBuffer, String + KdpBufferSize - beg, end);
|
|
|
|
}
|
2005-07-26 15:15:18 +00:00
|
|
|
}
|
2009-10-07 19:57:40 +00:00
|
|
|
|
|
|
|
/* Release spinlock */
|
|
|
|
KiReleaseSpinLock(&KdpDebugLogSpinLock);
|
|
|
|
|
|
|
|
/* Lower IRQL */
|
|
|
|
KeLowerIrql(OldIrql);
|
|
|
|
|
|
|
|
/* Signal the logger thread */
|
|
|
|
if (OldIrql <= DISPATCH_LEVEL && KdpLoggingEnabled)
|
|
|
|
KeSetEvent(&KdpLoggerThreadEvent, 0, FALSE);
|
2005-04-25 14:44:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
VOID
|
2008-11-29 20:47:48 +00:00
|
|
|
NTAPI
|
2005-04-25 14:44:48 +00:00
|
|
|
KdpInitDebugLog(PKD_DISPATCH_TABLE DispatchTable,
|
|
|
|
ULONG BootPhase)
|
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
UNICODE_STRING FileName;
|
2009-10-07 19:57:40 +00:00
|
|
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
2005-05-09 01:38:29 +00:00
|
|
|
IO_STATUS_BLOCK Iosb;
|
2009-10-07 19:57:40 +00:00
|
|
|
HANDLE ThreadHandle;
|
|
|
|
KPRIORITY Priority;
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-07-30 16:25:35 +00:00
|
|
|
if (!KdpDebugMode.File) return;
|
|
|
|
|
2005-04-25 14:44:48 +00:00
|
|
|
if (BootPhase == 0)
|
|
|
|
{
|
2009-01-19 23:22:22 +00:00
|
|
|
KdComPortInUse = NULL;
|
2006-06-22 21:26:31 +00:00
|
|
|
|
2005-04-25 14:44:48 +00:00
|
|
|
/* Write out the functions that we support for now */
|
|
|
|
DispatchTable->KdpInitRoutine = KdpInitDebugLog;
|
2009-10-07 19:57:40 +00:00
|
|
|
DispatchTable->KdpPrintRoutine = KdpPrintToLogFile;
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-04-25 14:44:48 +00:00
|
|
|
/* Register as a Provider */
|
|
|
|
InsertTailList(&KdProviders, &DispatchTable->KdProvidersList);
|
2006-06-11 08:25:10 +00:00
|
|
|
|
2009-10-07 19:57:40 +00:00
|
|
|
}
|
|
|
|
else if (BootPhase == 1)
|
|
|
|
{
|
|
|
|
/* Allocate a buffer for debug log */
|
|
|
|
KdpDebugBuffer = ExAllocatePool(NonPagedPool, KdpBufferSize);
|
|
|
|
KdpFreeBytes = KdpBufferSize;
|
|
|
|
|
|
|
|
/* Initialize spinlock */
|
|
|
|
KeInitializeSpinLock(&KdpDebugLogSpinLock);
|
|
|
|
|
2006-06-11 08:25:10 +00:00
|
|
|
/* Display separator + ReactOS version at start of the debug log */
|
|
|
|
DPRINT1("---------------------------------------------------------------\n");
|
|
|
|
DPRINT1("ReactOS "KERNEL_VERSION_STR" (Build "KERNEL_VERSION_BUILD_STR")\n");
|
2005-04-25 14:44:48 +00:00
|
|
|
}
|
|
|
|
else if (BootPhase == 2)
|
|
|
|
{
|
|
|
|
HalDisplayString("\n File log debugging enabled\n\n");
|
|
|
|
}
|
|
|
|
else if (BootPhase == 3)
|
|
|
|
{
|
2009-10-07 19:57:40 +00:00
|
|
|
/* Setup the log name */
|
2005-04-25 14:44:48 +00:00
|
|
|
RtlInitUnicodeString(&FileName, L"\\SystemRoot\\debug.log");
|
|
|
|
InitializeObjectAttributes(&ObjectAttributes,
|
|
|
|
&FileName,
|
|
|
|
0,
|
|
|
|
NULL,
|
|
|
|
NULL);
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2009-10-07 19:57:40 +00:00
|
|
|
/* Create the log file */
|
|
|
|
Status = NtCreateFile(&KdpLogFileHandle,
|
|
|
|
FILE_APPEND_DATA | SYNCHRONIZE,
|
2005-04-25 14:44:48 +00:00
|
|
|
&ObjectAttributes,
|
|
|
|
&Iosb,
|
|
|
|
NULL,
|
|
|
|
FILE_ATTRIBUTE_NORMAL,
|
|
|
|
FILE_SHARE_READ,
|
|
|
|
FILE_SUPERSEDE,
|
|
|
|
FILE_WRITE_THROUGH | FILE_SYNCHRONOUS_IO_NONALERT,
|
|
|
|
NULL,
|
|
|
|
0);
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2009-10-07 19:57:40 +00:00
|
|
|
if (!NT_SUCCESS(Status)) return;
|
|
|
|
|
|
|
|
KeInitializeEvent(&KdpLoggerThreadEvent, SynchronizationEvent, TRUE);
|
|
|
|
|
|
|
|
/* Create the logger thread */
|
|
|
|
Status = PsCreateSystemThread(&ThreadHandle,
|
|
|
|
THREAD_ALL_ACCESS,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
KdpLoggerThread,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
if (!NT_SUCCESS(Status)) return;
|
|
|
|
|
|
|
|
Priority = 7;
|
|
|
|
NtSetInformationThread(ThreadHandle,
|
|
|
|
ThreadPriority,
|
|
|
|
&Priority,
|
|
|
|
sizeof(Priority));
|
2005-04-25 14:44:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* SERIAL FUNCTIONS **********************************************************/
|
|
|
|
|
|
|
|
VOID
|
2008-11-29 20:47:48 +00:00
|
|
|
NTAPI
|
- More sharing between ntdll/ntoskrnl: shared Dbg code.
- Added NtCreateDebugObject, NtDebugContinue, NtQueryDebugFilterState, NtSetDebugFilterState, NtWaitForDebugEvent to system call list.
- Added some debug constants to headers
- Updated RtlpCheckForActiveDebugger in ntoskrnl to return whatever we're expecting as the "normal" case.
- Added RtlpSetInDbgPrint to rtl support library for special DbgPrint implementation difference in user-mode
- Removed all the deprecated debug APIs in ntdll.
- Implemented NtQueryDebugFilterState and NtSetDebugFilterState based on royce's implementation.
- Started modifications on KeDebugService, and implemented DebugService in rtl
- Implemented all the Dbg* APIs in RTL.
- Implemented DbgUiConnectToDbg, DbgUiContinue, DbgUiWaitStateChange, DbgUiRemoteBreakin, DbgUiIssueRemoteBreakin
- Changed KD Print callbacks to also receive the length of the string.
Right now, one call that should be shared still isn't (the final DebugPrint call) because calling KeDebugService from kernel-mode seems to cause a hang. Also, DebugService does not currently cause an exception like it should (instead it still calls the Kdp handler), because those changes would've made the patch even bigger and are still untested.
svn path=/trunk/; revision=18078
2005-09-26 04:59:48 +00:00
|
|
|
KdpSerialDebugPrint(LPSTR Message,
|
|
|
|
ULONG Length)
|
2005-04-25 14:44:48 +00:00
|
|
|
{
|
2009-03-29 13:15:03 +00:00
|
|
|
KIRQL OldIrql;
|
2005-04-25 14:44:48 +00:00
|
|
|
PCHAR pch = (PCHAR) Message;
|
|
|
|
|
2009-03-29 13:15:03 +00:00
|
|
|
/* Acquire the printing spinlock without waiting at raised IRQL */
|
|
|
|
while (TRUE)
|
|
|
|
{
|
|
|
|
/* Wait when the spinlock becomes available */
|
|
|
|
while (!KeTestSpinLock(&KdpSerialSpinLock));
|
|
|
|
|
2009-10-07 19:57:40 +00:00
|
|
|
/* Spinlock was free, raise IRQL */
|
2009-03-29 13:15:03 +00:00
|
|
|
KeRaiseIrql(HIGH_LEVEL, &OldIrql);
|
|
|
|
|
|
|
|
/* Try to get the spinlock */
|
|
|
|
if (KeTryToAcquireSpinLockAtDpcLevel(&KdpSerialSpinLock))
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* Someone else got the spinlock, lower IRQL back */
|
|
|
|
KeLowerIrql(OldIrql);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Output the message */
|
2005-04-25 14:44:48 +00:00
|
|
|
while (*pch != 0)
|
|
|
|
{
|
|
|
|
if (*pch == '\n')
|
|
|
|
{
|
|
|
|
KdPortPutByteEx(&SerialPortInfo, '\r');
|
|
|
|
}
|
|
|
|
KdPortPutByteEx(&SerialPortInfo, *pch);
|
|
|
|
pch++;
|
|
|
|
}
|
2009-03-29 13:15:03 +00:00
|
|
|
|
|
|
|
/* Release spinlock */
|
|
|
|
KiReleaseSpinLock(&KdpSerialSpinLock);
|
|
|
|
|
|
|
|
/* Lower IRQL */
|
|
|
|
KeLowerIrql(OldIrql);
|
2005-04-25 14:44:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
VOID
|
2008-11-29 20:47:48 +00:00
|
|
|
NTAPI
|
2005-04-25 14:44:48 +00:00
|
|
|
KdpSerialInit(PKD_DISPATCH_TABLE DispatchTable,
|
|
|
|
ULONG BootPhase)
|
|
|
|
{
|
|
|
|
if (!KdpDebugMode.Serial) return;
|
|
|
|
|
|
|
|
if (BootPhase == 0)
|
|
|
|
{
|
|
|
|
/* Write out the functions that we support for now */
|
|
|
|
DispatchTable->KdpInitRoutine = KdpSerialInit;
|
|
|
|
DispatchTable->KdpPrintRoutine = KdpSerialDebugPrint;
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-04-25 14:44:48 +00:00
|
|
|
/* Initialize the Port */
|
2005-10-02 09:42:12 +00:00
|
|
|
if (!KdPortInitializeEx(&SerialPortInfo, 0, 0))
|
|
|
|
{
|
|
|
|
KdpDebugMode.Serial = FALSE;
|
|
|
|
return;
|
|
|
|
}
|
2009-01-19 23:22:22 +00:00
|
|
|
KdComPortInUse = (PUCHAR)(ULONG_PTR)SerialPortInfo.BaseAddress;
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2009-03-29 13:15:03 +00:00
|
|
|
/* Initialize spinlock */
|
|
|
|
KeInitializeSpinLock(&KdpSerialSpinLock);
|
|
|
|
|
2005-04-25 14:44:48 +00:00
|
|
|
/* Register as a Provider */
|
|
|
|
InsertTailList(&KdProviders, &DispatchTable->KdProvidersList);
|
2006-10-02 05:40:36 +00:00
|
|
|
|
2006-09-24 07:38:53 +00:00
|
|
|
/* Display separator + ReactOS version at start of the debug log */
|
2006-10-02 05:40:36 +00:00
|
|
|
DPRINT1("-----------------------------------------------------\n");
|
2006-09-24 07:38:53 +00:00
|
|
|
DPRINT1("ReactOS "KERNEL_VERSION_STR" (Build "KERNEL_VERSION_BUILD_STR")\n");
|
2006-10-02 05:40:36 +00:00
|
|
|
DPRINT1("Command Line: %s\n", KeLoaderBlock->LoadOptions);
|
|
|
|
DPRINT1("ARC Paths: %s %s %s %s\n", KeLoaderBlock->ArcBootDeviceName,
|
|
|
|
KeLoaderBlock->NtHalPathName,
|
|
|
|
KeLoaderBlock->ArcHalDeviceName,
|
|
|
|
KeLoaderBlock->NtBootPathName);
|
2005-04-25 14:44:48 +00:00
|
|
|
}
|
|
|
|
else if (BootPhase == 2)
|
|
|
|
{
|
|
|
|
HalDisplayString("\n Serial debugging enabled\n\n");
|
2005-05-09 01:38:29 +00:00
|
|
|
}
|
2005-04-25 14:44:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* SCREEN FUNCTIONS **********************************************************/
|
|
|
|
|
- More sharing between ntdll/ntoskrnl: shared Dbg code.
- Added NtCreateDebugObject, NtDebugContinue, NtQueryDebugFilterState, NtSetDebugFilterState, NtWaitForDebugEvent to system call list.
- Added some debug constants to headers
- Updated RtlpCheckForActiveDebugger in ntoskrnl to return whatever we're expecting as the "normal" case.
- Added RtlpSetInDbgPrint to rtl support library for special DbgPrint implementation difference in user-mode
- Removed all the deprecated debug APIs in ntdll.
- Implemented NtQueryDebugFilterState and NtSetDebugFilterState based on royce's implementation.
- Started modifications on KeDebugService, and implemented DebugService in rtl
- Implemented all the Dbg* APIs in RTL.
- Implemented DbgUiConnectToDbg, DbgUiContinue, DbgUiWaitStateChange, DbgUiRemoteBreakin, DbgUiIssueRemoteBreakin
- Changed KD Print callbacks to also receive the length of the string.
Right now, one call that should be shared still isn't (the final DebugPrint call) because calling KeDebugService from kernel-mode seems to cause a hang. Also, DebugService does not currently cause an exception like it should (instead it still calls the Kdp handler), because those changes would've made the patch even bigger and are still untested.
svn path=/trunk/; revision=18078
2005-09-26 04:59:48 +00:00
|
|
|
VOID
|
2008-11-29 20:47:48 +00:00
|
|
|
NTAPI
|
- More sharing between ntdll/ntoskrnl: shared Dbg code.
- Added NtCreateDebugObject, NtDebugContinue, NtQueryDebugFilterState, NtSetDebugFilterState, NtWaitForDebugEvent to system call list.
- Added some debug constants to headers
- Updated RtlpCheckForActiveDebugger in ntoskrnl to return whatever we're expecting as the "normal" case.
- Added RtlpSetInDbgPrint to rtl support library for special DbgPrint implementation difference in user-mode
- Removed all the deprecated debug APIs in ntdll.
- Implemented NtQueryDebugFilterState and NtSetDebugFilterState based on royce's implementation.
- Started modifications on KeDebugService, and implemented DebugService in rtl
- Implemented all the Dbg* APIs in RTL.
- Implemented DbgUiConnectToDbg, DbgUiContinue, DbgUiWaitStateChange, DbgUiRemoteBreakin, DbgUiIssueRemoteBreakin
- Changed KD Print callbacks to also receive the length of the string.
Right now, one call that should be shared still isn't (the final DebugPrint call) because calling KeDebugService from kernel-mode seems to cause a hang. Also, DebugService does not currently cause an exception like it should (instead it still calls the Kdp handler), because those changes would've made the patch even bigger and are still untested.
svn path=/trunk/; revision=18078
2005-09-26 04:59:48 +00:00
|
|
|
KdpScreenPrint(LPSTR Message,
|
|
|
|
ULONG Length)
|
|
|
|
{
|
|
|
|
/* Call HAL */
|
|
|
|
HalDisplayString(Message);
|
|
|
|
}
|
|
|
|
|
2005-04-25 14:44:48 +00:00
|
|
|
VOID
|
2008-11-29 20:47:48 +00:00
|
|
|
NTAPI
|
2005-04-25 14:44:48 +00:00
|
|
|
KdpScreenInit(PKD_DISPATCH_TABLE DispatchTable,
|
|
|
|
ULONG BootPhase)
|
|
|
|
{
|
|
|
|
if (!KdpDebugMode.Screen) return;
|
|
|
|
|
|
|
|
if (BootPhase == 0)
|
|
|
|
{
|
|
|
|
/* Write out the functions that we support for now */
|
|
|
|
DispatchTable->KdpInitRoutine = KdpScreenInit;
|
- More sharing between ntdll/ntoskrnl: shared Dbg code.
- Added NtCreateDebugObject, NtDebugContinue, NtQueryDebugFilterState, NtSetDebugFilterState, NtWaitForDebugEvent to system call list.
- Added some debug constants to headers
- Updated RtlpCheckForActiveDebugger in ntoskrnl to return whatever we're expecting as the "normal" case.
- Added RtlpSetInDbgPrint to rtl support library for special DbgPrint implementation difference in user-mode
- Removed all the deprecated debug APIs in ntdll.
- Implemented NtQueryDebugFilterState and NtSetDebugFilterState based on royce's implementation.
- Started modifications on KeDebugService, and implemented DebugService in rtl
- Implemented all the Dbg* APIs in RTL.
- Implemented DbgUiConnectToDbg, DbgUiContinue, DbgUiWaitStateChange, DbgUiRemoteBreakin, DbgUiIssueRemoteBreakin
- Changed KD Print callbacks to also receive the length of the string.
Right now, one call that should be shared still isn't (the final DebugPrint call) because calling KeDebugService from kernel-mode seems to cause a hang. Also, DebugService does not currently cause an exception like it should (instead it still calls the Kdp handler), because those changes would've made the patch even bigger and are still untested.
svn path=/trunk/; revision=18078
2005-09-26 04:59:48 +00:00
|
|
|
DispatchTable->KdpPrintRoutine = KdpScreenPrint;
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-04-25 14:44:48 +00:00
|
|
|
/* Register as a Provider */
|
|
|
|
InsertTailList(&KdProviders, &DispatchTable->KdProvidersList);
|
|
|
|
}
|
|
|
|
else if (BootPhase == 2)
|
|
|
|
{
|
|
|
|
HalDisplayString("\n Screen debugging enabled\n\n");
|
2005-05-09 01:38:29 +00:00
|
|
|
}
|
2005-04-25 14:44:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* GENERAL FUNCTIONS *********************************************************/
|
|
|
|
|
|
|
|
ULONG
|
2008-11-29 20:47:48 +00:00
|
|
|
NTAPI
|
- More sharing between ntdll/ntoskrnl: shared Dbg code.
- Added NtCreateDebugObject, NtDebugContinue, NtQueryDebugFilterState, NtSetDebugFilterState, NtWaitForDebugEvent to system call list.
- Added some debug constants to headers
- Updated RtlpCheckForActiveDebugger in ntoskrnl to return whatever we're expecting as the "normal" case.
- Added RtlpSetInDbgPrint to rtl support library for special DbgPrint implementation difference in user-mode
- Removed all the deprecated debug APIs in ntdll.
- Implemented NtQueryDebugFilterState and NtSetDebugFilterState based on royce's implementation.
- Started modifications on KeDebugService, and implemented DebugService in rtl
- Implemented all the Dbg* APIs in RTL.
- Implemented DbgUiConnectToDbg, DbgUiContinue, DbgUiWaitStateChange, DbgUiRemoteBreakin, DbgUiIssueRemoteBreakin
- Changed KD Print callbacks to also receive the length of the string.
Right now, one call that should be shared still isn't (the final DebugPrint call) because calling KeDebugService from kernel-mode seems to cause a hang. Also, DebugService does not currently cause an exception like it should (instead it still calls the Kdp handler), because those changes would've made the patch even bigger and are still untested.
svn path=/trunk/; revision=18078
2005-09-26 04:59:48 +00:00
|
|
|
KdpPrintString(LPSTR String,
|
|
|
|
ULONG Length)
|
2005-04-25 14:44:48 +00:00
|
|
|
{
|
|
|
|
PLIST_ENTRY CurrentEntry;
|
|
|
|
PKD_DISPATCH_TABLE CurrentTable;
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-11-21 18:38:09 +00:00
|
|
|
if (!KdpDebugMode.Value) return 0;
|
|
|
|
|
2005-04-25 14:44:48 +00:00
|
|
|
/* Call the registered handlers */
|
|
|
|
CurrentEntry = KdProviders.Flink;
|
|
|
|
while (CurrentEntry != &KdProviders)
|
|
|
|
{
|
|
|
|
/* Get the current table */
|
2005-05-09 01:38:29 +00:00
|
|
|
CurrentTable = CONTAINING_RECORD(CurrentEntry,
|
2005-04-25 14:44:48 +00:00
|
|
|
KD_DISPATCH_TABLE,
|
|
|
|
KdProvidersList);
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-04-25 14:44:48 +00:00
|
|
|
/* Call it */
|
- More sharing between ntdll/ntoskrnl: shared Dbg code.
- Added NtCreateDebugObject, NtDebugContinue, NtQueryDebugFilterState, NtSetDebugFilterState, NtWaitForDebugEvent to system call list.
- Added some debug constants to headers
- Updated RtlpCheckForActiveDebugger in ntoskrnl to return whatever we're expecting as the "normal" case.
- Added RtlpSetInDbgPrint to rtl support library for special DbgPrint implementation difference in user-mode
- Removed all the deprecated debug APIs in ntdll.
- Implemented NtQueryDebugFilterState and NtSetDebugFilterState based on royce's implementation.
- Started modifications on KeDebugService, and implemented DebugService in rtl
- Implemented all the Dbg* APIs in RTL.
- Implemented DbgUiConnectToDbg, DbgUiContinue, DbgUiWaitStateChange, DbgUiRemoteBreakin, DbgUiIssueRemoteBreakin
- Changed KD Print callbacks to also receive the length of the string.
Right now, one call that should be shared still isn't (the final DebugPrint call) because calling KeDebugService from kernel-mode seems to cause a hang. Also, DebugService does not currently cause an exception like it should (instead it still calls the Kdp handler), because those changes would've made the patch even bigger and are still untested.
svn path=/trunk/; revision=18078
2005-09-26 04:59:48 +00:00
|
|
|
CurrentTable->KdpPrintRoutine(String, Length);
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-04-25 14:44:48 +00:00
|
|
|
/* Next Table */
|
|
|
|
CurrentEntry = CurrentEntry->Flink;
|
|
|
|
}
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-04-25 14:44:48 +00:00
|
|
|
/* Call the Wrapper Routine */
|
2009-06-22 11:32:58 +00:00
|
|
|
if (WrapperTable.KdpPrintRoutine)
|
|
|
|
WrapperTable.KdpPrintRoutine(String, Length);
|
2005-04-25 14:44:48 +00:00
|
|
|
|
|
|
|
/* Return the Length */
|
- More sharing between ntdll/ntoskrnl: shared Dbg code.
- Added NtCreateDebugObject, NtDebugContinue, NtQueryDebugFilterState, NtSetDebugFilterState, NtWaitForDebugEvent to system call list.
- Added some debug constants to headers
- Updated RtlpCheckForActiveDebugger in ntoskrnl to return whatever we're expecting as the "normal" case.
- Added RtlpSetInDbgPrint to rtl support library for special DbgPrint implementation difference in user-mode
- Removed all the deprecated debug APIs in ntdll.
- Implemented NtQueryDebugFilterState and NtSetDebugFilterState based on royce's implementation.
- Started modifications on KeDebugService, and implemented DebugService in rtl
- Implemented all the Dbg* APIs in RTL.
- Implemented DbgUiConnectToDbg, DbgUiContinue, DbgUiWaitStateChange, DbgUiRemoteBreakin, DbgUiIssueRemoteBreakin
- Changed KD Print callbacks to also receive the length of the string.
Right now, one call that should be shared still isn't (the final DebugPrint call) because calling KeDebugService from kernel-mode seems to cause a hang. Also, DebugService does not currently cause an exception like it should (instead it still calls the Kdp handler), because those changes would've made the patch even bigger and are still untested.
svn path=/trunk/; revision=18078
2005-09-26 04:59:48 +00:00
|
|
|
return Length;
|
2005-04-25 14:44:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* EOF */
|