Author: ion Date: Fri Feb 16 21:43:16 2007 New Revision: 25822
URL: http://svn.reactos.org/svn/reactos?rev=25822&view=rev Log: - Disable i8042prt debugger hack. - Remove HAL kd routines. - Do INT3 in DebugService calls since the KiDebugService increases EIP by one. - Stub NtQuery/SetDebugFilterState. - Remove all KDBG symbol/process/thread callouts. Remove GDB hacks. - Stub out KdInitSystem and KdPollBreakI. - Stub KdpEnterDebuggerException. - Disable DebugPrint. - Optimize KiDebugService by having it jump into the INT3 trap handler.
Modified: branches/alex-kd-branch/reactos/drivers/input/i8042prt/keyboard.c branches/alex-kd-branch/reactos/hal/hal/hal.c branches/alex-kd-branch/reactos/hal/halx86/generic/misc.c branches/alex-kd-branch/reactos/lib/rtl/i386/debug_asm.S branches/alex-kd-branch/reactos/ntoskrnl/ex/dbgctrl.c branches/alex-kd-branch/reactos/ntoskrnl/include/internal/kd.h branches/alex-kd-branch/reactos/ntoskrnl/io/iomgr/driver.c branches/alex-kd-branch/reactos/ntoskrnl/io/iomgr/iomgr.c branches/alex-kd-branch/reactos/ntoskrnl/io/pnpmgr/pnpreport.c branches/alex-kd-branch/reactos/ntoskrnl/ke/bug.c branches/alex-kd-branch/reactos/ntoskrnl/ke/i386/exp.c branches/alex-kd-branch/reactos/ntoskrnl/ke/i386/trap.s branches/alex-kd-branch/reactos/ntoskrnl/ldr/loader.c branches/alex-kd-branch/reactos/ntoskrnl/mm/ppool.c branches/alex-kd-branch/reactos/ntoskrnl/mm/rmap.c branches/alex-kd-branch/reactos/ntoskrnl/ntoskrnl.def branches/alex-kd-branch/reactos/ntoskrnl/ntoskrnl.rbuild branches/alex-kd-branch/reactos/ntoskrnl/ps/kill.c branches/alex-kd-branch/reactos/ntoskrnl/rtl/misc.c
Modified: branches/alex-kd-branch/reactos/drivers/input/i8042prt/keyboard.c URL: http://svn.reactos.org/svn/reactos/branches/alex-kd-branch/reactos/drivers/i... ============================================================================== --- branches/alex-kd-branch/reactos/drivers/input/i8042prt/keyboard.c (original) +++ branches/alex-kd-branch/reactos/drivers/input/i8042prt/keyboard.c Fri Feb 16 21:43:16 2007 @@ -771,6 +771,6 @@ /* We hope kernel would understand this. If * that's not the case, nothing would happen. */ - KdpServiceDispatcher(TAG('R', 'o', 's', ' '), (PVOID)Key, NULL); + //KdpServiceDispatcher(TAG('R', 'o', 's', ' '), (PVOID)Key, NULL); #endif /* __REACTOS__ */ }
Modified: branches/alex-kd-branch/reactos/hal/hal/hal.c URL: http://svn.reactos.org/svn/reactos/branches/alex-kd-branch/reactos/hal/hal/h... ============================================================================== --- branches/alex-kd-branch/reactos/hal/hal/hal.c (original) +++ branches/alex-kd-branch/reactos/hal/hal/hal.c Fri Feb 16 21:43:16 2007 @@ -727,132 +727,6 @@ }
-BOOLEAN -NTAPI -KdPortGetByte( - PUCHAR ByteRecieved) -{ - UNIMPLEMENTED; - - return TRUE; -} - - -BOOLEAN -NTAPI -KdPortGetByteEx( - PKD_PORT_INFORMATION PortInformation, - PUCHAR ByteRecieved) -{ - UNIMPLEMENTED; - - return TRUE; -} - - -BOOLEAN -NTAPI -KdPortInitialize( - PKD_PORT_INFORMATION PortInformation, - ULONG Unknown1, - ULONG Unknown2) -{ - UNIMPLEMENTED; - - return TRUE; -} - - -BOOLEAN -NTAPI -KdPortInitializeEx( - PKD_PORT_INFORMATION PortInformation, - ULONG Unknown1, - ULONG Unknown2) -{ - UNIMPLEMENTED; - - return TRUE; -} - - -BOOLEAN -NTAPI -KdPortPollByte( - PUCHAR ByteRecieved) -{ - UNIMPLEMENTED; - - return TRUE; -} - - -BOOLEAN -NTAPI -KdPortPollByteEx( - PKD_PORT_INFORMATION PortInformation, - PUCHAR ByteRecieved) -{ - UNIMPLEMENTED; - - return TRUE; -} - - -VOID -NTAPI -KdPortPutByte( - UCHAR ByteToSend) -{ - UNIMPLEMENTED; -} - - -VOID -NTAPI -KdPortPutByteEx( - PKD_PORT_INFORMATION PortInformation, - UCHAR ByteToSend) -{ - UNIMPLEMENTED; -} - - -VOID -NTAPI -KdPortRestore(VOID) -{ - UNIMPLEMENTED; -} - - -VOID -NTAPI -KdPortSave(VOID) -{ - UNIMPLEMENTED; -} - - -BOOLEAN -NTAPI -KdPortDisableInterrupts() -{ - UNIMPLEMENTED; - - return FALSE; -} - - -BOOLEAN -NTAPI -KdPortEnableInterrupts() -{ - UNIMPLEMENTED; - - return FALSE; -} - #undef KeAcquireSpinLock VOID NTAPI
Modified: branches/alex-kd-branch/reactos/hal/halx86/generic/misc.c URL: http://svn.reactos.org/svn/reactos/branches/alex-kd-branch/reactos/hal/halx8... ============================================================================== --- branches/alex-kd-branch/reactos/hal/halx86/generic/misc.c (original) +++ branches/alex-kd-branch/reactos/hal/halx86/generic/misc.c Fri Feb 16 21:43:16 2007 @@ -77,7 +77,7 @@
/* Halt the system */ HalDisplayString("\n*** The system has halted ***\n"); - KeEnterKernelDebugger(); + //KeEnterKernelDebugger(); }
/*
Modified: branches/alex-kd-branch/reactos/lib/rtl/i386/debug_asm.S URL: http://svn.reactos.org/svn/reactos/branches/alex-kd-branch/reactos/lib/rtl/i... ============================================================================== --- branches/alex-kd-branch/reactos/lib/rtl/i386/debug_asm.S (original) +++ branches/alex-kd-branch/reactos/lib/rtl/i386/debug_asm.S Fri Feb 16 21:43:16 2007 @@ -51,7 +51,7 @@ mov ecx, [ebp+8] mov edx, [ebp+12] int 0x2D - //int 3 + int 3
/* Restore stack */ pop ebp @@ -79,7 +79,7 @@ mov ebx, [ebp+20] mov edi, [ebp+24] int 0x2D - //int 3 + int 3
/* Restore registers */ pop ebx
Modified: branches/alex-kd-branch/reactos/ntoskrnl/ex/dbgctrl.c URL: http://svn.reactos.org/svn/reactos/branches/alex-kd-branch/reactos/ntoskrnl/... ============================================================================== --- branches/alex-kd-branch/reactos/ntoskrnl/ex/dbgctrl.c (original) +++ branches/alex-kd-branch/reactos/ntoskrnl/ex/dbgctrl.c Fri Feb 16 21:43:16 2007 @@ -13,6 +13,25 @@ #include <internal/debug.h>
/* FUNCTIONS *****************************************************************/ + +NTSYSCALLAPI +NTSTATUS +NTAPI +NtQueryDebugFilterState(ULONG ComponentId, + ULONG Level) +{ + return STATUS_SUCCESS; +} + +NTSYSCALLAPI +NTSTATUS +NTAPI +NtSetDebugFilterState(ULONG ComponentId, + ULONG Level, + BOOLEAN State) +{ + return STATUS_SUCCESS; +}
/*++ * @name NtSystemDebugControl @@ -71,7 +90,6 @@ break;
case SysDbgQueryVersion: - KDB_LOADUSERMODULE_HOOK((PLDR_DATA_TABLE_ENTRY) InputBuffer); break;
default:
Modified: branches/alex-kd-branch/reactos/ntoskrnl/include/internal/kd.h URL: http://svn.reactos.org/svn/reactos/branches/alex-kd-branch/reactos/ntoskrnl/... ============================================================================== --- branches/alex-kd-branch/reactos/ntoskrnl/include/internal/kd.h (original) +++ branches/alex-kd-branch/reactos/ntoskrnl/include/internal/kd.h Fri Feb 16 21:43:16 2007 @@ -1,245 +1,9 @@ -#ifndef __INCLUDE_INTERNAL_KERNEL_DEBUGGER_H -#define __INCLUDE_INTERNAL_KERNEL_DEBUGGER_H - // // Kernel Debugger Port Definition // -typedef struct _KD_PORT_INFORMATION -{ - ULONG ComPort; - ULONG BaudRate; - ULONG BaseAddress; -} KD_PORT_INFORMATION, *PKD_PORT_INFORMATION; - -struct _KD_DISPATCH_TABLE; -extern KD_PORT_INFORMATION GdbPortInfo; extern BOOLEAN _KdDebuggerEnabled; extern BOOLEAN _KdDebuggerNotPresent; extern BOOLEAN KdBreakAfterSymbolLoad; - -BOOLEAN -NTAPI -KdPortInitialize( - PKD_PORT_INFORMATION PortInformation, - ULONG Unknown1, - ULONG Unknown2 -); - -BOOLEAN -NTAPI -KdPortInitializeEx( - PKD_PORT_INFORMATION PortInformation, - ULONG Unknown1, - ULONG Unknown2 -); - -BOOLEAN -NTAPI -KdPortGetByte( - PUCHAR ByteRecieved); - -BOOLEAN -NTAPI -KdPortGetByteEx( - PKD_PORT_INFORMATION PortInformation, - PUCHAR ByteRecieved); - -VOID -NTAPI -KdPortPutByte( - UCHAR ByteToSend -); - -VOID -NTAPI -KdPortPutByteEx( - PKD_PORT_INFORMATION PortInformation, - UCHAR ByteToSend -); - -/* SYMBOL ROUTINES **********************************************************/ -#ifdef __NTOSKRNL__ - -#if defined(KDBG) || defined(DBG) - -VOID -KdbSymLoadUserModuleSymbols(IN PLDR_DATA_TABLE_ENTRY LdrModule); - -VOID -KdbSymFreeProcessSymbols(IN PEPROCESS Process); - -VOID -KdbSymLoadDriverSymbols( - IN PUNICODE_STRING Filename, - IN PLDR_DATA_TABLE_ENTRY Module -); - -VOID -KdbSymUnloadDriverSymbols(IN PLDR_DATA_TABLE_ENTRY ModuleObject); - -VOID -KdbSymProcessBootSymbols(IN PUNICODE_STRING FileName); - -VOID -KdbSymInit( - IN PLDR_DATA_TABLE_ENTRY NtoskrnlTextSection, - IN PLDR_DATA_TABLE_ENTRY LdrHalTextSection -); - -BOOLEAN -KdbSymPrintAddress(IN PVOID Address); - -VOID -KdbDeleteProcessHook(IN PEPROCESS Process); - -NTSTATUS -KdbSymGetAddressInformation( - IN PROSSYM_INFO RosSymInfo, - IN ULONG_PTR RelativeAddress, - OUT PULONG LineNumber OPTIONAL, - OUT PCH FileName OPTIONAL, - OUT PCH FunctionName OPTIONAL -); - -typedef struct _KDB_MODULE_INFO -{ - WCHAR Name[256]; - ULONG_PTR Base; - ULONG Size; - PROSSYM_INFO RosSymInfo; -} KDB_MODULE_INFO, *PKDB_MODULE_INFO; - -/* MACROS FOR NON-KDBG BUILDS ************************************************/ - -# define KDB_LOADUSERMODULE_HOOK(LDRMOD) KdbSymLoadUserModuleSymbols(LDRMOD) -# define KDB_LOADDRIVER_HOOK(FILENAME, MODULE) KdbSymLoadDriverSymbols(FILENAME, MODULE) -# define KDB_UNLOADDRIVER_HOOK(MODULE) KdbSymUnloadDriverSymbols(MODULE) -# define KDB_LOADERINIT_HOOK(NTOS, HAL) KdbSymInit(NTOS, HAL) -# define KDB_SYMBOLFILE_HOOK(FILENAME) KdbSymProcessBootSymbols(FILENAME) -#else -# define KDB_LOADUSERMODULE_HOOK(LDRMOD) do { } while (0) -# define KDB_LOADDRIVER_HOOK(FILENAME, MODULE) do { } while (0) -# define KDB_UNLOADDRIVER_HOOK(MODULE) do { } while (0) -# define KDB_LOADERINIT_HOOK(NTOS, HAL) do { } while (0) -# define KDB_SYMBOLFILE_HOOK(FILENAME) do { } while (0) -# define KDB_CREATE_THREAD_HOOK(CONTEXT) do { } while (0) -#endif - -#if defined(KDBG) || defined(DBG) -# define KeRosPrintAddress(ADDRESS) KdbSymPrintAddress(ADDRESS) -#else -# define KeRosPrintAddress(ADDRESS) KiRosPrintAddress(ADDRESS) -#endif - -#ifdef KDBG -# define KdbInit() KdbpCliInit() -# define KdbModuleLoaded(FILENAME) KdbpCliModuleLoaded(FILENAME) -# define KDB_DELETEPROCESS_HOOK(PROCESS) KdbDeleteProcessHook(PROCESS) -#else -# define KdbEnterDebuggerException(ER, PM, C, TF, F) kdHandleException -# define KdbInit() do { } while (0) -# define KdbEnter() do { } while (0) -# define KdbModuleLoaded(X) do { } while (0) -# define KDB_DELETEPROCESS_HOOK(PROCESS) do { } while (0) -#endif - -/* KD ROUTINES ***************************************************************/ - -typedef enum _KD_CONTINUE_TYPE -{ - kdContinue = 0, - kdDoNotHandleException, - kdHandleException -} KD_CONTINUE_TYPE; - -typedef -VOID -(STDCALL*PKDP_INIT_ROUTINE)( - struct _KD_DISPATCH_TABLE *DispatchTable, - ULONG BootPhase -); - -typedef -VOID -(STDCALL*PKDP_PRINT_ROUTINE)( - LPSTR String, - ULONG Length -); - -typedef -VOID -(STDCALL*PKDP_PROMPT_ROUTINE)(PCH String); - -typedef -KD_CONTINUE_TYPE -(STDCALL*PKDP_EXCEPTION_ROUTINE)( - PEXCEPTION_RECORD ExceptionRecord, - PCONTEXT Context, - PKTRAP_FRAME TrapFrame -); - -/* INIT ROUTINES *************************************************************/ - -VOID -STDCALL -KdpScreenInit( - struct _KD_DISPATCH_TABLE *DispatchTable, - ULONG BootPhase -); - -VOID -STDCALL -KdpSerialInit( - struct _KD_DISPATCH_TABLE *DispatchTable, - ULONG BootPhase -); - -VOID -STDCALL -KdpInitDebugLog( - struct _KD_DISPATCH_TABLE *DispatchTable, - ULONG BootPhase -); - -VOID -STDCALL -KdpBochsInit( - struct _KD_DISPATCH_TABLE *DispatchTable, - ULONG BootPhase -); - -VOID -STDCALL -KdpGdbStubInit( - struct _KD_DISPATCH_TABLE *DispatchTable, - ULONG BootPhase); - -/* KD ROUTINES ***************************************************************/ - -BOOLEAN -NTAPI -KdpCallGdb( - IN PKTRAP_FRAME TrapFrame, - IN PEXCEPTION_RECORD ExceptionRecord, - IN PCONTEXT Context -); - -ULONG -STDCALL -KdpPrintString( - LPSTR String, - ULONG Length); - -BOOLEAN -STDCALL -KdpDetectConflicts(PCM_RESOURCE_LIST DriverList); - -VOID -STDCALL -KdpBochsDebugPrint( - IN PCH Message, - IN ULONG Length -);
/* KD GLOBALS ***************************************************************/
@@ -254,99 +18,4 @@ IN BOOLEAN SecondChance );
-/* serial debug connection */ -#define DEFAULT_DEBUG_PORT 2 /* COM2 */ -#define DEFAULT_DEBUG_COM1_IRQ 4 /* COM1 IRQ */ -#define DEFAULT_DEBUG_COM2_IRQ 3 /* COM2 IRQ */ -#define DEFAULT_DEBUG_BAUD_RATE 115200 /* 115200 Baud */ - -/* KD Native Modes */ -#define KdScreen 0 -#define KdSerial 1 -#define KdFile 2 -#define KdBochs 3 -#define KdMax 4 - -/* KD Private Debug Modes */ -typedef struct _KDP_DEBUG_MODE -{ - union - { - struct - { - /* Native Modes */ - UCHAR Screen :1; - UCHAR Serial :1; - UCHAR File :1; - UCHAR Bochs :1; - - /* Currently Supported Wrappers */ - UCHAR Pice :1; - UCHAR Gdb :1; - }; - - /* Generic Value */ - ULONG Value; - }; -} KDP_DEBUG_MODE; - -/* KD Internal Debug Services */ -typedef enum _KDP_DEBUG_SERVICE -{ - DumpNonPagedPool = 0x1e, /* a */ - ManualBugCheck = 0x30, /* b */ - DumpNonPagedPoolStats = 0x2e, /* c */ - DumpNewNonPagedPool = 0x20, /* d */ - DumpNewNonPagedPoolStats = 0x12, /* e */ - DumpAllThreads = 0x21, /* f */ - DumpUserThreads = 0x22, /* g */ - KdSpare1 = 0x23, /* h */ - KdSpare2 = 0x17, /* i */ - KdSpare3 = 0x24, /* j */ - EnterDebugger = 0x25 /* k */ -} KDP_DEBUG_SERVICE; - -/* Dispatch Table for Wrapper Functions */ -typedef struct _KD_DISPATCH_TABLE -{ - LIST_ENTRY KdProvidersList; - PKDP_INIT_ROUTINE KdpInitRoutine; - PKDP_PRINT_ROUTINE KdpPrintRoutine; - PKDP_PROMPT_ROUTINE KdpPromptRoutine; - PKDP_EXCEPTION_ROUTINE KdpExceptionRoutine; -} KD_DISPATCH_TABLE, *PKD_DISPATCH_TABLE; - -/* The current Debugging Mode */ -extern KDP_DEBUG_MODE KdpDebugMode; - -/* The current Port IRQ */ -extern ULONG KdpPortIrq; - -/* The current Port */ -extern ULONG KdpPort; - -/* Port Information for the Serial Native Mode */ -extern KD_PORT_INFORMATION SerialPortInfo; - -/* Init Functions for Native Providers */ -extern PKDP_INIT_ROUTINE InitRoutines[KdMax]; - -/* Wrapper Init Function */ -extern PKDP_INIT_ROUTINE WrapperInitRoutine; - -/* Dispatch Tables for Native Providers */ -extern KD_DISPATCH_TABLE DispatchTable[KdMax]; - -/* Dispatch Table for the Wrapper */ -extern KD_DISPATCH_TABLE WrapperTable; - -/* The KD Native Provider List */ -extern LIST_ENTRY KdProviders; - -/* Whether to enter KDB as early as possible or not */ -extern BOOLEAN KdpEarlyBreak; - extern PKDEBUG_ROUTINE KiDebugRoutine; - -#endif -#endif /* __INCLUDE_INTERNAL_KERNEL_DEBUGGER_H */
Modified: branches/alex-kd-branch/reactos/ntoskrnl/io/iomgr/driver.c URL: http://svn.reactos.org/svn/reactos/branches/alex-kd-branch/reactos/ntoskrnl/... ============================================================================== --- branches/alex-kd-branch/reactos/ntoskrnl/io/iomgr/driver.c (original) +++ branches/alex-kd-branch/reactos/ntoskrnl/io/iomgr/driver.c Fri Feb 16 21:43:16 2007 @@ -494,8 +494,6 @@ Status = LdrProcessModule(LdrEntry->DllBase, &ServiceImagePath, ModuleObject); - - KDB_SYMBOLFILE_HOOK(&SearchName); break; }
@@ -805,7 +803,7 @@ return STATUS_SUCCESS; }
-static VOID INIT_FUNCTION +VOID INIT_FUNCTION MiFreeBootDriverMemory(PVOID StartAddress, ULONG Length) { ULONG i; @@ -890,9 +888,6 @@ return Status; }
- /* Load symbols */ - KDB_SYMBOLFILE_HOOK(ModuleName); - /* * Strip the file extension from ServiceName */ @@ -945,9 +940,6 @@ { PLIST_ENTRY ListHead, NextEntry; PLDR_DATA_TABLE_ENTRY LdrEntry; -#ifdef DBG - UNICODE_STRING NtosSymName = RTL_CONSTANT_STRING(L"ntoskrnl.sym"); -#endif PDEVICE_NODE DeviceNode; PDRIVER_OBJECT DriverObject; LDR_DATA_TABLE_ENTRY ModuleObject; @@ -992,9 +984,6 @@ IopFreeDeviceNode(DeviceNode); return; } - - /* Hack for NTOSKRNL.SYM */ - KDB_SYMBOLFILE_HOOK(&NtosSymName);
/* Loop the boot modules */ ListHead = &KeLoaderBlock->LoadOrderListHead;
Modified: branches/alex-kd-branch/reactos/ntoskrnl/io/iomgr/iomgr.c URL: http://svn.reactos.org/svn/reactos/branches/alex-kd-branch/reactos/ntoskrnl/... ============================================================================== --- branches/alex-kd-branch/reactos/ntoskrnl/io/iomgr/iomgr.c (original) +++ branches/alex-kd-branch/reactos/ntoskrnl/io/iomgr/iomgr.c Fri Feb 16 21:43:16 2007 @@ -517,12 +517,6 @@ /* Mark the system boot partition */ if (!IopMarkBootPartition(LoaderBlock)) return FALSE;
- /* Read KDB Data */ - KdbInit(); - - /* I/O is now setup for disk access, so phase 3 */ - KdInitSystem(3, LoaderBlock); - /* Load services for devices found by PnP manager */ IopInitializePnpServices(IopRootDeviceNode, FALSE);
Modified: branches/alex-kd-branch/reactos/ntoskrnl/io/pnpmgr/pnpreport.c URL: http://svn.reactos.org/svn/reactos/branches/alex-kd-branch/reactos/ntoskrnl/... ============================================================================== --- branches/alex-kd-branch/reactos/ntoskrnl/io/pnpmgr/pnpreport.c (original) +++ branches/alex-kd-branch/reactos/ntoskrnl/io/pnpmgr/pnpreport.c Fri Feb 16 21:43:16 2007 @@ -89,16 +89,6 @@
*ConflictDetected = FALSE;
- /* FIXME: Manually indicate conflicts with KD Ports */ - if (DriverList) - { - if (KdpDetectConflicts(DriverList)) - { - *ConflictDetected = TRUE; - return STATUS_CONFLICTING_ADDRESSES; - } - } - if (PopSystemPowerDeviceNode != NULL && DriverListSize > 0) { /* We hope legacy devices will be enumerated by ACPI */
Modified: branches/alex-kd-branch/reactos/ntoskrnl/ke/bug.c URL: http://svn.reactos.org/svn/reactos/branches/alex-kd-branch/reactos/ntoskrnl/... ============================================================================== --- branches/alex-kd-branch/reactos/ntoskrnl/ke/bug.c (original) +++ branches/alex-kd-branch/reactos/ntoskrnl/ke/bug.c Fri Feb 16 21:43:16 2007 @@ -99,7 +99,7 @@ }
/* Print it out */ - if (!KeRosPrintAddress((PVOID)Addr)) DbgPrint("<%X>", Addr); + if (!KiRosPrintAddress((PVOID)Addr)) DbgPrint("<%X>", Addr);
/* Go to the next frame */ DbgPrint("\n");
Modified: branches/alex-kd-branch/reactos/ntoskrnl/ke/i386/exp.c URL: http://svn.reactos.org/svn/reactos/branches/alex-kd-branch/reactos/ntoskrnl/... ============================================================================== --- branches/alex-kd-branch/reactos/ntoskrnl/ke/i386/exp.c (original) +++ branches/alex-kd-branch/reactos/ntoskrnl/ke/i386/exp.c Fri Feb 16 21:43:16 2007 @@ -15,6 +15,47 @@ #include <debug.h>
/* GLOBALS *******************************************************************/ + +BOOLEAN +NTAPI +KdpEnterDebuggerException(IN PKTRAP_FRAME TrapFrame, + IN PKEXCEPTION_FRAME ExceptionFrame, + IN PEXCEPTION_RECORD ExceptionRecord, + IN PCONTEXT Context, + IN KPROCESSOR_MODE PreviousMode, + IN BOOLEAN SecondChance) +{ + /* HACK (just like all this routine */ + if (ExceptionRecord->ExceptionCode == STATUS_BREAKPOINT) + { + Context->Eip++; + return TRUE; + } + + return FALSE; +} + +BOOLEAN +NTAPI +KdInitSystem(IN ULONG BootPhase, + IN PLOADER_PARAMETER_BLOCK LoaderBlock) +{ + /* STUB */ + return TRUE; +} + +BOOLEAN +NTAPI +KdPollBreakIn(VOID) +{ + /* STUB */ + return FALSE; +} + +BOOLEAN _KdDebuggerEnabled = FALSE; +BOOLEAN _KdDebuggerNotPresent = TRUE; +BOOLEAN KdBreakAfterSymbolLoad = FALSE; +PKDEBUG_ROUTINE KiDebugRoutine = KdpEnterDebuggerException;
/* DR Registers in the CONTEXT structure */ UCHAR KiDebugRegisterContextOffsets[9] = @@ -800,7 +841,7 @@ /* Set the context flags */ Context.ContextFlags = CONTEXT_FULL | CONTEXT_DEBUG_REGISTERS;
- /* Check if User Mode or if the debugger isenabled */ + /* Check if User Mode or if the debugger is enabled */ if ((PreviousMode == UserMode) || (KdDebuggerEnabled)) { /* Add the FPU Flag */ @@ -846,9 +887,6 @@ goto Handled; }
- /* HACK: GDB Entry */ - if (KdpCallGdb(TrapFrame, ExceptionRecord, &Context)) goto Handled; - /* If the Debugger couldn't handle it, dispatch the exception */ if (RtlDispatchException(ExceptionRecord, &Context)) goto Handled; } @@ -893,9 +931,6 @@ /* Exception was handled */ goto Handled; } - - /* HACK: GDB Entry */ - if (KdpCallGdb(TrapFrame, ExceptionRecord, &Context)) goto Handled;
/* Forward exception to user mode debugger */ if (DbgkForwardException(ExceptionRecord, TRUE, FALSE)) goto Exit; @@ -1046,3 +1081,5 @@ return (NTSTATUS)OldEip; }
+ +
Modified: branches/alex-kd-branch/reactos/ntoskrnl/ke/i386/trap.s URL: http://svn.reactos.org/svn/reactos/branches/alex-kd-branch/reactos/ntoskrnl/... ============================================================================== --- branches/alex-kd-branch/reactos/ntoskrnl/ke/i386/trap.s (original) +++ branches/alex-kd-branch/reactos/ntoskrnl/ke/i386/trap.s Fri Feb 16 21:43:16 2007 @@ -228,22 +228,6 @@ /* Copy the parameters */ rep movsd
-#ifdef DBG - /* - * The following lines are for the benefit of GDB. It will see the return - * address of the "call ebx" below, find the last label before it and - * thinks that that's the start of the function. It will then check to see - * if it starts with a standard function prolog (push ebp, mov ebp,esp1). - * When that standard function prolog is not found, it will stop the - * stack backtrace. Since we do want to backtrace into usermode, let's - * make GDB happy and create a standard prolog. - */ -KiSystemService: - push ebp - mov ebp,esp - pop ebp -#endif - /* Do the System Call */ call ebx
@@ -482,50 +466,15 @@ TRAP_PROLOG kids
/* Increase EIP so we skip the INT3 */ - //inc dword ptr [ebp+KTRAP_FRAME_EIP] + inc dword ptr [ebp+KTRAP_FRAME_EIP]
/* Call debug service dispatcher */ mov eax, [ebp+KTRAP_FRAME_EAX] mov ecx, [ebp+KTRAP_FRAME_ECX] mov edx, [ebp+KTRAP_FRAME_EAX]
- /* Check for V86 mode */ - test dword ptr [ebp+KTRAP_FRAME_EFLAGS], EFLAGS_V86_MASK - jnz NotUserMode - - /* Check if this is kernel or user-mode */ - test byte ptr [ebp+KTRAP_FRAME_CS], 1 - jz CallDispatch - cmp word ptr [ebp+KTRAP_FRAME_CS], KGDT_R3_CODE + RPL_MASK - jnz NotUserMode - - /* Re-enable interrupts */ -VdmProc: - sti - - /* Call the debug routine */ -CallDispatch: - mov esi, ecx - mov edi, edx - mov edx, eax - mov ecx, 3 - push edi - push esi - push edx - call _KdpServiceDispatcher@12 - -NotUserMode: - - /* Get the current process */ - mov ebx, [fs:KPCR_CURRENT_THREAD] - mov ebx, [ebx+KTHREAD_APCSTATE_PROCESS] - - /* Check if this is a VDM Process */ - //cmp dword ptr [ebx+EPROCESS_VDM_OBJECTS], 0 - //jz VdmProc - - /* Exit through common routine */ - jmp _Kei386EoiHelper@0 + /* Jump to INT3 handler */ + jmp PrepareInt3 .endfunc
.func NtRaiseException@12 @@ -819,7 +768,11 @@ /* Enter trap */ TRAP_PROLOG kit3
+ /* Set status code */ + mov eax, 0 //STATUS_SUCCESS + /* Check for V86 */ +PrepareInt3: test dword ptr [ebp+KTRAP_FRAME_EFLAGS], EFLAGS_V86_MASK jnz V86Int3
Modified: branches/alex-kd-branch/reactos/ntoskrnl/ldr/loader.c URL: http://svn.reactos.org/svn/reactos/branches/alex-kd-branch/reactos/ntoskrnl/... ============================================================================== --- branches/alex-kd-branch/reactos/ntoskrnl/ldr/loader.c (original) +++ branches/alex-kd-branch/reactos/ntoskrnl/ldr/loader.c Fri Feb 16 21:43:16 2007 @@ -135,9 +135,6 @@
/* Insert it into the list */ InsertTailList(&ModuleListHead, &HalModuleObject->InLoadOrderLinks); - - /* Hook for KDB on initialization of the loader. */ - KDB_LOADERINIT_HOOK(NtoskrnlModuleObject, HalModuleObject); }
NTSTATUS @@ -320,9 +317,6 @@
*ModuleObject = Module;
- /* Hook for KDB on loading a driver. */ - KDB_LOADDRIVER_HOOK(Filename, Module); - return(STATUS_SUCCESS); }
@@ -337,9 +331,6 @@ KeAcquireSpinLock(&ModuleListLock,&Irql); RemoveEntryList(&ModuleObject->InLoadOrderLinks); KeReleaseSpinLock(&ModuleListLock, Irql); - - /* Hook for KDB on unloading a driver. */ - KDB_UNLOADDRIVER_HOOK(ModuleObject);
/* Free module section */ // MmFreeSection(ModuleObject->DllBase);
Modified: branches/alex-kd-branch/reactos/ntoskrnl/mm/ppool.c URL: http://svn.reactos.org/svn/reactos/branches/alex-kd-branch/reactos/ntoskrnl/... ============================================================================== --- branches/alex-kd-branch/reactos/ntoskrnl/mm/ppool.c (original) +++ branches/alex-kd-branch/reactos/ntoskrnl/mm/ppool.c Fri Feb 16 21:43:16 2007 @@ -27,7 +27,7 @@ #define R_MUTEX FAST_MUTEX #define R_ACQUIRE_MUTEX(pool) /*DPRINT1("Acquiring PPool Mutex\n");*/ ExAcquireFastMutex(&pool->Mutex) #define R_RELEASE_MUTEX(pool) /*DPRINT1("Releasing PPool Mutex\n");*/ ExReleaseFastMutex(&pool->Mutex) -#define R_PRINT_ADDRESS(addr) KeRosPrintAddress(addr) +#define R_PRINT_ADDRESS(addr) KiRosPrintAddress(addr) #define R_PANIC() KeBugCheck(0) #define R_DEBUG DbgPrint #define R_GET_STACK_FRAMES(ptr,cnt) RtlWalkFrameChain((PVOID*)ptr,cnt, 0)
Modified: branches/alex-kd-branch/reactos/ntoskrnl/mm/rmap.c URL: http://svn.reactos.org/svn/reactos/branches/alex-kd-branch/reactos/ntoskrnl/... ============================================================================== --- branches/alex-kd-branch/reactos/ntoskrnl/mm/rmap.c (original) +++ branches/alex-kd-branch/reactos/ntoskrnl/mm/rmap.c Fri Feb 16 21:43:16 2007 @@ -428,9 +428,9 @@ { DbgPrint("MmInsertRmap tries to add a second rmap entry for address %p\n current caller ", current_entry->Address); - KeRosPrintAddress(new_entry->Caller); + DbgPrint(new_entry->Caller); DbgPrint("\n previous caller "); - KeRosPrintAddress(current_entry->Caller); + DbgPrint(current_entry->Caller); DbgPrint("\n"); KeBugCheck(0); }
Modified: branches/alex-kd-branch/reactos/ntoskrnl/ntoskrnl.def URL: http://svn.reactos.org/svn/reactos/branches/alex-kd-branch/reactos/ntoskrnl/... ============================================================================== --- branches/alex-kd-branch/reactos/ntoskrnl/ntoskrnl.def (original) +++ branches/alex-kd-branch/reactos/ntoskrnl/ntoskrnl.def Fri Feb 16 21:43:16 2007 @@ -518,16 +518,7 @@ @IofCallDriver@8 @IofCompleteRequest@8 IoIsWdmVersionAvailable@8 -KdChangeOption@24 KdComPortInUse DATA -KdDebuggerEnabled=_KdDebuggerEnabled -KdDebuggerNotPresent=_KdDebuggerNotPresent -KdDisableDebugger@0 -KdEnableDebugger@0 -KdEnteredDebugger -KdPollBreakIn@0 -KdPowerTransition@4 -KdpServiceDispatcher@12 Ke386CallBios@8 @KeAcquireGuardedMutex@4 @KeAcquireGuardedMutexUnsafe@4 @@ -552,7 +543,7 @@ KeDisconnectInterrupt@4 KeEnterCriticalRegion@0=_KeEnterCriticalRegion@0 KeEnterGuardedRegion@0=_KeEnterGuardedRegion@0 -KeEnterKernelDebugger@0 +;KeEnterKernelDebugger@0 KeFindConfigurationEntry@16 KeFindConfigurationNextEntry@20 KeFlushEntireTb@8 @@ -675,7 +666,7 @@ KiCheckForKernelApcDelivery@0 KiDeliverApc@12 KiDispatchInterrupt@0 -KiEnableTimerWatchdog +;KiEnableTimerWatchdog KiIpiServiceRoutine@8 @KiReleaseSpinLock@4 KiUnexpectedInterrupt
Modified: branches/alex-kd-branch/reactos/ntoskrnl/ntoskrnl.rbuild URL: http://svn.reactos.org/svn/reactos/branches/alex-kd-branch/reactos/ntoskrnl/... ============================================================================== --- branches/alex-kd-branch/reactos/ntoskrnl/ntoskrnl.rbuild (original) +++ branches/alex-kd-branch/reactos/ntoskrnl/ntoskrnl.rbuild Fri Feb 16 21:43:16 2007 @@ -89,31 +89,6 @@ <file>newcm.c</file> <file>cmdata.c</file> </directory> - <directory name="kdbg"> - <if property="ARCH" value="i386"> - <directory name="i386"> - <if property="KDBG" value="1"> - <group> - <file>i386-dis.c</file> - <file>kdb_help.S</file> - <file>longjmp.S</file> - <file>setjmp.S</file> - </group> - </if> - </directory> - </if> - <if property="KDBG" value="1"> - <file>kdb.c</file> - <file>kdb_cli.c</file> - <file>kdb_expr.c</file> - <file>kdb_keyboard.c</file> - <file>kdb_serial.c</file> - <file>kdb_string.c</file> - </if> - <if property="DBG_OR_KDBG" value="true"> - <file>kdb_symbols.c</file> - </if> - </directory> <directory name="dbgk"> <file>dbgkutil.c</file> <file>debug.c</file> @@ -217,15 +192,6 @@ <file>pnpreport.c</file> <file>pnproot.c</file> </directory> - </directory> - <directory name="kd"> - <directory name="wrappers"> - <file>bochs.c</file> - <file>gdbstub.c</file> - </directory> - <file>kdinit.c</file> - <file>kdio.c</file> - <file>kdmain.c</file> </directory> <directory name="ldr"> <file>loader.c</file>
Modified: branches/alex-kd-branch/reactos/ntoskrnl/ps/kill.c URL: http://svn.reactos.org/svn/reactos/branches/alex-kd-branch/reactos/ntoskrnl/... ============================================================================== --- branches/alex-kd-branch/reactos/ntoskrnl/ps/kill.c (original) +++ branches/alex-kd-branch/reactos/ntoskrnl/ps/kill.c Fri Feb 16 21:43:16 2007 @@ -286,9 +286,6 @@ /* Detach */ KeUnstackDetachProcess(&ApcState); } - - /* KDB hook */ - KDB_DELETEPROCESS_HOOK(Process);
/* Check if we have an address space, and clean it */ if (Process->HasAddressSpace)
Modified: branches/alex-kd-branch/reactos/ntoskrnl/rtl/misc.c URL: http://svn.reactos.org/svn/reactos/branches/alex-kd-branch/reactos/ntoskrnl/... ============================================================================== --- branches/alex-kd-branch/reactos/ntoskrnl/rtl/misc.c (original) +++ branches/alex-kd-branch/reactos/ntoskrnl/rtl/misc.c Fri Feb 16 21:43:16 2007 @@ -30,7 +30,8 @@ IN ULONG Level) { /* Temporary hack */ - KdpPrintString(DebugString->Buffer, DebugString->Length); + //KdpPrintString(DebugString->Buffer, DebugString->Length); + //HalDisplayString((PCHAR)DebugString->Buffer); return STATUS_SUCCESS; }
@@ -85,3 +86,5 @@ return STATUS_INVALID_PARAMETER; }
+ +