Make winkd somewhat portable.
[reactos.git] / reactos / ntoskrnl / kd64 / kdapi.c
index f062508..265904c 100644 (file)
@@ -173,7 +173,13 @@ KdpSetCommonState(IN ULONG NewState,
     WaitStateChange->Processor = (USHORT)KeGetCurrentPrcb()->Number;\r
     WaitStateChange->NumberProcessors = (ULONG)KeNumberProcessors;\r
     WaitStateChange->Thread = (ULONG)(LONG_PTR)KeGetCurrentThread();\r
+#if defined(_M_X86_)\r
     WaitStateChange->ProgramCounter = (ULONG)(LONG_PTR)Context->Eip;\r
+#elif defined(_AMD64)\r
+    WaitStateChange->ProgramCounter = (ULONG)(LONG_PTR)Context->Rip;\r
+#else\r
+#error Unknown platform\r
+#endif\r
 \r
     /* Zero out the Control Report */\r
     RtlZeroMemory(&WaitStateChange->ControlReport,\r
@@ -189,7 +195,7 @@ KdpSetCommonState(IN ULONG NewState,
     /* Clear all the breakpoints in this region */\r
     HadBreakpoints =\r
         KdpDeleteBreakpointRange((PVOID)(LONG_PTR)WaitStateChange->ProgramCounter,\r
-                                 (PVOID)((ULONG)WaitStateChange->ProgramCounter +\r
+                                 (PVOID)((ULONG_PTR)WaitStateChange->ProgramCounter +\r
                                          WaitStateChange->ControlReport.InstructionCount - 1));\r
     if (HadBreakpoints)\r
     {\r
@@ -200,36 +206,6 @@ KdpSetCommonState(IN ULONG NewState,
     }\r
 }\r
 \r
-VOID\r
-NTAPI\r
-KdpSetContextState(IN PDBGKD_WAIT_STATE_CHANGE64 WaitStateChange,\r
-                   IN PCONTEXT Context)\r
-{\r
-    PKPRCB Prcb = KeGetCurrentPrcb();\r
-\r
-    /* Copy i386 specific debug registers */\r
-    WaitStateChange->ControlReport.Dr6 = Prcb->ProcessorState.SpecialRegisters.\r
-                                         KernelDr6;\r
-    WaitStateChange->ControlReport.Dr7 = Prcb->ProcessorState.SpecialRegisters.\r
-                                         KernelDr7;\r
-\r
-    /* Copy i386 specific segments */\r
-    WaitStateChange->ControlReport.SegCs = (USHORT)Context->SegCs;\r
-    WaitStateChange->ControlReport.SegDs = (USHORT)Context->SegDs;\r
-    WaitStateChange->ControlReport.SegEs = (USHORT)Context->SegEs;\r
-    WaitStateChange->ControlReport.SegFs = (USHORT)Context->SegFs;\r
-\r
-    /* Copy EFlags */\r
-    WaitStateChange->ControlReport.EFlags = Context->EFlags;\r
-\r
-    /* Set Report Flags */\r
-    WaitStateChange->ControlReport.ReportFlags = REPORT_INCLUDES_SEGS;\r
-    if (WaitStateChange->ControlReport.SegCs == KGDT_R0_CODE)\r
-    {\r
-        WaitStateChange->ControlReport.ReportFlags = REPORT_INCLUDES_CS;\r
-    }\r
-}\r
-\r
 VOID\r
 NTAPI\r
 KdpSysGetVersion(IN PDBGKD_GET_VERSION64 Version)\r