mirror of
https://github.com/reactos/reactos.git
synced 2025-05-07 02:41:22 +00:00
KeBugCheck() calls KeBugCheckEx().
KeBugCheckEx() displays additional bug message. svn path=/trunk/; revision=2498
This commit is contained in:
parent
1208d849d0
commit
25c85c7dfe
1 changed files with 75 additions and 70 deletions
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* ReactOS kernel
|
* ReactOS kernel
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002 ReactOS Team
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: bug.c,v 1.18 2001/04/17 04:11:00 dwelch Exp $
|
/* $Id: bug.c,v 1.19 2002/01/10 00:59:32 ekohl Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: ntoskrnl/ke/bug.c
|
* FILE: ntoskrnl/ke/bug.c
|
||||||
|
@ -45,25 +45,25 @@ VOID PsDumpThreads(VOID);
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
KeInitializeBugCheck(VOID)
|
KeInitializeBugCheck(VOID)
|
||||||
{
|
{
|
||||||
InitializeListHead(&BugcheckCallbackListHead);
|
InitializeListHead(&BugcheckCallbackListHead);
|
||||||
InBugCheck = 0;
|
InBugCheck = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN STDCALL
|
BOOLEAN STDCALL
|
||||||
KeDeregisterBugCheckCallback (PKBUGCHECK_CALLBACK_RECORD CallbackRecord)
|
KeDeregisterBugCheckCallback(PKBUGCHECK_CALLBACK_RECORD CallbackRecord)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN STDCALL
|
BOOLEAN STDCALL
|
||||||
KeRegisterBugCheckCallback (PKBUGCHECK_CALLBACK_RECORD CallbackRecord,
|
KeRegisterBugCheckCallback(PKBUGCHECK_CALLBACK_RECORD CallbackRecord,
|
||||||
PKBUGCHECK_CALLBACK_ROUTINE CallbackRoutine,
|
PKBUGCHECK_CALLBACK_ROUTINE CallbackRoutine,
|
||||||
PVOID Buffer,
|
PVOID Buffer,
|
||||||
ULONG Length,
|
ULONG Length,
|
||||||
PUCHAR Component)
|
PUCHAR Component)
|
||||||
{
|
{
|
||||||
InsertTailList(&BugcheckCallbackListHead, &CallbackRecord->Entry);
|
InsertTailList(&BugcheckCallbackListHead, &CallbackRecord->Entry);
|
||||||
CallbackRecord->Length = Length;
|
CallbackRecord->Length = Length;
|
||||||
|
@ -74,11 +74,11 @@ KeRegisterBugCheckCallback (PKBUGCHECK_CALLBACK_RECORD CallbackRecord,
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID STDCALL
|
VOID STDCALL
|
||||||
KeBugCheckEx (ULONG BugCheckCode,
|
KeBugCheckEx(ULONG BugCheckCode,
|
||||||
ULONG BugCheckParameter1,
|
ULONG BugCheckParameter1,
|
||||||
ULONG BugCheckParameter2,
|
ULONG BugCheckParameter2,
|
||||||
ULONG BugCheckParameter3,
|
ULONG BugCheckParameter3,
|
||||||
ULONG BugCheckParameter4)
|
ULONG BugCheckParameter4)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Brings the system down in a controlled manner when an
|
* FUNCTION: Brings the system down in a controlled manner when an
|
||||||
* inconsistency that might otherwise cause corruption has been detected
|
* inconsistency that might otherwise cause corruption has been detected
|
||||||
|
@ -88,38 +88,71 @@ KeBugCheckEx (ULONG BugCheckCode,
|
||||||
* RETURNS: Doesn't
|
* RETURNS: Doesn't
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
PRTL_MESSAGE_RESOURCE_ENTRY Message;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
/* PJS: disable interrupts first, then do the rest */
|
/* PJS: disable interrupts first, then do the rest */
|
||||||
__asm__("cli\n\t");
|
__asm__("cli\n\t");
|
||||||
DbgPrint("Bug detected (code %x param %x %x %x %x)\n",BugCheckCode,
|
DbgPrint("Bug detected (code %x param %x %x %x %x)\n",
|
||||||
BugCheckParameter1,BugCheckParameter2,BugCheckParameter3,
|
BugCheckCode,
|
||||||
BugCheckParameter4);
|
BugCheckParameter1,
|
||||||
if (PsGetCurrentProcess() != NULL)
|
BugCheckParameter2,
|
||||||
{
|
BugCheckParameter3,
|
||||||
DbgPrint("Pid: %x <", PsGetCurrentProcess()->UniqueProcessId);
|
BugCheckParameter4);
|
||||||
DbgPrint("%.8s> ", PsGetCurrentProcess()->ImageFileName);
|
|
||||||
}
|
Status = RtlFindMessage((PVOID)KERNEL_BASE, //0xC0000000,
|
||||||
if (PsGetCurrentThread() != NULL)
|
11, //RT_MESSAGETABLE,
|
||||||
{
|
0x09, //0x409,
|
||||||
DbgPrint("Thrd: %x Tid: %x\n",
|
BugCheckCode,
|
||||||
PsGetCurrentThread(),
|
&Message);
|
||||||
PsGetCurrentThread()->Cid.UniqueThread);
|
if (NT_SUCCESS(Status))
|
||||||
}
|
{
|
||||||
|
if (Message->Flags == 0)
|
||||||
|
DbgPrint(" %s\n", Message->Text);
|
||||||
|
else
|
||||||
|
DbgPrint(" %S\n", (PWSTR)Message->Text);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DbgPrint(" No message text found!\n\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (InBugCheck == 1)
|
||||||
|
{
|
||||||
|
DbgPrint("Recursive bug check halting now\n");
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
__asm__("hlt\n\t");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
InBugCheck = 1;
|
||||||
|
if (PsGetCurrentProcess() != NULL)
|
||||||
|
{
|
||||||
|
DbgPrint("Pid: %x <", PsGetCurrentProcess()->UniqueProcessId);
|
||||||
|
DbgPrint("%.8s> ", PsGetCurrentProcess()->ImageFileName);
|
||||||
|
}
|
||||||
|
if (PsGetCurrentThread() != NULL)
|
||||||
|
{
|
||||||
|
DbgPrint("Thrd: %x Tid: %x\n",
|
||||||
|
PsGetCurrentThread(),
|
||||||
|
PsGetCurrentThread()->Cid.UniqueThread);
|
||||||
|
}
|
||||||
// PsDumpThreads();
|
// PsDumpThreads();
|
||||||
KeDumpStackFrames((PULONG)__builtin_frame_address(0));
|
KeDumpStackFrames((PULONG)__builtin_frame_address(0));
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
/* PJS: use HLT instruction, rather than busy wait */
|
/* PJS: use HLT instruction, rather than busy wait */
|
||||||
__asm__("hlt\n\t");
|
__asm__("hlt\n\t");
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
for(;;);
|
for(;;);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID STDCALL
|
VOID STDCALL
|
||||||
KeBugCheck (ULONG BugCheckCode)
|
KeBugCheck(ULONG BugCheckCode)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Brings the system down in a controlled manner when an
|
* FUNCTION: Brings the system down in a controlled manner when an
|
||||||
* inconsistency that might otherwise cause corruption has been detected
|
* inconsistency that might otherwise cause corruption has been detected
|
||||||
|
@ -128,35 +161,7 @@ KeBugCheck (ULONG BugCheckCode)
|
||||||
* RETURNS: Doesn't
|
* RETURNS: Doesn't
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
__asm__("cli\n\t");
|
KeBugCheckEx(BugCheckCode, 0, 0, 0, 0);
|
||||||
DbgPrint("Bug detected (code %x)\n", BugCheckCode);
|
|
||||||
if (InBugCheck == 1)
|
|
||||||
{
|
|
||||||
DbgPrint("Recursive bug check halting now\n");
|
|
||||||
for(;;);
|
|
||||||
}
|
|
||||||
InBugCheck = 1;
|
|
||||||
if (PsGetCurrentProcess() != NULL)
|
|
||||||
{
|
|
||||||
DbgPrint("Pid: %x <", PsGetCurrentProcess()->UniqueProcessId);
|
|
||||||
DbgPrint("%.8s> ", PsGetCurrentProcess()->ImageFileName);
|
|
||||||
}
|
|
||||||
if (PsGetCurrentThread() != NULL)
|
|
||||||
{
|
|
||||||
DbgPrint("Thrd: %x Tid: %x\n",
|
|
||||||
PsGetCurrentThread(),
|
|
||||||
PsGetCurrentThread()->Cid.UniqueThread);
|
|
||||||
}
|
|
||||||
// PsDumpThreads();
|
|
||||||
KeDumpStackFrames((PULONG)__builtin_frame_address(0));
|
|
||||||
#if 1
|
|
||||||
for(;;)
|
|
||||||
{
|
|
||||||
__asm__("hlt\n\t");
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
for(;;);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
Loading…
Reference in a new issue