update for HEAD-2003091401
[reactos.git] / ntoskrnl / ke / bug.c
index 8bec9da..70308fa 100644 (file)
 
 /* INCLUDES *****************************************************************/
 
-#include <ddk/ntddk.h>
+#include <roskrnl.h>
+#include <ntos/bootvid.h>
+#include <internal/kd.h>
 #include <internal/ke.h>
 #include <internal/ps.h>
 
 #include <internal/debug.h>
 
+#include "../../hal/halx86/include/hal.h"
+
 /* GLOBALS ******************************************************************/
 
 static LIST_ENTRY BugcheckCallbackListHead = {NULL,NULL};
@@ -52,6 +56,9 @@ KeInitializeBugCheck(VOID)
   InBugCheck = 0;
 }
 
+/*
+ * @unimplemented
+ */
 BOOLEAN STDCALL
 KeDeregisterBugCheckCallback(PKBUGCHECK_CALLBACK_RECORD CallbackRecord)
 {
@@ -59,6 +66,9 @@ KeDeregisterBugCheckCallback(PKBUGCHECK_CALLBACK_RECORD CallbackRecord)
   return FALSE;
 }
 
+/*
+ * @implemented
+ */
 BOOLEAN STDCALL
 KeRegisterBugCheckCallback(PKBUGCHECK_CALLBACK_RECORD CallbackRecord,
                           PKBUGCHECK_CALLBACK_ROUTINE  CallbackRoutine,
@@ -84,8 +94,20 @@ KeBugCheckWithTf(ULONG BugCheckCode,
 {
   PRTL_MESSAGE_RESOURCE_ENTRY Message;
   NTSTATUS Status;
-  
+  KIRQL OldIrql;
+
+  /* Make sure we're switching back to the blue screen and print messages on it */
+  HalReleaseDisplayOwnership();
+  if (0 == (KdDebugState & KD_DEBUG_GDB))
+    {
+      KdDebugState |= KD_DEBUG_SCREEN;
+    }
+
   __asm__("cli\n\t");
+  if (KeGetCurrentIrql() < DISPATCH_LEVEL)
+    {
+      KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
+    }
   DbgPrint("Bug detected (code %x param %x %x %x %x)\n",
           BugCheckCode,
           BugCheckParameter1,
@@ -137,6 +159,9 @@ KeBugCheckWithTf(ULONG BugCheckCode,
     }
 }
 
+/*
+ * @implemented
+ */
 VOID STDCALL
 KeBugCheckEx(ULONG BugCheckCode,
             ULONG BugCheckParameter1,
@@ -154,8 +179,17 @@ KeBugCheckEx(ULONG BugCheckCode,
 {
   PRTL_MESSAGE_RESOURCE_ENTRY Message;
   NTSTATUS Status;
-  
+  KIRQL OldIrql;
+
+  /* Make sure we're switching back to the blue screen and print messages on it */
+  HalReleaseDisplayOwnership();
+  KdDebugState |= KD_DEBUG_SCREEN;
+
   __asm__("cli\n\t");
+  if (KeGetCurrentIrql() < DISPATCH_LEVEL)
+    {
+      KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
+    }
   DbgPrint("Bug detected (code %x param %x %x %x %x)\n",
           BugCheckCode,
           BugCheckParameter1,
@@ -218,6 +252,9 @@ KeBugCheckEx(ULONG BugCheckCode,
     }
 }
 
+/*
+ * @implemented
+ */
 VOID STDCALL
 KeBugCheck(ULONG BugCheckCode)
 /*