Make winkd somewhat portable.
[reactos.git] / reactos / ntoskrnl / kd64 / kdtrap.c
index 264b283..33ea3b4 100644 (file)
@@ -79,116 +79,6 @@ KdpReport(IN PKTRAP_FRAME TrapFrame,
     return Status;\r
 }\r
 \r
-BOOLEAN\r
-NTAPI\r
-KdpTrap(IN PKTRAP_FRAME TrapFrame,\r
-        IN PKEXCEPTION_FRAME ExceptionFrame,\r
-        IN PEXCEPTION_RECORD ExceptionRecord,\r
-        IN PCONTEXT ContextRecord,\r
-        IN KPROCESSOR_MODE PreviousMode,\r
-        IN BOOLEAN SecondChanceException)\r
-{\r
-    BOOLEAN Unload = FALSE;\r
-    ULONG Eip, Eax;\r
-    BOOLEAN Status = FALSE;\r
-\r
-    /*\r
-     * Check if we got a STATUS_BREAKPOINT with a SubID for Print, Prompt or\r
-     * Load/Unload symbols.\r
-     */\r
-    if ((ExceptionRecord->ExceptionCode == STATUS_BREAKPOINT) &&\r
-        (ExceptionRecord->ExceptionInformation[0] != BREAKPOINT_BREAK))\r
-    {\r
-        /* Save EIP */\r
-        Eip = ContextRecord->Eip;\r
-\r
-        /* Check what kind of operation was requested from us */\r
-        switch (ExceptionRecord->ExceptionInformation[0])\r
-        {\r
-            /* DbgPrint */\r
-            case BREAKPOINT_PRINT:\r
-\r
-                /* Call the worker routine */\r
-                Eax = KdpPrint(ContextRecord->Ebx,\r
-                               ContextRecord->Edi,\r
-                               (LPSTR)ExceptionRecord->ExceptionInformation[1],\r
-                               (ULONG)ExceptionRecord->ExceptionInformation[2],\r
-                               PreviousMode,\r
-                               TrapFrame,\r
-                               ExceptionFrame,\r
-                               &Status);\r
-\r
-                /* Update the return value for the caller */\r
-                ContextRecord->Eax = Eax;\r
-                break;\r
-\r
-            /* DbgPrompt */\r
-            case BREAKPOINT_PROMPT:\r
-\r
-                /* Call the worker routine */\r
-                while (TRUE);\r
-                Eax = 0;\r
-                Status = TRUE;\r
-\r
-                /* Update the return value for the caller */\r
-                ContextRecord->Eax = Eax;\r
-                break;\r
-\r
-            /* DbgUnloadSymbols */\r
-            case BREAKPOINT_UNLOAD_SYMBOLS:\r
-\r
-                /* Drop into the load case below, with the unload parameter */\r
-                Unload = TRUE;\r
-\r
-            /* DbgLoadSymbols */\r
-            case BREAKPOINT_LOAD_SYMBOLS:\r
-\r
-                /* Call the worker routine */\r
-                KdpSymbol((PVOID)ExceptionRecord->ExceptionInformation[1],\r
-                          (PVOID)ExceptionRecord->ExceptionInformation[2],\r
-                          Unload,\r
-                          PreviousMode,\r
-                          ContextRecord,\r
-                          TrapFrame,\r
-                          ExceptionFrame);\r
-                Status = TRUE;\r
-                break;\r
-\r
-            /* DbgCommandString*/\r
-            case BREAKPOINT_COMMAND_STRING:\r
-\r
-                /* Call the worker routine */\r
-                while (TRUE);\r
-                Status = TRUE;\r
-\r
-            /* Anything else, do nothing */\r
-            default:\r
-\r
-                /* Get out */\r
-                break;\r
-        }\r
-\r
-        /*\r
-         * If EIP was not updated, we'll increment it ourselves so execution\r
-         * continues past the breakpoint.\r
-         */\r
-        if (ContextRecord->Eip == Eip) ContextRecord->Eip++;\r
-    }\r
-    else\r
-    {\r
-        /* Call the worker routine */\r
-        Status = KdpReport(TrapFrame,\r
-                           ExceptionFrame,\r
-                           ExceptionRecord,\r
-                           ContextRecord,\r
-                           PreviousMode,\r
-                           SecondChanceException);\r
-    }\r
-\r
-    /* Return TRUE or FALSE to caller */\r
-    return Status;\r
-}\r
-\r
 BOOLEAN\r
 NTAPI\r
 KdpStub(IN PKTRAP_FRAME TrapFrame,\r
@@ -209,7 +99,13 @@ KdpStub(IN PKTRAP_FRAME TrapFrame,
          (ExceptionCommand == BREAKPOINT_PRINT)))\r
     {\r
         /* This we can handle: simply bump EIP */\r
+#if defined (_M_X86)\r
         ContextRecord->Eip++;\r
+#elif defined (_M_AMD64)\r
+        ContextRecord->Rip++;\r
+#else\r
+#error Unknown platform\r
+#endif\r
         return TRUE;\r
     }\r
     else if (KdPitchDebugger)\r