Enabled support for /DEBUGPORT=FILE

This fixes bug #28
 - Thanks for the help Filip

svn path=/trunk/; revision=7405
This commit is contained in:
Steven Edwards 2004-01-02 17:46:17 +00:00
parent 89af47536b
commit dfa3449f1b
3 changed files with 57 additions and 73 deletions

View file

@ -1,3 +1,8 @@
2003-01-02 Steven Edwards <Steven_Ed4153@yahoo.com>
* ntoskrnl/kd/dlog.c: Make /DEBUGPORT=FILE work. With the help
of Filip Navara
* ntoskrnl/ke/main.c: Ditto
2003-12-29 Steven Edwards <Steven_Ed4153@yahoo.com>
* lib/version: Sync with Winehq 12-29-03

View file

@ -1,4 +1,4 @@
/* $Id: dlog.c,v 1.9 2003/11/17 02:12:51 hyperion Exp $
/* $Id: dlog.c,v 1.10 2004/01/02 17:43:50 sedwards Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -22,8 +22,6 @@
#define DEBUGLOG_SIZE (32*1024)
#ifdef DBGPRINT_FILE_LOG
static CHAR DebugLog[DEBUGLOG_SIZE];
static ULONG DebugLogStart;
static ULONG DebugLogEnd;
@ -35,12 +33,8 @@ static CLIENT_ID DebugLogThreadCid;
static HANDLE DebugLogFile;
static KSEMAPHORE DebugLogSem;
#endif /* DBGPRINT_FILE_LOG */
/* FUNCTIONS *****************************************************************/
#ifdef DBGPRINT_FILE_LOG
VOID INIT_FUNCTION
DebugLogInit(VOID)
{
@ -52,7 +46,7 @@ DebugLogInit(VOID)
KeInitializeSemaphore(&DebugLogSem, 0, 255);
}
NTSTATUS
VOID STDCALL_FUNC
DebugLogThreadMain(PVOID Context)
{
KIRQL oldIrql;
@ -74,6 +68,7 @@ DebugLogThreadMain(PVOID Context)
{
WLen = min(256, DEBUGLOG_SIZE - DebugLogStart);
memcpy(Buffer, &DebugLog[DebugLogStart], WLen);
Buffer[WLen + 1] = '\n';
DebugLogStart =
(DebugLogStart + WLen) % DEBUGLOG_SIZE;
DebugLogCount = DebugLogCount - WLen;
@ -84,13 +79,13 @@ DebugLogThreadMain(PVOID Context)
NULL,
&Iosb,
Buffer,
WLen,
WLen + 1,
NULL,
NULL);
}
else
{
WLen = min(256, DebugLogEnd - DebugLogStart);
WLen = min(255, DebugLogEnd - DebugLogStart);
memcpy(Buffer, &DebugLog[DebugLogStart], WLen);
DebugLogStart =
(DebugLogStart + WLen) % DEBUGLOG_SIZE;
@ -120,7 +115,7 @@ DebugLogInit2(VOID)
UNICODE_STRING FileName;
IO_STATUS_BLOCK Iosb;
RtlRosInitUnicodeStringFromLiteral(&FileName, L"\\SystemRoot\\debug.log");
RtlInitUnicodeString(&FileName, L"\\SystemRoot\\debug.log");
InitializeObjectAttributes(&ObjectAttributes,
&FileName,
0,
@ -153,71 +148,54 @@ DebugLogInit2(VOID)
NULL);
}
VOID
DebugLogWrite(PCH String)
{
KIRQL oldIrql;
VOID
DebugLogWrite(PCH String)
{
KIRQL oldIrql;
if (KeGetCurrentIrql() > DISPATCH_LEVEL)
{
DebugLogOverflow++;
return;
}
{
DebugLogOverflow++;
return;
}
KeAcquireSpinLock(&DebugLogLock, &oldIrql);
if (DebugLogCount == DEBUGLOG_SIZE)
{
DebugLogOverflow++;
KeReleaseSpinLock(&DebugLogLock, oldIrql);
if (oldIrql < DISPATCH_LEVEL)
{
KeReleaseSemaphore(&DebugLogSem, IO_NO_INCREMENT, 1, FALSE);
}
return;
}
{
DebugLogOverflow++;
KeReleaseSpinLock(&DebugLogLock, oldIrql);
if (oldIrql < DISPATCH_LEVEL)
{
KeReleaseSemaphore(&DebugLogSem, IO_NO_INCREMENT, 1, FALSE);
}
return;
}
while ((*String) != 0)
{
DebugLog[DebugLogEnd] = *String;
String++;
DebugLogCount++;
if (DebugLogCount == DEBUGLOG_SIZE)
{
DebugLogOverflow++;
KeReleaseSpinLock(&DebugLogLock, oldIrql);
if (oldIrql < DISPATCH_LEVEL)
{
KeReleaseSemaphore(&DebugLogSem, IO_NO_INCREMENT, 1, FALSE);
}
return;
}
DebugLogEnd = (DebugLogEnd + 1) % DEBUGLOG_SIZE;
}
{
DebugLog[DebugLogEnd] = *String;
String++;
DebugLogCount++;
KeReleaseSpinLock(&DebugLogLock, oldIrql);
if (oldIrql < DISPATCH_LEVEL)
{
KeReleaseSemaphore(&DebugLogSem, IO_NO_INCREMENT, 1, FALSE);
}
}
if (DebugLogCount == DEBUGLOG_SIZE)
{
DebugLogOverflow++;
KeReleaseSpinLock(&DebugLogLock, oldIrql);
if (oldIrql < DISPATCH_LEVEL)
{
KeReleaseSemaphore(&DebugLogSem, IO_NO_INCREMENT, 1, FALSE);
}
return;
}
DebugLogEnd = (DebugLogEnd + 1) % DEBUGLOG_SIZE;
}
#else /* not DBGPRINT_FILE_LOG */
KeReleaseSpinLock(&DebugLogLock, oldIrql);
VOID INIT_FUNCTION
DebugLogInit(VOID)
{
}
VOID INIT_FUNCTION
DebugLogInit2(VOID)
{
if (oldIrql < DISPATCH_LEVEL)
{
KeReleaseSemaphore(&DebugLogSem, IO_NO_INCREMENT, 1, FALSE);
}
}
VOID
DebugLogWrite(PCH String)
{
}
#endif /* DBGPRINT_FILE_LOG */

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: main.c,v 1.180 2003/12/30 18:52:04 fireball Exp $
/* $Id: main.c,v 1.181 2004/01/02 17:43:51 sedwards Exp $
*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ke/main.c
@ -656,16 +656,17 @@ ExpInitializeExecutive(VOID)
if (!NT_SUCCESS(Status))
KEBUGCHECK(INACCESSIBLE_BOOT_DEVICE);
#ifdef DBGPRINT_FILE_LOG
/* On the assumption that we can now access disks start up the debug
logger thread */
DebugLogInit2();
#endif /* DBGPRINT_FILE_LOG */
#ifdef KDBG
KdbInitProfiling2();
#endif /* KDBG */
/* On the assumption that we can now access disks start up the debug
* logger thread */
if ((KdDebuggerEnabled == TRUE) && (KdDebugState & KD_DEBUG_FILELOG))
{
DebugLogInit2();
}
PiInitDefaultLocale();
/*