KD64 Compatibility Bringup:
[reactos.git] / reactos / ntoskrnl / kd64 / kdtrap.c
index 154043f..604cea3 100644 (file)
 #define NDEBUG\r
 #include <debug.h>\r
 \r
+//\r
+// Retrieves the ComponentId and Level for BREAKPOINT_PRINT\r
+// and OutputString and OutputStringLength for BREAKPOINT_PROMPT.\r
+//\r
+#if defined(_M_IX86)\r
+\r
+//\r
+// EBX/EDI on x86\r
+//\r
+#define KdpGetFirstParameter(Context)  ((Context)->Ebx)\r
+#define KdpGetSecondParameter(Context) ((Context)->Edi)\r
+\r
+#elif defined(_M_AMD64)\r
+\r
+//\r
+// R8/R9 on AMD64\r
+//\r
+#define KdpGetFirstParameter(Context)  ((Context)->R8)\r
+#define KdpGetSecondParameter(Context) ((Context)->R9)\r
+\r
+#elif defined(_M_ARM)\r
+\r
+#error Yo Ninjas!\r
+\r
+#else\r
+#error Unsupported Architecture\r
+#endif\r
+\r
 /* FUNCTIONS *****************************************************************/\r
 \r
 BOOLEAN\r
@@ -27,7 +55,7 @@ KdpReport(IN PKTRAP_FRAME TrapFrame,
     PKPRCB Prcb;\r
     NTSTATUS ExceptionCode = ExceptionRecord->ExceptionCode;\r
 \r
-    /* Check if this is INT1 or 3, or if we're forced to handle it */\r
+    /* Check if this is single step or a breakpoint, or if we're forced to handle it */\r
     if ((ExceptionCode == STATUS_BREAKPOINT) ||\r
         (ExceptionCode == STATUS_SINGLE_STEP) ||\r
         (ExceptionCode == STATUS_ASSERTION_FAILURE) ||\r
@@ -109,8 +137,8 @@ KdpTrap(IN PKTRAP_FRAME TrapFrame,
             case BREAKPOINT_PRINT:\r
 \r
                 /* Call the worker routine */\r
-                ReturnValue = KdpPrint((ULONG)ContextRecord->Ebx,\r
-                                       (ULONG)ContextRecord->Edi,\r
+                ReturnValue = KdpPrint((ULONG)KdpGetFirstParameter(ContextRecord),\r
+                                       (ULONG)KdpGetSecondParameter(ContextRecord),\r
                                        (LPSTR)ExceptionRecord->\r
                                        ExceptionInformation[1],\r
                                        (USHORT)ExceptionRecord->\r
@@ -132,8 +160,8 @@ KdpTrap(IN PKTRAP_FRAME TrapFrame,
                                         ExceptionInformation[1],\r
                                         (USHORT)ExceptionRecord->\r
                                         ExceptionInformation[2],\r
-                                        (LPSTR)ContextRecord->Ebx,\r
-                                        (USHORT)ContextRecord->Edi,\r
+                                        (LPSTR)KdpGetFirstParameter(ContextRecord),\r
+                                        (USHORT)KdpGetSecondParameter(ContextRecord),\r
                                         PreviousMode,\r
                                         TrapFrame,\r
                                         ExceptionFrame);\r
@@ -143,7 +171,7 @@ KdpTrap(IN PKTRAP_FRAME TrapFrame,
                 KeSetContextReturnRegister(ContextRecord, ReturnValue);\r
                 break;\r
 \r
-            /* DbgUnloadImageSymbols */\r
+            /* DbgUnLoadImageSymbols */\r
             case BREAKPOINT_UNLOAD_SYMBOLS:\r
 \r
                 /* Drop into the load case below, with the unload parameter */\r