Author: ion
Date: Mon Feb 19 18:02:39 2007
New Revision: 25843
URL:
http://svn.reactos.org/svn/reactos?rev=25843&view=rev
Log:
- We now tell WinDBG to load kernel symbols and WinDBG replies (!) with DbgKdGetVersionApi
to find out who we are (he's in for a surprise ;)):
- Implement KdpSetCommonState (except code to clear breakpoints).
- Implement KdpSetContextState (for x86).
- Implement KdpReportLoadSymbolsStateChange.
- Implement skeleton of KdpSendWaitContinue, the main KD API Loop.
- Add KCONTINUE_STATUS.
- Redefine KdReceivePacket's return value to KDSTATUS and define possibile values.
- Add DBGKD_ANY_CONTROL_SET and X86/IA64/AMD64 control sets.
- Add DBGKD_MANIPULATE_STATE64 and all sub-structures (READ_MEMORY, WRITE_MEMORY, etc).
- Fix definition of KdpSymbol.
Modified:
branches/alex-kd-branch/reactos/include/ndk/ketypes.h
branches/alex-kd-branch/reactos/include/reactos/kddll.h
branches/alex-kd-branch/reactos/include/reactos/windbgkd.h
branches/alex-kd-branch/reactos/ntoskrnl/include/internal/kd.h
branches/alex-kd-branch/reactos/ntoskrnl/kd64/kdapi.c
branches/alex-kd-branch/reactos/ntoskrnl/kd64/kddata.c
branches/alex-kd-branch/reactos/ntoskrnl/kd64/kdprint.c
branches/alex-kd-branch/reactos/ntoskrnl/kd64/kdtrap.c
Modified: branches/alex-kd-branch/reactos/include/ndk/ketypes.h
URL:
http://svn.reactos.org/svn/reactos/branches/alex-kd-branch/reactos/include/…
==============================================================================
--- branches/alex-kd-branch/reactos/include/ndk/ketypes.h (original)
+++ branches/alex-kd-branch/reactos/include/ndk/ketypes.h Mon Feb 19 18:02:39 2007
@@ -298,6 +298,17 @@
} ADJUST_REASON;
//
+// Continue Status
+//
+typedef enum _KCONTINUE_STATUS
+{
+ ContinueError = 0,
+ ContinueSuccess,
+ ContinueProcessorReselected,
+ ContinueNextProcessor
+} KCONTINUE_STATUS;
+
+//
// Process States
//
typedef enum _KPROCESS_STATE
Modified: branches/alex-kd-branch/reactos/include/reactos/kddll.h
URL:
http://svn.reactos.org/svn/reactos/branches/alex-kd-branch/reactos/include/…
==============================================================================
--- branches/alex-kd-branch/reactos/include/reactos/kddll.h (original)
+++ branches/alex-kd-branch/reactos/include/reactos/kddll.h Mon Feb 19 18:02:39 2007
@@ -1,5 +1,12 @@
#ifndef _KDDLL_
#define _KDDLL_
+
+typedef enum _KDSTATUS
+{
+ KdPacketReceived = 0,
+ KdPacketTimedOut,
+ KdPacketNeedsResend
+} KDSTATUS;
NTSTATUS
NTAPI
@@ -13,7 +20,7 @@
IN PLOADER_PARAMETER_BLOCK LoaderBlock
);
-ULONG
+KDSTATUS
NTAPI
KdReceivePacket(
IN ULONG PacketType,
Modified: branches/alex-kd-branch/reactos/include/reactos/windbgkd.h
URL:
http://svn.reactos.org/svn/reactos/branches/alex-kd-branch/reactos/include/…
==============================================================================
--- branches/alex-kd-branch/reactos/include/reactos/windbgkd.h (original)
+++ branches/alex-kd-branch/reactos/include/reactos/windbgkd.h Mon Feb 19 18:02:39 2007
@@ -1,5 +1,10 @@
#ifndef _WINDBGKD_
#define _WINDBGKG_
+
+//
+// Dependencies
+//
+#include "wdbgexts.h"
//
// Packet Size and Control Stream Size
@@ -136,6 +141,46 @@
} KD_CONTEXT, *PKD_CONTEXT;
//
+// Control Sets for Supported Architectures
+//
+#include <pshpack4.h>
+typedef struct _X86_DBGKD_CONTROL_SET
+{
+ ULONG TraceFlag;
+ ULONG Dr7;
+ ULONG CurrentSymbolStart;
+ ULONG CurrentSymbolEnd;
+} X86_DBGKD_CONTROL_SET, *PX86_DBGKD_CONTROL_SET;
+
+typedef struct _IA64_DBGKD_CONTROL_SET
+{
+ ULONG Continue;
+ ULONG64 CurrentSymbolStart;
+ ULONG64 CurrentSymbolEnd;
+} IA64_DBGKD_CONTROL_SET, *PIA64_DBGKD_CONTROL_SET;
+
+typedef struct _AMD64_DBGKD_CONTROL_SET
+{
+ ULONG TraceFlag;
+ ULONG64 Dr7;
+ ULONG64 CurrentSymbolStart;
+ ULONG64 CurrentSymbolEnd;
+} AMD64_DBGKD_CONTROL_SET, *PAMD64_DBGKD_CONTROL_SET;
+
+typedef struct _DBGKD_ANY_CONTROL_SET
+{
+ union
+ {
+ X86_DBGKD_CONTROL_SET X86ControlSet;
+ IA64_DBGKD_CONTROL_SET IA64ControlSet;
+ AMD64_DBGKD_CONTROL_SET Amd64ControlSet;
+ };
+} DBGKD_ANY_CONTROL_SET, *PDBGKD_ANY_CONTROL_SET;
+#include <poppack.h>
+
+typedef X86_DBGKD_CONTROL_SET DBGKD_CONTROL_SET;
+
+//
// DBGKM Structure for Exceptions
//
typedef struct _DBGKM_EXCEPTION64
@@ -226,4 +271,193 @@
CONTEXT Context;
} DBGKD_WAIT_STATE_CHANGE64, *PDBGKD_WAIT_STATE_CHANGE64;
+//
+// DBGKD Manipulate Structures
+//
+typedef struct _DBGKD_READ_MEMORY64
+{
+ ULONG64 TargetBaseAddress;
+ ULONG TransferCount;
+ ULONG ActualBytesRead;
+} DBGKD_READ_MEMORY64, *PDBGKD_READ_MEMORY64;
+
+typedef struct _DBGKD_WRITE_MEMORY64
+{
+ ULONG64 TargetBaseAddress;
+ ULONG TransferCount;
+ ULONG ActualBytesWritten;
+} DBGKD_WRITE_MEMORY64, *PDBGKD_WRITE_MEMORY64;
+
+typedef struct _DBGKD_GET_CONTEXT
+{
+ ULONG Unused;
+} DBGKD_GET_CONTEXT, *PDBGKD_GET_CONTEXT;
+
+typedef struct _DBGKD_SET_CONTEXT
+{
+ ULONG ContextFlags;
+} DBGKD_SET_CONTEXT, *PDBGKD_SET_CONTEXT;
+
+typedef struct _DBGKD_WRITE_BREAKPOINT64
+{
+ ULONG64 BreakPointAddress;
+ ULONG BreakPointHandle;
+} DBGKD_WRITE_BREAKPOINT64, *PDBGKD_WRITE_BREAKPOINT64;
+
+typedef struct _DBGKD_RESTORE_BREAKPOINT
+{
+ ULONG BreakPointHandle;
+} DBGKD_RESTORE_BREAKPOINT, *PDBGKD_RESTORE_BREAKPOINT;
+
+typedef struct _DBGKD_CONTINUE
+{
+ NTSTATUS ContinueStatus;
+} DBGKD_CONTINUE, *PDBGKD_CONTINUE;
+
+#include <pshpack4.h>
+typedef struct _DBGKD_CONTINUE2
+{
+ NTSTATUS ContinueStatus;
+ union
+ {
+ DBGKD_CONTROL_SET ControlSet;
+ DBGKD_ANY_CONTROL_SET AnyControlSet;
+ };
+} DBGKD_CONTINUE2, *PDBGKD_CONTINUE2;
+#include <poppack.h>
+
+typedef struct _DBGKD_READ_WRITE_IO64
+{
+ ULONG64 IoAddress;
+ ULONG DataSize;
+ ULONG DataValue;
+} DBGKD_READ_WRITE_IO64, *PDBGKD_READ_WRITE_IO64;
+
+typedef struct _DBGKD_READ_WRITE_IO_EXTENDED64
+{
+ ULONG DataSize;
+ ULONG InterfaceType;
+ ULONG BusNumber;
+ ULONG AddressSpace;
+ ULONG64 IoAddress;
+ ULONG DataValue;
+} DBGKD_READ_WRITE_IO_EXTENDED64, *PDBGKD_READ_WRITE_IO_EXTENDED64;
+
+typedef struct _DBGKD_READ_WRITE_MSR
+{
+ ULONG Msr;
+ ULONG DataValueLow;
+ ULONG DataValueHigh;
+} DBGKD_READ_WRITE_MSR, *PDBGKD_READ_WRITE_MSR;
+
+typedef struct _DBGKD_QUERY_SPECIAL_CALLS
+{
+ ULONG NumberOfSpecialCalls;
+} DBGKD_QUERY_SPECIAL_CALLS, *PDBGKD_QUERY_SPECIAL_CALLS;
+
+typedef struct _DBGKD_SET_SPECIAL_CALL64
+{
+ ULONG64 SpecialCall;
+} DBGKD_SET_SPECIAL_CALL64, *PDBGKD_SET_SPECIAL_CALL64;
+
+typedef struct _DBGKD_SET_INTERNAL_BREAKPOINT64
+{
+ ULONG64 BreakpointAddress;
+ ULONG Flags;
+} DBGKD_SET_INTERNAL_BREAKPOINT64, *PDBGKD_SET_INTERNAL_BREAKPOINT64;
+
+typedef struct _DBGKD_GET_INTERNAL_BREAKPOINT64
+{
+ ULONG64 BreakpointAddress;
+ ULONG Flags;
+ ULONG Calls;
+ ULONG MaxCallsPerPeriod;
+ ULONG MinInstructions;
+ ULONG MaxInstructions;
+ ULONG TotalInstructions;
+} DBGKD_GET_INTERNAL_BREAKPOINT64, *PDBGKD_GET_INTERNAL_BREAKPOINT64;
+
+typedef struct _DBGKD_BREAKPOINTEX
+{
+ ULONG BreakPointCount;
+ NTSTATUS ContinueStatus;
+} DBGKD_BREAKPOINTEX, *PDBGKD_BREAKPOINTEX;
+
+typedef struct _DBGKD_SEARCH_MEMORY
+{
+ union
+ {
+ ULONG64 SearchAddress;
+ ULONG64 FoundAddress;
+ };
+ ULONG64 SearchLength;
+ ULONG PatternLength;
+} DBGKD_SEARCH_MEMORY, *PDBGKD_SEARCH_MEMORY;
+
+typedef struct _DBGKD_GET_SET_BUS_DATA
+{
+ ULONG BusDataType;
+ ULONG BusNumber;
+ ULONG SlotNumber;
+ ULONG Offset;
+ ULONG Length;
+} DBGKD_GET_SET_BUS_DATA, *PDBGKD_GET_SET_BUS_DATA;
+
+typedef struct _DBGKD_FILL_MEMORY
+{
+ ULONG64 Address;
+ ULONG Length;
+ USHORT Flags;
+ USHORT PatternLength;
+} DBGKD_FILL_MEMORY, *PDBGKD_FILL_MEMORY;
+
+typedef struct _DBGKD_QUERY_MEMORY
+{
+ ULONG64 Address;
+ ULONG64 Reserved;
+ ULONG AddressSpace;
+ ULONG Flags;
+} DBGKD_QUERY_MEMORY, *PDBGKD_QUERY_MEMORY;
+
+typedef struct _DBGKD_SWITCH_PARTITION
+{
+ ULONG Partition;
+} DBGKD_SWITCH_PARTITION;
+
+//
+// DBGKD Structure for Manipulate
+//
+typedef struct _DBGKD_MANIPULATE_STATE64
+{
+ ULONG ApiNumber;
+ USHORT ProcessorLevel;
+ USHORT Processor;
+ NTSTATUS ReturnStatus;
+ union
+ {
+ DBGKD_READ_MEMORY64 ReadMemory;
+ DBGKD_WRITE_MEMORY64 WriteMemory;
+ DBGKD_GET_CONTEXT GetContext;
+ DBGKD_SET_CONTEXT SetContext;
+ DBGKD_WRITE_BREAKPOINT64 WriteBreakPoint;
+ DBGKD_RESTORE_BREAKPOINT RestoreBreakPoint;
+ DBGKD_CONTINUE Continue;
+ DBGKD_CONTINUE2 Continue2;
+ DBGKD_READ_WRITE_IO64 ReadWriteIo;
+ DBGKD_READ_WRITE_IO_EXTENDED64 ReadWriteIoExtended;
+ DBGKD_QUERY_SPECIAL_CALLS QuerySpecialCalls;
+ DBGKD_SET_SPECIAL_CALL64 SetSpecialCall;
+ DBGKD_SET_INTERNAL_BREAKPOINT64 SetInternalBreakpoint;
+ DBGKD_GET_INTERNAL_BREAKPOINT64 GetInternalBreakpoint;
+ DBGKD_GET_VERSION64 GetVersion64;
+ DBGKD_BREAKPOINTEX BreakPointEx;
+ DBGKD_READ_WRITE_MSR ReadWriteMsr;
+ DBGKD_SEARCH_MEMORY SearchMemory;
+ DBGKD_GET_SET_BUS_DATA GetSetBusData;
+ DBGKD_FILL_MEMORY FillMemory;
+ DBGKD_QUERY_MEMORY QueryMemory;
+ DBGKD_SWITCH_PARTITION SwitchPartition;
+ } u;
+} DBGKD_MANIPULATE_STATE64, *PDBGKD_MANIPULATE_STATE64;
+
#endif
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 Mon Feb 19 18:02:39
2007
@@ -120,8 +120,8 @@
ULONG
NTAPI
KdpSymbol(
- IN LPSTR DllPath,
- IN ULONG DllBase,
+ IN PSTRING DllPath,
+ IN PKD_SYMBOLS_INFO DllBase,
IN BOOLEAN Unload,
IN KPROCESSOR_MODE PreviousMode,
IN PCONTEXT ContextRecord,
@@ -133,6 +133,15 @@
NTAPI
KdpPollBreakInWithPortLock(
VOID
+);
+
+BOOLEAN
+NTAPI
+KdpReportLoadSymbolsStateChange(
+ IN PSTRING PathName,
+ IN PKD_SYMBOLS_INFO SymbolInfo,
+ IN BOOLEAN Unload,
+ IN OUT PCONTEXT Context
);
extern DBGKD_GET_VERSION64 KdVersionBlock;
@@ -167,3 +176,4 @@
extern ULONG KdComponentTableSize;
extern ULONG Kd_WIN2000_Mask;
extern PULONG KdComponentTable[104];
+extern CHAR KdpMessageBuffer[4096], KdpPathBuffer[4096];
Modified: branches/alex-kd-branch/reactos/ntoskrnl/kd64/kdapi.c
URL:
http://svn.reactos.org/svn/reactos/branches/alex-kd-branch/reactos/ntoskrnl…
==============================================================================
--- branches/alex-kd-branch/reactos/ntoskrnl/kd64/kdapi.c (original)
+++ branches/alex-kd-branch/reactos/ntoskrnl/kd64/kdapi.c Mon Feb 19 18:02:39 2007
@@ -13,6 +13,488 @@
#include <debug.h>
/* PRIVATE FUNCTIONS *********************************************************/
+
+VOID
+NTAPI
+KdpSetCommonState(IN ULONG NewState,
+ IN PCONTEXT Context,
+ IN PDBGKD_WAIT_STATE_CHANGE64 WaitStateChange)
+{
+ USHORT InstructionCount;
+ BOOLEAN HadBreakpoints;
+
+ /* Setup common stuff available for all CPU architectures */
+ WaitStateChange->NewState = NewState;
+ WaitStateChange->ProcessorLevel = KeProcessorLevel;
+ WaitStateChange->Processor = (USHORT)KeGetCurrentPrcb()->Number;
+ WaitStateChange->NumberProcessors = (ULONG)KeNumberProcessors;
+ WaitStateChange->Thread = (ULONG)KeGetCurrentThread();
+ WaitStateChange->ProgramCounter = (ULONG64)Context->Eip;
+
+ /* Zero out the Control Report */
+ RtlZeroMemory(&WaitStateChange->ControlReport,
+ sizeof(DBGKD_CONTROL_REPORT));
+
+ /* Now copy the instruction stream and set the count */
+ RtlCopyMemory(&WaitStateChange->ControlReport.InstructionStream[0],
+ (PVOID)(ULONG_PTR)WaitStateChange->ProgramCounter,
+ DBGKD_MAXSTREAM);
+ InstructionCount = DBGKD_MAXSTREAM;
+ WaitStateChange->ControlReport.InstructionCount = InstructionCount;
+
+ /* Clear all the breakpoints in this region */
+ HadBreakpoints = FALSE;
+#if 0
+ KdpDeleteBreakpointRange((PVOID)WaitStateChange->ProgramCounter,
+ (PVOID)(WaitStateChange->ProgramCounter +
+ WaitStateChange->ControlReport.
+ InstructionCount - 1));
+#endif
+ if (HadBreakpoints)
+ {
+ /* Copy the instruction stream again, this time without breakpoints */
+ RtlCopyMemory(&WaitStateChange->ControlReport.InstructionStream[0],
+ (PVOID)(ULONG_PTR)WaitStateChange->ProgramCounter,
+ WaitStateChange->ControlReport.InstructionCount);
+ }
+}
+
+VOID
+NTAPI
+KdpSetContextState(IN PDBGKD_WAIT_STATE_CHANGE64 WaitStateChange,
+ IN PCONTEXT Context)
+{
+ PKPRCB Prcb = KeGetCurrentPrcb();
+
+ /* Copy i386 specific debug registers */
+ WaitStateChange->ControlReport.Dr6 = Prcb->ProcessorState.SpecialRegisters.
+ KernelDr6;
+ WaitStateChange->ControlReport.Dr7 = Prcb->ProcessorState.SpecialRegisters.
+ KernelDr7;
+
+ /* Copy i386 specific segments */
+ WaitStateChange->ControlReport.SegCs = (USHORT)Context->SegCs;
+ WaitStateChange->ControlReport.SegDs = (USHORT)Context->SegDs;
+ WaitStateChange->ControlReport.SegEs = (USHORT)Context->SegEs;
+ WaitStateChange->ControlReport.SegFs = (USHORT)Context->SegFs;
+
+ /* Copy EFlags */
+ WaitStateChange->ControlReport.EFlags = Context->EFlags;
+
+ /* Set Report Flags */
+ WaitStateChange->ControlReport.ReportFlags = REPORT_INCLUDES_SEGS;
+ if (WaitStateChange->ControlReport.SegCs == KGDT_R0_CODE)
+ {
+ WaitStateChange->ControlReport.ReportFlags = REPORT_INCLUDES_CS;
+ }
+}
+
+BOOLEAN
+NTAPI
+KdpSendWaitContinue(IN ULONG PacketType,
+ IN PSTRING SendHeader,
+ IN PSTRING SendData OPTIONAL,
+ IN OUT PCONTEXT ContextRecord)
+{
+ STRING Data, Header;
+ DBGKD_MANIPULATE_STATE64 ManipulateState;
+ ULONG Length;
+ KDSTATUS RecvCode;
+
+ /* Setup the Manipulate State structure */
+ Header.MaximumLength = sizeof(DBGKD_MANIPULATE_STATE64);
+ Header.Buffer = (PCHAR)&ManipulateState;
+ Data.MaximumLength = sizeof(KdpMessageBuffer);
+ Data.Buffer = KdpMessageBuffer;
+ //KdpContextSent = FALSE;
+
+SendPacket:
+ /* Send the Packet */
+ KdSendPacket(PacketType, SendHeader, SendData, &KdpContext);
+
+ /* If the debugger isn't present anymore, just return success */
+ if (KdDebuggerNotPresent) return TRUE;
+
+ /* Main processing Loop */
+ for (;;)
+ {
+ /* Receive Loop */
+ do
+ {
+ /* Wait to get a reply to our packet */
+ ManipulateState.ApiNumber = 0xFFFFFFFF;
+ RecvCode = KdReceivePacket(PACKET_TYPE_KD_STATE_MANIPULATE,
+ &Header,
+ &Data,
+ &Length,
+ &KdpContext);
+
+ /* If we got a resend request, do it */
+ if (RecvCode == KdPacketNeedsResend) goto SendPacket;
+ } while (RecvCode == KdPacketTimedOut);
+
+ /* Now check what API we got */
+ switch (ManipulateState.ApiNumber)
+ {
+ case DbgKdReadVirtualMemoryApi:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdReadVirtualMemoryApi);
+ while (TRUE);
+ break;
+
+ case DbgKdWriteVirtualMemoryApi:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdWriteVirtualMemoryApi);
+ while (TRUE);
+ break;
+
+ case DbgKdGetContextApi:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdGetContextApi);
+ while (TRUE);
+ break;
+
+ case DbgKdSetContextApi:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdSetContextApi);
+ while (TRUE);
+ break;
+
+ case DbgKdWriteBreakPointApi:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdWriteBreakPointApi);
+ while (TRUE);
+ break;
+
+ case DbgKdRestoreBreakPointApi:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdRestoreBreakPointApi);
+ while (TRUE);
+ break;
+
+ case DbgKdContinueApi:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdContinueApi);
+ while (TRUE);
+ break;
+
+ case DbgKdReadControlSpaceApi:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdReadControlSpaceApi);
+ while (TRUE);
+ break;
+
+ case DbgKdWriteControlSpaceApi:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdWriteControlSpaceApi);
+ while (TRUE);
+ break;
+
+ case DbgKdReadIoSpaceApi:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdReadIoSpaceApi);
+ while (TRUE);
+ break;
+
+ case DbgKdWriteIoSpaceApi:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdWriteIoSpaceApi);
+ while (TRUE);
+ break;
+
+ case DbgKdRebootApi:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdRebootApi);
+ while (TRUE);
+ break;
+
+ case DbgKdContinueApi2:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdContinueApi2);
+ while (TRUE);
+ break;
+
+ case DbgKdReadPhysicalMemoryApi:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdReadPhysicalMemoryApi);
+ while (TRUE);
+ break;
+
+ case DbgKdWritePhysicalMemoryApi:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdWritePhysicalMemoryApi);
+ while (TRUE);
+ break;
+
+ case DbgKdQuerySpecialCallsApi:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdQuerySpecialCallsApi);
+ while (TRUE);
+ break;
+
+ case DbgKdSetSpecialCallApi:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdSetSpecialCallApi);
+ while (TRUE);
+ break;
+
+ case DbgKdClearSpecialCallsApi:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdClearSpecialCallsApi);
+ while (TRUE);
+ break;
+
+ case DbgKdSetInternalBreakPointApi:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdSetInternalBreakPointApi);
+ while (TRUE);
+ break;
+
+ case DbgKdGetInternalBreakPointApi:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdGetInternalBreakPointApi);
+ while (TRUE);
+ break;
+
+ case DbgKdReadIoSpaceExtendedApi:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdReadIoSpaceExtendedApi);
+ while (TRUE);
+ break;
+
+ case DbgKdWriteIoSpaceExtendedApi:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdWriteIoSpaceExtendedApi);
+ while (TRUE);
+ break;
+
+ case DbgKdGetVersionApi:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdGetVersionApi);
+ while (TRUE);
+ break;
+
+ case DbgKdWriteBreakPointExApi:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdWriteBreakPointExApi);
+ while (TRUE);
+ break;
+
+ case DbgKdRestoreBreakPointExApi:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdRestoreBreakPointExApi);
+ while (TRUE);
+ break;
+
+ case DbgKdCauseBugCheckApi:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdCauseBugCheckApi);
+ while (TRUE);
+ break;
+
+ case DbgKdSwitchProcessor:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdSwitchProcessor);
+ while (TRUE);
+ break;
+
+ case DbgKdPageInApi:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdPageInApi);
+ while (TRUE);
+ break;
+
+ case DbgKdReadMachineSpecificRegister:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdReadMachineSpecificRegister);
+ while (TRUE);
+ break;
+
+ case DbgKdWriteMachineSpecificRegister:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdWriteMachineSpecificRegister);
+ while (TRUE);
+ break;
+
+ case OldVlm1:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(OldVlm1);
+ while (TRUE);
+ break;
+
+ case OldVlm2:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(OldVlm2);
+ while (TRUE);
+ break;
+
+ case DbgKdSearchMemoryApi:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdSearchMemoryApi);
+ while (TRUE);
+ break;
+
+ case DbgKdGetBusDataApi:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdGetBusDataApi);
+ while (TRUE);
+ break;
+
+ case DbgKdSetBusDataApi:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdSetBusDataApi);
+ while (TRUE);
+ break;
+
+ case DbgKdCheckLowMemoryApi:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdCheckLowMemoryApi);
+ while (TRUE);
+ break;
+
+ case DbgKdClearAllInternalBreakpointsApi:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdClearAllInternalBreakpointsApi);
+ while (TRUE);
+ break;
+
+ case DbgKdFillMemoryApi:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdFillMemoryApi);
+ while (TRUE);
+ break;
+
+ case DbgKdQueryMemoryApi:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdQueryMemoryApi);
+ while (TRUE);
+ break;
+
+ case DbgKdSwitchPartition:
+
+ /* FIXME: TODO */
+ Ke386SetCr2(DbgKdSwitchPartition);
+ while (TRUE);
+ break;
+
+ /* Unsupported Message */
+ default:
+
+ /* Setup an empty message, with failure */
+ while (TRUE);
+ Data.Length = 0;
+ ManipulateState.ReturnStatus = STATUS_UNSUCCESSFUL;
+
+ /* Send it */
+ KdSendPacket(PACKET_TYPE_KD_STATE_MANIPULATE,
+ &Header,
+ &Data,
+ &KdpContext);
+ break;
+ }
+ }
+}
+
+BOOLEAN
+NTAPI
+KdpReportLoadSymbolsStateChange(IN PSTRING PathName,
+ IN PKD_SYMBOLS_INFO SymbolInfo,
+ IN BOOLEAN Unload,
+ IN OUT PCONTEXT Context)
+{
+ PSTRING ExtraData;
+ STRING Data, Header;
+ DBGKD_WAIT_STATE_CHANGE64 WaitStateChange;
+ KCONTINUE_STATUS Status;
+
+ /* Start wait loop */
+ do
+ {
+ /* Build the architecture common parts of the message */
+ KdpSetCommonState(DbgKdLoadSymbolsStateChange,
+ Context,
+ &WaitStateChange);
+
+ /* Now finish creating the structure */
+ KdpSetContextState(&WaitStateChange, Context);
+
+ /* Fill out load data */
+ WaitStateChange.u.LoadSymbols.UnloadSymbols = Unload;
+ WaitStateChange.u.LoadSymbols.BaseOfDll = (ULONG)SymbolInfo->BaseOfDll;
+ WaitStateChange.u.LoadSymbols.ProcessId = SymbolInfo->ProcessId;
+ WaitStateChange.u.LoadSymbols.CheckSum = SymbolInfo->CheckSum;
+ WaitStateChange.u.LoadSymbols.SizeOfImage = SymbolInfo->SizeOfImage;
+
+ /* Check if we have a symbol name */
+ if (PathName)
+ {
+ /* Setup the information */
+ WaitStateChange.u.LoadSymbols.PathNameLength = PathName->Length;
+ Data.Buffer = KdpPathBuffer;
+ Data.Length = WaitStateChange.u.LoadSymbols.PathNameLength;
+ ExtraData = &Data;
+ }
+ else
+ {
+ /* No name */
+ WaitStateChange.u.LoadSymbols.PathNameLength = 0;
+ ExtraData = NULL;
+ }
+
+ /* Setup the header */
+ Header.Length = sizeof(DBGKD_WAIT_STATE_CHANGE64);
+ Header.Buffer = (PCHAR)&WaitStateChange;
+
+ /* Send the packet */
+ Status = KdpSendWaitContinue(PACKET_TYPE_KD_STATE_CHANGE64,
+ &Header,
+ ExtraData,
+ Context);
+ } while(Status == ContinueProcessorReselected);
+
+ /* Return status */
+ while (TRUE);
+ return Status;
+}
VOID
NTAPI
Modified: branches/alex-kd-branch/reactos/ntoskrnl/kd64/kddata.c
URL:
http://svn.reactos.org/svn/reactos/branches/alex-kd-branch/reactos/ntoskrnl…
==============================================================================
--- branches/alex-kd-branch/reactos/ntoskrnl/kd64/kddata.c (original)
+++ branches/alex-kd-branch/reactos/ntoskrnl/kd64/kddata.c Mon Feb 19 18:02:39 2007
@@ -81,6 +81,12 @@
PKEVENT KdpTimeSlipEvent;
KSPIN_LOCK KdpTimeSlipEventLock;
LARGE_INTEGER KdTimerStop, KdTimerStart, KdTimerDifference;
+
+//
+// Buffers
+//
+CHAR KdpMessageBuffer[4096];
+CHAR KdpPathBuffer[4096];
//
// Debug Filter Masks
Modified: branches/alex-kd-branch/reactos/ntoskrnl/kd64/kdprint.c
URL:
http://svn.reactos.org/svn/reactos/branches/alex-kd-branch/reactos/ntoskrnl…
==============================================================================
--- branches/alex-kd-branch/reactos/ntoskrnl/kd64/kdprint.c (original)
+++ branches/alex-kd-branch/reactos/ntoskrnl/kd64/kdprint.c Mon Feb 19 18:02:39 2007
@@ -11,8 +11,6 @@
#include <ntoskrnl.h>
#define NDEBUG
#include <debug.h>
-
-CHAR KdpMessageBuffer[4096];
/* FUNCTIONS *****************************************************************/
@@ -68,8 +66,8 @@
ULONG
NTAPI
-KdpSymbol(IN LPSTR DllPath,
- IN ULONG DllBase,
+KdpSymbol(IN PSTRING DllPath,
+ IN PKD_SYMBOLS_INFO DllBase,
IN BOOLEAN Unload,
IN KPROCESSOR_MODE PreviousMode,
IN PCONTEXT ContextRecord,
@@ -93,15 +91,11 @@
sizeof(CONTEXT));
/* Report the new state */
-#if 0
Status = KdpReportLoadSymbolsStateChange(DllPath,
DllBase,
Unload,
&Prcb->ProcessorState.
ContextFrame);
-#else
- Status = FALSE;
-#endif
/* Now restore the processor state, manually again. */
RtlCopyMemory(ContextRecord,
Modified: branches/alex-kd-branch/reactos/ntoskrnl/kd64/kdtrap.c
URL:
http://svn.reactos.org/svn/reactos/branches/alex-kd-branch/reactos/ntoskrnl…
==============================================================================
--- branches/alex-kd-branch/reactos/ntoskrnl/kd64/kdtrap.c (original)
+++ branches/alex-kd-branch/reactos/ntoskrnl/kd64/kdtrap.c Mon Feb 19 18:02:39 2007
@@ -154,8 +154,8 @@
case BREAKPOINT_LOAD_SYMBOLS:
/* Call the worker routine */
- KdpSymbol(UlongToPtr(ExceptionRecord->ExceptionInformation[1]),
- (ULONG)ExceptionRecord->ExceptionInformation[2],
+ KdpSymbol((PVOID)ExceptionRecord->ExceptionInformation[1],
+ (PVOID)ExceptionRecord->ExceptionInformation[2],
Unload,
PreviousMode,
ContextRecord,