Author: tkreuzer Date: Tue Dec 9 19:25:09 2008 New Revision: 37989
URL: http://svn.reactos.org/svn/reactos?rev=37989&view=rev Log: Make winkd somewhat portable.
Added: branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/amd64/ (with props) branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/amd64/kd-amd64.c (with props) branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/i386/ (with props) branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/i386/kd-i386.c (with props) Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/include/internal/kd64.h branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/kdapi.c branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/kddata.c branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/kdinit.c branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/kdlock.c branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/kdtrap.c branches/ros-amd64-bringup/reactos/ntoskrnl/ntoskrnl-generic.rbuild
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/include/internal/kd64.h URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntoskr... ============================================================================== --- branches/ros-amd64-bringup/reactos/ntoskrnl/include/internal/kd64.h [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/ntoskrnl/include/internal/kd64.h [iso-8859-1] Tue Dec 9 19:25:09 2008 @@ -243,6 +243,20 @@ KdpAddBreakpoint( IN PVOID Address ); + +VOID +NTAPI +KdpSetContextState(IN PDBGKD_WAIT_STATE_CHANGE64 WaitStateChange, + IN PCONTEXT Context); + +BOOLEAN +NTAPI +KdpReport(IN PKTRAP_FRAME TrapFrame, + IN PKEXCEPTION_FRAME ExceptionFrame, + IN PEXCEPTION_RECORD ExceptionRecord, + IN PCONTEXT ContextRecord, + IN KPROCESSOR_MODE PreviousMode, + IN BOOLEAN SecondChanceException);
// // Global KD Data
Propchange: branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/amd64/ ------------------------------------------------------------------------------ --- bugtraq:logregex (added) +++ bugtraq:logregex Tue Dec 9 19:25:09 2008 @@ -1,0 +1,2 @@ +([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))? +(\d+)
Propchange: branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/amd64/ ------------------------------------------------------------------------------ bugtraq:message = See issue #%BUGID% for more details.
Propchange: branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/amd64/ ------------------------------------------------------------------------------ bugtraq:url = http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID%
Propchange: branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/amd64/ ------------------------------------------------------------------------------ tsvn:logminsize = 10
Added: branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/amd64/kd-amd64.c URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntoskr... ============================================================================== --- branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/amd64/kd-amd64.c (added) +++ branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/amd64/kd-amd64.c [iso-8859-1] Tue Dec 9 19:25:09 2008 @@ -1,0 +1,155 @@ +/* + * PROJECT: ReactOS Kernel + * LICENSE: GPL - See COPYING in the top level directory + * FILE: ntoskrnl/kd64/i386/kdapi-i386.c + * PURPOSE: KD64 i386 Support + * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include <ntoskrnl.h> +#define NDEBUG +#include <debug.h> + +/* PRIVATE FUNCTIONS *********************************************************/ + +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_64_R0_CODE) + { + WaitStateChange->ControlReport.ReportFlags = REPORT_INCLUDES_CS; + } +} + +BOOLEAN +NTAPI +KdpTrap(IN PKTRAP_FRAME TrapFrame, + IN PKEXCEPTION_FRAME ExceptionFrame, + IN PEXCEPTION_RECORD ExceptionRecord, + IN PCONTEXT ContextRecord, + IN KPROCESSOR_MODE PreviousMode, + IN BOOLEAN SecondChanceException) +{ + BOOLEAN Unload = FALSE; + ULONG64 Rip, Rax; + BOOLEAN Status = FALSE; + + /* + * Check if we got a STATUS_BREAKPOINT with a SubID for Print, Prompt or + * Load/Unload symbols. + */ + if ((ExceptionRecord->ExceptionCode == STATUS_BREAKPOINT) && + (ExceptionRecord->ExceptionInformation[0] != BREAKPOINT_BREAK)) + { + /* Save EIP */ + Rip = ContextRecord->Rip; + + /* Check what kind of operation was requested from us */ + switch (ExceptionRecord->ExceptionInformation[0]) + { + /* DbgPrint */ + case BREAKPOINT_PRINT: + + /* Call the worker routine */ + Rax = KdpPrint(ContextRecord->R8, // ComponentId + ContextRecord->R9, // ComponentMask + (LPSTR)ExceptionRecord->ExceptionInformation[1], // String + (ULONG)ExceptionRecord->ExceptionInformation[2], // Length + PreviousMode, + TrapFrame, + ExceptionFrame, + &Status); + + /* Update the return value for the caller */ + ContextRecord->Rax = Rax; + break; + + /* DbgPrompt */ + case BREAKPOINT_PROMPT: + + /* Call the worker routine */ + while (TRUE); + Rax = 0; + Status = TRUE; + + /* Update the return value for the caller */ + ContextRecord->Rax = Rax; + break; + + /* DbgUnloadSymbols */ + case BREAKPOINT_UNLOAD_SYMBOLS: + + /* Drop into the load case below, with the unload parameter */ + Unload = TRUE; + + /* DbgLoadSymbols */ + case BREAKPOINT_LOAD_SYMBOLS: + + /* Call the worker routine */ + KdpSymbol((PVOID)ExceptionRecord->ExceptionInformation[1], + (PVOID)ExceptionRecord->ExceptionInformation[2], + Unload, + PreviousMode, + ContextRecord, + TrapFrame, + ExceptionFrame); + Status = TRUE; + break; + + /* DbgCommandString*/ + case BREAKPOINT_COMMAND_STRING: + + /* Call the worker routine */ + while (TRUE); + Status = TRUE; + + /* Anything else, do nothing */ + default: + + /* Get out */ + break; + } + + /* + * If EIP was not updated, we'll increment it ourselves so execution + * continues past the breakpoint. + */ + if (ContextRecord->Rip == Rip) ContextRecord->Rip++; + } + else + { + /* Call the worker routine */ + Status = KdpReport(TrapFrame, + ExceptionFrame, + ExceptionRecord, + ContextRecord, + PreviousMode, + SecondChanceException); + } + + /* Return TRUE or FALSE to caller */ + return Status; +}
Propchange: branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/amd64/kd-amd64.c ------------------------------------------------------------------------------ svn:eol-style = native
Propchange: branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/i386/ ------------------------------------------------------------------------------ --- bugtraq:logregex (added) +++ bugtraq:logregex Tue Dec 9 19:25:09 2008 @@ -1,0 +1,2 @@ +([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))? +(\d+)
Propchange: branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/i386/ ------------------------------------------------------------------------------ bugtraq:message = See issue #%BUGID% for more details.
Propchange: branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/i386/ ------------------------------------------------------------------------------ bugtraq:url = http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID%
Propchange: branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/i386/ ------------------------------------------------------------------------------ tsvn:logminsize = 10
Added: branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/i386/kd-i386.c URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntoskr... ============================================================================== --- branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/i386/kd-i386.c (added) +++ branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/i386/kd-i386.c [iso-8859-1] Tue Dec 9 19:25:09 2008 @@ -1,0 +1,155 @@ +/* + * PROJECT: ReactOS Kernel + * LICENSE: GPL - See COPYING in the top level directory + * FILE: ntoskrnl/kd64/i386/kdapi-i386.c + * PURPOSE: KD64 i386 Support + * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include <ntoskrnl.h> +#define NDEBUG +#include <debug.h> + +/* PRIVATE FUNCTIONS *********************************************************/ + +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 +KdpTrap(IN PKTRAP_FRAME TrapFrame, + IN PKEXCEPTION_FRAME ExceptionFrame, + IN PEXCEPTION_RECORD ExceptionRecord, + IN PCONTEXT ContextRecord, + IN KPROCESSOR_MODE PreviousMode, + IN BOOLEAN SecondChanceException) +{ + BOOLEAN Unload = FALSE; + ULONG Eip, Eax; + BOOLEAN Status = FALSE; + + /* + * Check if we got a STATUS_BREAKPOINT with a SubID for Print, Prompt or + * Load/Unload symbols. + */ + if ((ExceptionRecord->ExceptionCode == STATUS_BREAKPOINT) && + (ExceptionRecord->ExceptionInformation[0] != BREAKPOINT_BREAK)) + { + /* Save EIP */ + Eip = ContextRecord->Eip; + + /* Check what kind of operation was requested from us */ + switch (ExceptionRecord->ExceptionInformation[0]) + { + /* DbgPrint */ + case BREAKPOINT_PRINT: + + /* Call the worker routine */ + Eax = KdpPrint(ContextRecord->Ebx, + ContextRecord->Edi, + (LPSTR)ExceptionRecord->ExceptionInformation[1], + (ULONG)ExceptionRecord->ExceptionInformation[2], + PreviousMode, + TrapFrame, + ExceptionFrame, + &Status); + + /* Update the return value for the caller */ + ContextRecord->Eax = Eax; + break; + + /* DbgPrompt */ + case BREAKPOINT_PROMPT: + + /* Call the worker routine */ + while (TRUE); + Eax = 0; + Status = TRUE; + + /* Update the return value for the caller */ + ContextRecord->Eax = Eax; + break; + + /* DbgUnloadSymbols */ + case BREAKPOINT_UNLOAD_SYMBOLS: + + /* Drop into the load case below, with the unload parameter */ + Unload = TRUE; + + /* DbgLoadSymbols */ + case BREAKPOINT_LOAD_SYMBOLS: + + /* Call the worker routine */ + KdpSymbol((PVOID)ExceptionRecord->ExceptionInformation[1], + (PVOID)ExceptionRecord->ExceptionInformation[2], + Unload, + PreviousMode, + ContextRecord, + TrapFrame, + ExceptionFrame); + Status = TRUE; + break; + + /* DbgCommandString*/ + case BREAKPOINT_COMMAND_STRING: + + /* Call the worker routine */ + while (TRUE); + Status = TRUE; + + /* Anything else, do nothing */ + default: + + /* Get out */ + break; + } + + /* + * If EIP was not updated, we'll increment it ourselves so execution + * continues past the breakpoint. + */ + if (ContextRecord->Eip == Eip) ContextRecord->Eip++; + } + else + { + /* Call the worker routine */ + Status = KdpReport(TrapFrame, + ExceptionFrame, + ExceptionRecord, + ContextRecord, + PreviousMode, + SecondChanceException); + } + + /* Return TRUE or FALSE to caller */ + return Status; +}
Propchange: branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/i386/kd-i386.c ------------------------------------------------------------------------------ svn:eol-style = native
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/kdapi.c URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntoskr... ============================================================================== --- branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/kdapi.c [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/kdapi.c [iso-8859-1] Tue Dec 9 19:25:09 2008 @@ -173,7 +173,13 @@ WaitStateChange->Processor = (USHORT)KeGetCurrentPrcb()->Number; WaitStateChange->NumberProcessors = (ULONG)KeNumberProcessors; WaitStateChange->Thread = (ULONG)(LONG_PTR)KeGetCurrentThread(); +#if defined(_M_X86_) WaitStateChange->ProgramCounter = (ULONG)(LONG_PTR)Context->Eip; +#elif defined(_AMD64) + WaitStateChange->ProgramCounter = (ULONG)(LONG_PTR)Context->Rip; +#else +#error Unknown platform +#endif
/* Zero out the Control Report */ RtlZeroMemory(&WaitStateChange->ControlReport, @@ -189,7 +195,7 @@ /* Clear all the breakpoints in this region */ HadBreakpoints = KdpDeleteBreakpointRange((PVOID)(LONG_PTR)WaitStateChange->ProgramCounter, - (PVOID)((ULONG)WaitStateChange->ProgramCounter + + (PVOID)((ULONG_PTR)WaitStateChange->ProgramCounter + WaitStateChange->ControlReport.InstructionCount - 1)); if (HadBreakpoints) { @@ -197,36 +203,6 @@ 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; } }
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/kddata.c URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntoskr... ============================================================================== --- branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/kddata.c [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/kddata.c [iso-8859-1] Tue Dec 9 19:25:09 2008 @@ -328,6 +328,8 @@ DBGKD_VERS_FLAG_DATA, #if defined(_M_IX86) IMAGE_FILE_MACHINE_I386, +#elif defined (_M_AMD64) + IMAGE_FILE_MACHINE_AMD64, #elif defined(_M_PPC) IMAGE_FILE_MACHINE_POWERPC, #elif defined(_M_MIPS) @@ -348,26 +350,32 @@ { {{0}}, 0, - {PtrToUlong(RtlpBreakWithStatusInstruction)}, + {(ULONG_PTR)RtlpBreakWithStatusInstruction}, 0, FIELD_OFFSET(KTHREAD, CallbackStack), CBSTACK_CALLBACK_STACK, +#if defined(_M_X86) CBSTACK_EBP, - 0, - {PtrToUlong(KiCallUserMode)}, +#elif defined (_M_AMD64) + CBSTACK_RBP, +#else +#error Invalid architecture +#endif + 0, + {(ULONG_PTR)KiCallUserMode}, {0}, - {PtrToUlong(&PsLoadedModuleList)}, - {PtrToUlong(&PsActiveProcessHead)}, - {PtrToUlong(&PspCidTable)}, - {PtrToUlong(&ExpSystemResourcesList)}, + {(ULONG_PTR)&PsLoadedModuleList}, + {(ULONG_PTR)&PsActiveProcessHead}, + {(ULONG_PTR)&PspCidTable}, + {(ULONG_PTR)&ExpSystemResourcesList}, {0}, // ExpPagedPoolDescriptor {0}, // ExpNumberOfPagedPools - {PtrToUlong(&KeTimeIncrement)}, - {PtrToUlong(&KeBugcheckCallbackListHead)}, - {PtrToUlong(KiBugCheckData)}, - {PtrToUlong(&IopErrorLogListHead)}, - {PtrToUlong(&ObpRootDirectoryObject)}, - {PtrToUlong(&ObpTypeObjectType)}, + {(ULONG_PTR)&KeTimeIncrement}, + {(ULONG_PTR)&KeBugcheckCallbackListHead}, + {(ULONG_PTR)KiBugCheckData}, + {(ULONG_PTR)&IopErrorLogListHead}, + {(ULONG_PTR)&ObpRootDirectoryObject}, + {(ULONG_PTR)&ObpTypeObjectType}, {0}, // MmSystemCacheStart {0}, // MmSystemCacheEnd {0}, // MmSystemCacheWs @@ -404,17 +412,17 @@ {0}, // MmResidentAvailablePages {0}, // PoolTrackTable {0}, // NonPagedPoolDescriptor - {PtrToUlong(&MmHighestUserAddress)}, - {PtrToUlong(&MmSystemRangeStart)}, - {PtrToUlong(&MmUserProbeAddress)}, - {PtrToUlong(KdPrintDefaultCircularBuffer)}, - {PtrToUlong(KdPrintDefaultCircularBuffer + 1)}, - {PtrToUlong(&KdPrintWritePointer)}, - {PtrToUlong(&KdPrintRolloverCount)}, + {(ULONG_PTR)&MmHighestUserAddress}, + {(ULONG_PTR)&MmSystemRangeStart}, + {(ULONG_PTR)&MmUserProbeAddress}, + {(ULONG_PTR)KdPrintDefaultCircularBuffer}, + {(ULONG_PTR)(KdPrintDefaultCircularBuffer + 1)}, + {(ULONG_PTR)&KdPrintWritePointer}, + {(ULONG_PTR)&KdPrintRolloverCount}, {0}, // MmLoadedUserImageList - {PtrToUlong(&NtBuildLab)}, + {(ULONG_PTR)&NtBuildLab}, {0}, - {PtrToUlong(KiProcessorBlock)}, + {(ULONG_PTR)KiProcessorBlock}, {0}, // MmUnloadedDrivers {0}, // MmLastUnloadedDrivers {0}, // MmTriageActionTaken @@ -424,7 +432,7 @@ {0}, // MmAllocatedNonPagedPool {0}, // MmPeakCommitment {0}, // MmtotalCommitLimitMaximum - {PtrToUlong(&CmNtCSDVersion)}, + {(ULONG_PTR)&CmNtCSDVersion}, {0}, // MmPhysicalMemoryBlock {0}, // MmSessionBase {0}, // MmSessionSize @@ -451,18 +459,31 @@ FIELD_OFFSET(KPRCB, ProcessorState.ContextFrame), FIELD_OFFSET(KPRCB, Number), sizeof(ETHREAD), - {PtrToUlong(KdPrintDefaultCircularBuffer)}, - {PtrToUlong(&KdPrintBufferSize)}, - {PtrToUlong(&KeLoaderBlock)}, + {(ULONG_PTR)KdPrintDefaultCircularBuffer}, + {(ULONG_PTR)&KdPrintBufferSize}, + {(ULONG_PTR)&KeLoaderBlock}, sizeof(KIPCR) + sizeof(KPRCB), FIELD_OFFSET(KIPCR, Self), +#if defined(_M_X86) FIELD_OFFSET(KPCR, Prcb), +#elif defined(_M_AMD64) + FIELD_OFFSET(KPCR, CurrentPrcb), +#else + #error Invalid architecture +#endif +#if defined(_M_X86) FIELD_OFFSET(KIPCR, PrcbData), - 0, - 0, - 0, - 0, - 0, +#elif defined(_M_AMD64) + FIELD_OFFSET(KIPCR, Prcb), +#else + #error Invalid architecture +#endif + 0, + 0, + 0, + 0, + 0, +#if defined(_M_X86) FIELD_OFFSET(KIPCR, PrcbData) + FIELD_OFFSET(KPRCB, ProcessorState.SpecialRegisters), KGDT_R0_CODE, @@ -473,6 +494,20 @@ KGDT_R3_TEB, KGDT_LDT, KGDT_TSS, +#elif defined(_M_AMD64) + FIELD_OFFSET(KIPCR, Prcb) + + FIELD_OFFSET(KPRCB, ProcessorState.SpecialRegisters), + KGDT_64_R0_CODE, + KGDT_64_DATA, + KGDT_64_DATA, + KGDT_64_R3_CODE, + KGDT_64_DATA, + KGDT_64_DATA, + 0, + KGDT_TSS, +#else + #error Invalid architecture +#endif 0, 0, {0}, // IopNumTriagDumpDataBlocks
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/kdinit.c URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntoskr... ============================================================================== --- branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/kdinit.c [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/kdinit.c [iso-8859-1] Tue Dec 9 19:25:09 2008 @@ -133,7 +133,7 @@ InLoadOrderLinks);
/* Save the Kernel Base */ - PsNtosImageBase = (ULONG)LdrEntry->DllBase; + PsNtosImageBase = (ULONG_PTR)LdrEntry->DllBase; KdVersionBlock.KernBase = (ULONGLONG)(LONG_PTR)LdrEntry->DllBase;
/* Check if we have a command line */
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/kdlock.c URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntoskr... ============================================================================== --- branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/kdlock.c [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/kdlock.c [iso-8859-1] Tue Dec 9 19:25:09 2008 @@ -75,7 +75,7 @@ KdPollBreakIn(VOID) { BOOLEAN DoBreak = FALSE; - ULONG Flags = 0; + ULONG_PTR Flags = 0;
/* First make sure that KD is enabled */ if (KdDebuggerEnabled)
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/kdtrap.c URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntoskr... ============================================================================== --- branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/kdtrap.c [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/ntoskrnl/kd64/kdtrap.c [iso-8859-1] Tue Dec 9 19:25:09 2008 @@ -81,116 +81,6 @@
BOOLEAN NTAPI -KdpTrap(IN PKTRAP_FRAME TrapFrame, - IN PKEXCEPTION_FRAME ExceptionFrame, - IN PEXCEPTION_RECORD ExceptionRecord, - IN PCONTEXT ContextRecord, - IN KPROCESSOR_MODE PreviousMode, - IN BOOLEAN SecondChanceException) -{ - BOOLEAN Unload = FALSE; - ULONG Eip, Eax; - BOOLEAN Status = FALSE; - - /* - * Check if we got a STATUS_BREAKPOINT with a SubID for Print, Prompt or - * Load/Unload symbols. - */ - if ((ExceptionRecord->ExceptionCode == STATUS_BREAKPOINT) && - (ExceptionRecord->ExceptionInformation[0] != BREAKPOINT_BREAK)) - { - /* Save EIP */ - Eip = ContextRecord->Eip; - - /* Check what kind of operation was requested from us */ - switch (ExceptionRecord->ExceptionInformation[0]) - { - /* DbgPrint */ - case BREAKPOINT_PRINT: - - /* Call the worker routine */ - Eax = KdpPrint(ContextRecord->Ebx, - ContextRecord->Edi, - (LPSTR)ExceptionRecord->ExceptionInformation[1], - (ULONG)ExceptionRecord->ExceptionInformation[2], - PreviousMode, - TrapFrame, - ExceptionFrame, - &Status); - - /* Update the return value for the caller */ - ContextRecord->Eax = Eax; - break; - - /* DbgPrompt */ - case BREAKPOINT_PROMPT: - - /* Call the worker routine */ - while (TRUE); - Eax = 0; - Status = TRUE; - - /* Update the return value for the caller */ - ContextRecord->Eax = Eax; - break; - - /* DbgUnloadSymbols */ - case BREAKPOINT_UNLOAD_SYMBOLS: - - /* Drop into the load case below, with the unload parameter */ - Unload = TRUE; - - /* DbgLoadSymbols */ - case BREAKPOINT_LOAD_SYMBOLS: - - /* Call the worker routine */ - KdpSymbol((PVOID)ExceptionRecord->ExceptionInformation[1], - (PVOID)ExceptionRecord->ExceptionInformation[2], - Unload, - PreviousMode, - ContextRecord, - TrapFrame, - ExceptionFrame); - Status = TRUE; - break; - - /* DbgCommandString*/ - case BREAKPOINT_COMMAND_STRING: - - /* Call the worker routine */ - while (TRUE); - Status = TRUE; - - /* Anything else, do nothing */ - default: - - /* Get out */ - break; - } - - /* - * If EIP was not updated, we'll increment it ourselves so execution - * continues past the breakpoint. - */ - if (ContextRecord->Eip == Eip) ContextRecord->Eip++; - } - else - { - /* Call the worker routine */ - Status = KdpReport(TrapFrame, - ExceptionFrame, - ExceptionRecord, - ContextRecord, - PreviousMode, - SecondChanceException); - } - - /* Return TRUE or FALSE to caller */ - return Status; -} - -BOOLEAN -NTAPI KdpStub(IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame, IN PEXCEPTION_RECORD ExceptionRecord, @@ -209,7 +99,13 @@ (ExceptionCommand == BREAKPOINT_PRINT))) { /* This we can handle: simply bump EIP */ +#if defined (_M_X86) ContextRecord->Eip++; +#elif defined (_M_AMD64) + ContextRecord->Rip++; +#else +#error Unknown platform +#endif return TRUE; } else if (KdPitchDebugger)
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ntoskrnl-generic.rbuild URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntoskr... ============================================================================== --- branches/ros-amd64-bringup/reactos/ntoskrnl/ntoskrnl-generic.rbuild [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/ntoskrnl/ntoskrnl-generic.rbuild [iso-8859-1] Tue Dec 9 19:25:09 2008 @@ -364,6 +364,16 @@ <file>kdlock.c</file> <file>kdprint.c</file> <file>kdtrap.c</file> + <if property="ARCH" value="i386"> + <directory name="i386"> + <file>kd-i386.c</file> + </directory> + </if> + <if property="ARCH" value="amd64"> + <directory name="amd64"> + <file>kd-amd64.c</file> + </directory> + </if> </directory> </if> <directory name="lpc">