mirror of
https://github.com/reactos/reactos.git
synced 2024-09-28 21:44:31 +00:00
Added runtime configuration of debug prints from kernel debugger (on a per file basis)
svn path=/trunk/; revision=1889
This commit is contained in:
parent
6fb7445d87
commit
efc93e5ae8
|
@ -1,4 +1,4 @@
|
||||||
# $Id: Makefile,v 1.39 2001/05/01 23:08:17 chorns Exp $
|
# $Id: Makefile,v 1.40 2001/05/05 19:13:08 chorns Exp $
|
||||||
#
|
#
|
||||||
# ReactOS Operating System
|
# ReactOS Operating System
|
||||||
#
|
#
|
||||||
|
@ -31,7 +31,8 @@ STRIP_FLAGS := -Wl,-s
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(KDBG), 1)
|
ifeq ($(KDBG), 1)
|
||||||
OBJECTS_KDBG := dbg/kdb.o dbg/kdb_keyboard.o dbg/i386/kdb_help.o
|
OBJECTS_KDBG := dbg/kdb.o dbg/kdb_keyboard.o dbg/rdebug.o \
|
||||||
|
dbg/i386/kdb_help.o
|
||||||
CONFIG += KDBG
|
CONFIG += KDBG
|
||||||
else
|
else
|
||||||
OBJECTS_KDBG :=
|
OBJECTS_KDBG :=
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: kdb.c,v 1.4 2001/04/22 14:47:00 chorns Exp $
|
/* $Id: kdb.c,v 1.5 2001/05/05 19:13:08 chorns Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: ntoskrnl/dbg/kdb.c
|
* FILE: ntoskrnl/dbg/kdb.c
|
||||||
|
@ -58,6 +58,12 @@ ULONG
|
||||||
DbgProcessListCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf);
|
DbgProcessListCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf);
|
||||||
ULONG
|
ULONG
|
||||||
DbgProcessHelpCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf);
|
DbgProcessHelpCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf);
|
||||||
|
ULONG
|
||||||
|
DbgShowFilesCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf);
|
||||||
|
ULONG
|
||||||
|
DbgEnableFileCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf);
|
||||||
|
ULONG
|
||||||
|
DbgDisableFileCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf);
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
@ -73,6 +79,9 @@ struct
|
||||||
{"bugcheck", "bugcheck", "Bugcheck the system", DbgBugCheckCommand},
|
{"bugcheck", "bugcheck", "Bugcheck the system", DbgBugCheckCommand},
|
||||||
{"bt", "bt [*frame-address]|[thread-id]","Do a backtrace", DbgBackTraceCommand},
|
{"bt", "bt [*frame-address]|[thread-id]","Do a backtrace", DbgBackTraceCommand},
|
||||||
{"plist", "plist", "Display processes in the system", DbgProcessListCommand},
|
{"plist", "plist", "Display processes in the system", DbgProcessListCommand},
|
||||||
|
{"sfiles", "sfiles", "Show files that print debug prints", DbgShowFilesCommand},
|
||||||
|
{"efile", "efile <filename>", "Enable debug prints from file", DbgEnableFileCommand},
|
||||||
|
{"dfile", "dfile <filename>", "Disable debug prints from file", DbgDisableFileCommand},
|
||||||
{"help", "help", "Display help screen", DbgProcessHelpCommand},
|
{"help", "help", "Display help screen", DbgProcessHelpCommand},
|
||||||
{NULL, NULL, NULL}
|
{NULL, NULL, NULL}
|
||||||
};
|
};
|
||||||
|
@ -570,6 +579,39 @@ DbgBugCheckCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf)
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ULONG
|
||||||
|
DbgShowFilesCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf)
|
||||||
|
{
|
||||||
|
DbgShowFiles();
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
ULONG
|
||||||
|
DbgEnableFileCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf)
|
||||||
|
{
|
||||||
|
if (Argc == 2)
|
||||||
|
{
|
||||||
|
if (strlen(Argv[1]) > 0)
|
||||||
|
{
|
||||||
|
DbgEnableFile(Argv[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
ULONG
|
||||||
|
DbgDisableFileCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf)
|
||||||
|
{
|
||||||
|
if (Argc == 2)
|
||||||
|
{
|
||||||
|
if (strlen(Argv[1]) > 0)
|
||||||
|
{
|
||||||
|
DbgDisableFile(Argv[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
ULONG
|
ULONG
|
||||||
KdbDoCommand(PCH CommandLine, PKTRAP_FRAME Tf)
|
KdbDoCommand(PCH CommandLine, PKTRAP_FRAME Tf)
|
||||||
{
|
{
|
||||||
|
@ -614,7 +656,7 @@ KdbMainLoop(PKTRAP_FRAME Tf)
|
||||||
DbgPrint("\nEntered kernel debugger (type \"help\" for a list of commands)\n");
|
DbgPrint("\nEntered kernel debugger (type \"help\" for a list of commands)\n");
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
DbgPrint("kdb:> ");
|
DbgPrint("\nkdb:> ");
|
||||||
|
|
||||||
KdbGetCommand(Command);
|
KdbGetCommand(Command);
|
||||||
|
|
||||||
|
|
|
@ -2,3 +2,11 @@ ULONG
|
||||||
KdbTryGetCharKeyboard(VOID);
|
KdbTryGetCharKeyboard(VOID);
|
||||||
VOID
|
VOID
|
||||||
KdbEnter(VOID);
|
KdbEnter(VOID);
|
||||||
|
VOID
|
||||||
|
DbgRDebugInit(VOID);
|
||||||
|
VOID
|
||||||
|
DbgShowFiles(VOID);
|
||||||
|
VOID
|
||||||
|
DbgEnableFile(PCH Filename);
|
||||||
|
VOID
|
||||||
|
DbgDisableFile(PCH Filename);
|
||||||
|
|
154
reactos/ntoskrnl/dbg/rdebug.c
Normal file
154
reactos/ntoskrnl/dbg/rdebug.c
Normal file
|
@ -0,0 +1,154 @@
|
||||||
|
/*
|
||||||
|
* ReactOS kernel
|
||||||
|
* Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
/* $Id: rdebug.c,v 1.1 2001/05/05 19:13:09 chorns Exp $
|
||||||
|
*
|
||||||
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
|
* PROJECT: ReactOS kernel
|
||||||
|
* FILE: ntoskrnl/dbg/rdebug.c
|
||||||
|
* PURPOSE: Runtime debugging support
|
||||||
|
* PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
||||||
|
* UPDATE HISTORY:
|
||||||
|
* 01-05-2001 CSH Created
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* INCLUDES *****************************************************************/
|
||||||
|
|
||||||
|
#include <ddk/ntddk.h>
|
||||||
|
|
||||||
|
#define NDEBUG
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
/* GLOBALS ******************************************************************/
|
||||||
|
|
||||||
|
typedef struct _RDEBUG_ENTRY {
|
||||||
|
LIST_ENTRY ListEntry;
|
||||||
|
CHAR Filename[MAX_PATH];
|
||||||
|
} RDEBUG_ENTRY, *PRDEBUG_ENTRY;
|
||||||
|
|
||||||
|
LIST_ENTRY RDebugListHead;
|
||||||
|
BOOLEAN RDebugInitialized = FALSE;
|
||||||
|
|
||||||
|
/* FUNCTIONS ****************************************************************/
|
||||||
|
|
||||||
|
PRDEBUG_ENTRY
|
||||||
|
DbgpFind(PCH Filename)
|
||||||
|
{
|
||||||
|
PLIST_ENTRY Current;
|
||||||
|
PRDEBUG_ENTRY Entry;
|
||||||
|
|
||||||
|
Current = RDebugListHead.Flink;
|
||||||
|
while (Current != &RDebugListHead)
|
||||||
|
{
|
||||||
|
Entry = CONTAINING_RECORD(Current, RDEBUG_ENTRY, ListEntry);
|
||||||
|
|
||||||
|
if (strcmp(Filename, Entry->Filename) == 0)
|
||||||
|
{
|
||||||
|
return Entry;
|
||||||
|
}
|
||||||
|
Current = Current->Flink;
|
||||||
|
}
|
||||||
|
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
DbgRDebugInit(VOID)
|
||||||
|
{
|
||||||
|
if (RDebugInitialized)
|
||||||
|
return;
|
||||||
|
|
||||||
|
InitializeListHead(&RDebugListHead);
|
||||||
|
RDebugInitialized = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
DbgShowFiles(VOID)
|
||||||
|
{
|
||||||
|
PLIST_ENTRY Current;
|
||||||
|
PRDEBUG_ENTRY Entry;
|
||||||
|
ULONG Count;
|
||||||
|
|
||||||
|
if (!RDebugInitialized)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Count = 0;
|
||||||
|
Current = RDebugListHead.Flink;
|
||||||
|
while (Current != &RDebugListHead)
|
||||||
|
{
|
||||||
|
Entry = CONTAINING_RECORD(Current, RDEBUG_ENTRY, ListEntry);
|
||||||
|
|
||||||
|
DbgPrint(" %s\n", Entry->Filename);
|
||||||
|
Count++;
|
||||||
|
|
||||||
|
Current = Current->Flink;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Count == 1)
|
||||||
|
{
|
||||||
|
DbgPrint(" 1 file listed\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DbgPrint(" %d files listed\n", Count);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
DbgEnableFile(PCH Filename)
|
||||||
|
{
|
||||||
|
PRDEBUG_ENTRY Entry;
|
||||||
|
|
||||||
|
if (!RDebugInitialized)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!DbgpFind(Filename))
|
||||||
|
{
|
||||||
|
Entry = ExAllocatePool(NonPagedPool, sizeof(RDEBUG_ENTRY));
|
||||||
|
assert(Entry);
|
||||||
|
RtlMoveMemory(Entry->Filename, Filename, strlen(Filename) + 1);
|
||||||
|
InsertTailList(&RDebugListHead, &Entry->ListEntry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
DbgDisableFile(PCH Filename)
|
||||||
|
{
|
||||||
|
PRDEBUG_ENTRY Entry;
|
||||||
|
|
||||||
|
if (!RDebugInitialized)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Entry = DbgpFind(Filename);
|
||||||
|
|
||||||
|
if (Entry)
|
||||||
|
{
|
||||||
|
RemoveEntryList(&Entry->ListEntry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
DbgShouldPrint(PCH Filename)
|
||||||
|
{
|
||||||
|
if (!RDebugInitialized)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
return(DbgpFind(Filename) != NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* EOF */
|
|
@ -13,5 +13,7 @@ VOID
|
||||||
DbgkCreateThread(PVOID StartAddress);
|
DbgkCreateThread(PVOID StartAddress);
|
||||||
ULONG
|
ULONG
|
||||||
DbgkForwardException(EXCEPTION_RECORD Er, ULONG FirstChance);
|
DbgkForwardException(EXCEPTION_RECORD Er, ULONG FirstChance);
|
||||||
|
BOOLEAN
|
||||||
|
DbgShouldPrint(PCH Filename);
|
||||||
|
|
||||||
#endif /* __INCLUDE_INTERNAL_DBG_H */
|
#endif /* __INCLUDE_INTERNAL_DBG_H */
|
||||||
|
|
|
@ -20,13 +20,10 @@
|
||||||
|
|
||||||
#include <internal/ntoskrnl.h>
|
#include <internal/ntoskrnl.h>
|
||||||
#include <internal/config.h>
|
#include <internal/config.h>
|
||||||
|
#include <internal/dbg.h>
|
||||||
|
|
||||||
#define UNIMPLEMENTED do {DbgPrint("%s at %s:%d is unimplemented, have a nice day\n",__FUNCTION__,__FILE__,__LINE__); for(;;); } while(0);
|
#define UNIMPLEMENTED do {DbgPrint("%s at %s:%d is unimplemented, have a nice day\n",__FUNCTION__,__FILE__,__LINE__); for(;;); } while(0);
|
||||||
|
|
||||||
/* FIXME: should probably remove this later */
|
|
||||||
#if !defined(CHECKED) && !defined(NDEBUG)
|
|
||||||
#define CHECKED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
|
|
||||||
|
@ -50,29 +47,29 @@
|
||||||
#define DPRINT1(args...) do { DbgPrint("(%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0);
|
#define DPRINT1(args...) do { DbgPrint("(%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0);
|
||||||
#define CHECKPOINT1 do { DbgPrint("%s:%d\n",__FILE__,__LINE__); } while(0);
|
#define CHECKPOINT1 do { DbgPrint("%s:%d\n",__FILE__,__LINE__); } while(0);
|
||||||
|
|
||||||
extern unsigned int old_idt[256][2];
|
#if defined(KDBG) && defined(NDEBUG)
|
||||||
//extern unsigned int idt;
|
|
||||||
extern unsigned int old_idt_valid;
|
|
||||||
|
|
||||||
#ifdef __NTOSKRNL__
|
#define DPRINT(args...) do { \
|
||||||
//#define DPRINT_CHECKS ExAllocatePool(NonPagedPool,0); assert(old_idt_valid || (!memcmp(old_idt,KiIdt,256*2)));
|
if (DbgShouldPrint(__FILE__)) { \
|
||||||
//#define DPRINT_CHECKS ExAllocatePool(NonPagedPool,0);
|
DbgPrint("(%s:%d) ",__FILE__,__LINE__); \
|
||||||
#define DPRINT_CHECKS
|
DbgPrint(args); \
|
||||||
#else
|
} \
|
||||||
#define DPRINT_CHECKS
|
} while(0);
|
||||||
#endif
|
|
||||||
|
#define CHECKPOINT
|
||||||
|
|
||||||
|
#else /* KDBG && NDEBUG */
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
#define OLD_DPRINT(fmt,args...) do { DbgPrint("(%s:%d) ",__FILE__,__LINE__); DbgPrint(fmt,args); } while(0);
|
#define DPRINT(args...) do { DbgPrint("(%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0);
|
||||||
#define DPRINT(args...) do { DbgPrint("(%s:%d) ",__FILE__,__LINE__); DbgPrint(args); DPRINT_CHECKS } while(0);
|
|
||||||
#define CHECKPOINT do { DbgPrint("%s:%d\n",__FILE__,__LINE__); ExAllocatePool(NonPagedPool,0); } while(0);
|
#define CHECKPOINT do { DbgPrint("%s:%d\n",__FILE__,__LINE__); ExAllocatePool(NonPagedPool,0); } while(0);
|
||||||
#else
|
#else /* NDEBUG */
|
||||||
//#define DPRINT(args...) do { DPRINT_CHECKS } while (0);
|
|
||||||
#define DPRINT(args...)
|
#define DPRINT(args...)
|
||||||
#define OLD_DPRINT(args...)
|
|
||||||
#define CHECKPOINT
|
#define CHECKPOINT
|
||||||
#endif /* NDEBUG */
|
#endif /* NDEBUG */
|
||||||
|
|
||||||
|
#endif /* KDBG && NDEBUG */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Assert a maximum value for the current irql
|
* FUNCTION: Assert a maximum value for the current irql
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: device.c,v 1.27 2001/05/01 23:08:19 chorns Exp $
|
/* $Id: device.c,v 1.28 2001/05/05 19:13:09 chorns Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -434,20 +434,20 @@ IopInitializeDriver(PDRIVER_INITIALIZE DriverEntry,
|
||||||
ExFreePool(DriverObject);
|
ExFreePool(DriverObject);
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
else if (Fdo->DeviceType == FILE_DEVICE_ACPI)
|
||||||
|
{
|
||||||
#ifdef ACPI
|
#ifdef ACPI
|
||||||
static BOOLEAN SystemPowerDeviceNodeCreated = FALSE;
|
static BOOLEAN SystemPowerDeviceNodeCreated = FALSE;
|
||||||
|
|
||||||
/* The system power device node is the first bus enumerator
|
/* The system power device node is the first bus enumerator
|
||||||
device node created after the root device node */
|
device node created after the root device node */
|
||||||
if (!SystemPowerDeviceNodeCreated)
|
if (!SystemPowerDeviceNodeCreated)
|
||||||
{
|
{
|
||||||
PopSystemPowerDeviceNode = DeviceNode;
|
PopSystemPowerDeviceNode = DeviceNode;
|
||||||
SystemPowerDeviceNodeCreated = TRUE;
|
SystemPowerDeviceNodeCreated = TRUE;
|
||||||
}
|
|
||||||
#endif /* ACPI */
|
|
||||||
}
|
}
|
||||||
|
#endif /* ACPI */
|
||||||
}
|
}
|
||||||
ObDereferenceObject(Fdo);
|
ObDereferenceObject(Fdo);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: fs.c,v 1.16 2001/03/07 16:48:41 dwelch Exp $
|
/* $Id: fs.c,v 1.17 2001/05/05 19:13:09 chorns Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -57,11 +57,11 @@ NtFsControlFile (
|
||||||
PIO_STACK_LOCATION StackPtr;
|
PIO_STACK_LOCATION StackPtr;
|
||||||
KEVENT KEvent;
|
KEVENT KEvent;
|
||||||
|
|
||||||
DPRINT("NtFsControlFile(DeviceHandle %x Event %x UserApcRoutine %x "
|
DPRINT("NtFsControlFile(DeviceHandle %x EventHandle %x ApcRoutine %x "
|
||||||
"UserApcContext %x IoStatusBlock %x IoControlCode %x "
|
"ApcContext %x IoStatusBlock %x IoControlCode %x "
|
||||||
"InputBuffer %x InputBufferSize %x OutputBuffer %x "
|
"InputBuffer %x InputBufferSize %x OutputBuffer %x "
|
||||||
"OutputBufferSize %x)\n",
|
"OutputBufferSize %x)\n",
|
||||||
DeviceHandle,Event,UserApcRoutine,UserApcContext,IoStatusBlock,
|
DeviceHandle,EventHandle,ApcRoutine,ApcContext,IoStatusBlock,
|
||||||
IoControlCode,InputBuffer,InputBufferSize,OutputBuffer,
|
IoControlCode,InputBuffer,InputBufferSize,OutputBuffer,
|
||||||
OutputBufferSize);
|
OutputBufferSize);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: kdebug.c,v 1.25 2001/04/26 14:26:22 phreak Exp $
|
/* $Id: kdebug.c,v 1.26 2001/05/05 19:13:09 chorns Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -72,6 +72,12 @@ KdInitSystem (
|
||||||
ULONG Value;
|
ULONG Value;
|
||||||
PCHAR p1, p2;
|
PCHAR p1, p2;
|
||||||
|
|
||||||
|
#ifdef KDBG
|
||||||
|
/* Initialize runtime debugging if available */
|
||||||
|
DbgRDebugInit();
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/* set debug port default values */
|
/* set debug port default values */
|
||||||
PortInfo.ComPort = DEFAULT_DEBUG_PORT;
|
PortInfo.ComPort = DEFAULT_DEBUG_PORT;
|
||||||
PortInfo.BaudRate = DEFAULT_DEBUG_BAUD_RATE;
|
PortInfo.BaudRate = DEFAULT_DEBUG_BAUD_RATE;
|
||||||
|
|
|
@ -169,10 +169,10 @@ KeSetBaseGdtSelector(ULONG Entry,
|
||||||
((((ULONG)Base) & 0xff000000) >> 16);
|
((((ULONG)Base) & 0xff000000) >> 16);
|
||||||
|
|
||||||
DPRINT("%x %x %x %x\n",
|
DPRINT("%x %x %x %x\n",
|
||||||
KiGdt[Entry + 0],
|
Gdt[Entry + 0],
|
||||||
KiGdt[Entry + 1],
|
Gdt[Entry + 1],
|
||||||
KiGdt[Entry + 2],
|
Gdt[Entry + 2],
|
||||||
KiGdt[Entry + 3]);
|
Gdt[Entry + 3]);
|
||||||
|
|
||||||
KeReleaseSpinLock(&GdtLock, oldIrql);
|
KeReleaseSpinLock(&GdtLock, oldIrql);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: loader.c,v 1.78 2001/05/05 15:19:14 ekohl Exp $
|
/* $Id: loader.c,v 1.79 2001/05/05 19:13:09 chorns Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -668,7 +668,7 @@ VOID LdrLoadAutoConfigDrivers (VOID)
|
||||||
* Minix filesystem driver
|
* Minix filesystem driver
|
||||||
*/
|
*/
|
||||||
LdrLoadAutoConfigDriver(L"minixfs.sys");
|
LdrLoadAutoConfigDriver(L"minixfs.sys");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mailslot filesystem driver
|
* Mailslot filesystem driver
|
||||||
*/
|
*/
|
||||||
|
@ -677,8 +677,8 @@ VOID LdrLoadAutoConfigDrivers (VOID)
|
||||||
/*
|
/*
|
||||||
* Named pipe filesystem driver
|
* Named pipe filesystem driver
|
||||||
*/
|
*/
|
||||||
// LdrLoadAutoConfigDriver(L"npfs.sys");
|
LdrLoadAutoConfigDriver(L"npfs.sys");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Networking
|
* Networking
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: cont.c,v 1.11 2001/03/26 04:38:39 phreak Exp $
|
/* $Id: cont.c,v 1.12 2001/05/05 19:13:10 chorns Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -14,6 +14,7 @@
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
#include <internal/mm.h>
|
#include <internal/mm.h>
|
||||||
|
|
||||||
|
#define NDEBUG
|
||||||
#include <internal/debug.h>
|
#include <internal/debug.h>
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: kmap.c,v 1.9 2001/03/25 02:34:28 dwelch Exp $
|
/* $Id: kmap.c,v 1.10 2001/05/05 19:13:10 chorns Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -161,8 +161,7 @@ MiAllocNonPagedPoolRegion(ULONG nr_pages)
|
||||||
{
|
{
|
||||||
set_bit(j%32,&AllocMap[j/32]);
|
set_bit(j%32,&AllocMap[j/32]);
|
||||||
}
|
}
|
||||||
OLD_DPRINT("returning %x\n",(start*PAGESIZE)
|
DPRINT("returning %x\n",((start*PAGESIZE)+NonPagedPoolBase));
|
||||||
+kernel_pool_base);
|
|
||||||
return(((start*PAGESIZE)+NonPagedPoolBase));
|
return(((start*PAGESIZE)+NonPagedPoolBase));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -302,7 +302,7 @@ MmFreeMemoryArea(PMADDRESS_SPACE AddressSpace,
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
|
||||||
DPRINT("MmFreeMemoryArea(AddressSpace %x, BaseAddress %x, Length %x,"
|
DPRINT("MmFreeMemoryArea(AddressSpace %x, BaseAddress %x, Length %x,"
|
||||||
"FreePages %d)\n",AddressSpace,BaseAddress,Length,FreePages);
|
"FreePageContext %d)\n",AddressSpace,BaseAddress,Length,FreePageContext);
|
||||||
|
|
||||||
MemoryArea = MmOpenMemoryAreaByAddress(AddressSpace,
|
MemoryArea = MmOpenMemoryAreaByAddress(AddressSpace,
|
||||||
BaseAddress);
|
BaseAddress);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: npool.c,v 1.45 2001/05/03 17:24:00 chorns Exp $
|
/* $Id: npool.c,v 1.46 2001/05/05 19:13:10 chorns Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -688,8 +688,8 @@ static BLOCK_HDR* grow_kernel_pool(unsigned int size, ULONG Tag, PVOID Caller)
|
||||||
int i;
|
int i;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
OLD_DPRINT("growing heap for block size %d, ",size);
|
DPRINT("growing heap for block size %d, ",size);
|
||||||
OLD_DPRINT("start %x\n",start);
|
DPRINT("start %x\n",start);
|
||||||
|
|
||||||
for (i=0;i<nr_pages;i++)
|
for (i=0;i<nr_pages;i++)
|
||||||
{
|
{
|
||||||
|
@ -708,13 +708,13 @@ static BLOCK_HDR* grow_kernel_pool(unsigned int size, ULONG Tag, PVOID Caller)
|
||||||
if ((PAGESIZE-(total_size%PAGESIZE))>(2*sizeof(BLOCK_HDR)))
|
if ((PAGESIZE-(total_size%PAGESIZE))>(2*sizeof(BLOCK_HDR)))
|
||||||
{
|
{
|
||||||
used_blk = (struct _BLOCK_HDR *)start;
|
used_blk = (struct _BLOCK_HDR *)start;
|
||||||
OLD_DPRINT("Creating block at %x\n",start);
|
DPRINT("Creating block at %x\n",start);
|
||||||
used_blk->Magic = BLOCK_HDR_USED_MAGIC;
|
used_blk->Magic = BLOCK_HDR_USED_MAGIC;
|
||||||
used_blk->Size = size;
|
used_blk->Size = size;
|
||||||
add_to_used_list(used_blk);
|
add_to_used_list(used_blk);
|
||||||
|
|
||||||
free_blk = (BLOCK_HDR *)(start + sizeof(BLOCK_HDR) + size);
|
free_blk = (BLOCK_HDR *)(start + sizeof(BLOCK_HDR) + size);
|
||||||
OLD_DPRINT("Creating block at %x\n",free_blk);
|
DPRINT("Creating block at %x\n",free_blk);
|
||||||
free_blk->Magic = BLOCK_HDR_FREE_MAGIC;
|
free_blk->Magic = BLOCK_HDR_FREE_MAGIC;
|
||||||
free_blk->Size = (nr_pages * PAGESIZE) -((sizeof(BLOCK_HDR)*2) + size);
|
free_blk->Size = (nr_pages * PAGESIZE) -((sizeof(BLOCK_HDR)*2) + size);
|
||||||
add_to_free_list(free_blk);
|
add_to_free_list(free_blk);
|
||||||
|
@ -825,7 +825,7 @@ VOID STDCALL ExFreePool (PVOID block)
|
||||||
|
|
||||||
assert(block);
|
assert(block);
|
||||||
|
|
||||||
OLD_DPRINT("(%s:%d) freeing block %x\n",__FILE__,__LINE__,blk);
|
DPRINT("freeing block %x\n",blk);
|
||||||
|
|
||||||
POOL_TRACE("ExFreePool(block %x), size %d, caller %x\n",block,blk->size,
|
POOL_TRACE("ExFreePool(block %x), size %d, caller %x\n",block,blk->size,
|
||||||
((PULONG)&block)[-1]);
|
((PULONG)&block)[-1]);
|
||||||
|
@ -899,8 +899,8 @@ ExAllocateNonPagedPoolWithTag(ULONG Type, ULONG Size, ULONG Tag, PVOID Caller)
|
||||||
current_entry = FreeBlockListHead.Flink;
|
current_entry = FreeBlockListHead.Flink;
|
||||||
while (current_entry != &FreeBlockListHead)
|
while (current_entry != &FreeBlockListHead)
|
||||||
{
|
{
|
||||||
OLD_DPRINT("current %x size %x next %x\n",current,current->size,
|
DPRINT("current %x size %x tag_next %x\n",current,current->Size,
|
||||||
current->next);
|
current->tag_next);
|
||||||
current = CONTAINING_RECORD(current_entry, BLOCK_HDR, ListEntry);
|
current = CONTAINING_RECORD(current_entry, BLOCK_HDR, ListEntry);
|
||||||
if (current->Size >= Size &&
|
if (current->Size >= Size &&
|
||||||
(best == NULL || current->Size < best->Size))
|
(best == NULL || current->Size < best->Size))
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: virtual.c,v 1.46 2001/04/04 22:21:31 dwelch Exp $
|
/* $Id: virtual.c,v 1.47 2001/05/05 19:13:10 chorns Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top directory
|
* COPYRIGHT: See COPYING in the top directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -870,9 +870,9 @@ NtAllocateVirtualMemory(IN HANDLE ProcessHandle,
|
||||||
PVOID PBaseAddress;
|
PVOID PBaseAddress;
|
||||||
ULONG PRegionSize;
|
ULONG PRegionSize;
|
||||||
|
|
||||||
DPRINT("NtAllocateVirtualMemory(ProcessHandle %x, *BaseAddress %x, "
|
DPRINT("NtAllocateVirtualMemory(*UBaseAddress %x, "
|
||||||
"ZeroBits %d, *RegionSize %x, AllocationType %x, Protect %x)\n",
|
"ZeroBits %d, *URegionSize %x, AllocationType %x, Protect %x)\n",
|
||||||
ProcessHandle,*BaseAddress,ZeroBits,*RegionSize,AllocationType,
|
*UBaseAddress,ZeroBits,*URegionSize,AllocationType,
|
||||||
Protect);
|
Protect);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -976,7 +976,7 @@ NtAllocateVirtualMemory(IN HANDLE ProcessHandle,
|
||||||
InsertTailList(&MemoryArea->Data.VirtualMemoryData.SegmentListHead,
|
InsertTailList(&MemoryArea->Data.VirtualMemoryData.SegmentListHead,
|
||||||
&Segment->SegmentListEntry);
|
&Segment->SegmentListEntry);
|
||||||
|
|
||||||
DPRINT("*BaseAddress %x\n",*BaseAddress);
|
DPRINT("*UBaseAddress %x\n",*UBaseAddress);
|
||||||
if ((AllocationType & MEM_COMMIT) &&
|
if ((AllocationType & MEM_COMMIT) &&
|
||||||
((Protect & PAGE_READWRITE) ||
|
((Protect & PAGE_READWRITE) ||
|
||||||
(Protect & PAGE_EXECUTE_READWRITE)))
|
(Protect & PAGE_EXECUTE_READWRITE)))
|
||||||
|
@ -1070,9 +1070,9 @@ NtFreeVirtualMemory(IN HANDLE ProcessHandle,
|
||||||
PVOID BaseAddress;
|
PVOID BaseAddress;
|
||||||
ULONG RegionSize;
|
ULONG RegionSize;
|
||||||
|
|
||||||
DPRINT("NtFreeVirtualMemory(ProcessHandle %x, *BaseAddress %x, "
|
DPRINT("NtFreeVirtualMemory(ProcessHandle %x, *PBaseAddress %x, "
|
||||||
"*RegionSize %x, FreeType %x)\n",ProcessHandle,*BaseAddress,
|
"*PRegionSize %x, FreeType %x)\n",ProcessHandle,*PBaseAddress,
|
||||||
*RegionSize,FreeType);
|
*PRegionSize,FreeType);
|
||||||
|
|
||||||
BaseAddress = (PVOID)PAGE_ROUND_DOWN((*PBaseAddress));
|
BaseAddress = (PVOID)PAGE_ROUND_DOWN((*PBaseAddress));
|
||||||
RegionSize = PAGE_ROUND_UP((*PBaseAddress) + (*PRegionSize)) -
|
RegionSize = PAGE_ROUND_UP((*PBaseAddress) + (*PRegionSize)) -
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: handle.c,v 1.30 2001/03/20 16:09:44 dwelch Exp $
|
/* $Id: handle.c,v 1.31 2001/05/05 19:13:10 chorns Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -403,7 +403,7 @@ NTSTATUS ObCreateHandle(PEPROCESS Process,
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
* obj = Object body that the handle should refer to
|
* obj = Object body that the handle should refer to
|
||||||
* RETURNS: The created handle
|
* RETURNS: The created handle
|
||||||
* NOTE: THe handle is valid only in the context of the current process
|
* NOTE: The handle is valid only in the context of the current process
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
LIST_ENTRY* current;
|
LIST_ENTRY* current;
|
||||||
|
@ -412,19 +412,18 @@ NTSTATUS ObCreateHandle(PEPROCESS Process,
|
||||||
HANDLE_BLOCK* new_blk = NULL;
|
HANDLE_BLOCK* new_blk = NULL;
|
||||||
PHANDLE_TABLE HandleTable;
|
PHANDLE_TABLE HandleTable;
|
||||||
KIRQL oldlvl;
|
KIRQL oldlvl;
|
||||||
|
|
||||||
DPRINT("ObCreateHandle(Process %x, obj %x)\n",Process,ObjectBody);
|
DPRINT("ObCreateHandle(Process %x, obj %x)\n",Process,ObjectBody);
|
||||||
|
|
||||||
|
assert(Process);
|
||||||
|
|
||||||
if (ObjectBody != NULL)
|
if (ObjectBody != NULL)
|
||||||
{
|
{
|
||||||
BODY_TO_HEADER(ObjectBody)->HandleCount++;
|
BODY_TO_HEADER(ObjectBody)->HandleCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
HandleTable = &Process->HandleTable;
|
HandleTable = &Process->HandleTable;
|
||||||
|
|
||||||
KeAcquireSpinLock(&HandleTable->ListLock, &oldlvl);
|
KeAcquireSpinLock(&HandleTable->ListLock, &oldlvl);
|
||||||
current = HandleTable->ListHead.Flink;
|
current = HandleTable->ListHead.Flink;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Scan through the currently allocated handle blocks looking for a free
|
* Scan through the currently allocated handle blocks looking for a free
|
||||||
* slot
|
* slot
|
||||||
|
@ -452,14 +451,19 @@ NTSTATUS ObCreateHandle(PEPROCESS Process,
|
||||||
handle = handle + HANDLE_BLOCK_ENTRIES;
|
handle = handle + HANDLE_BLOCK_ENTRIES;
|
||||||
current = current->Flink;
|
current = current->Flink;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add a new handle block to the end of the list
|
* Add a new handle block to the end of the list
|
||||||
*/
|
*/
|
||||||
new_blk =
|
new_blk =
|
||||||
(HANDLE_BLOCK *)ExAllocatePoolWithTag(NonPagedPool,sizeof(HANDLE_BLOCK),
|
(HANDLE_BLOCK *)ExAllocatePoolWithTag(NonPagedPool,sizeof(HANDLE_BLOCK),
|
||||||
TAG_HANDLE_TABLE);
|
TAG_HANDLE_TABLE);
|
||||||
memset(new_blk,0,sizeof(HANDLE_BLOCK));
|
if (!new_blk)
|
||||||
|
{
|
||||||
|
*HandleReturn = (PHANDLE)NULL;
|
||||||
|
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||||
|
}
|
||||||
|
RtlZeroMemory(new_blk,sizeof(HANDLE_BLOCK));
|
||||||
InsertTailList(&(Process->HandleTable.ListHead),
|
InsertTailList(&(Process->HandleTable.ListHead),
|
||||||
&new_blk->entry);
|
&new_blk->entry);
|
||||||
KeReleaseSpinLock(&HandleTable->ListLock, oldlvl);
|
KeReleaseSpinLock(&HandleTable->ListLock, oldlvl);
|
||||||
|
|
Loading…
Reference in a new issue