mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 19:52:56 +00:00
[FREELDR]
Add code to dump amd64 cpu state. Add a bugcheck function. svn path=/trunk/; revision=56851
This commit is contained in:
parent
87f0a30cfe
commit
9b9afa4558
1 changed files with 88 additions and 18 deletions
|
@ -51,7 +51,7 @@ i386PrintText(char *pszText)
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
chr = *pszText++;
|
chr = *pszText++;
|
||||||
|
|
||||||
if (chr == 0) break;
|
if (chr == 0) break;
|
||||||
if (chr == '\n')
|
if (chr == '\n')
|
||||||
{
|
{
|
||||||
|
@ -59,7 +59,7 @@ i386PrintText(char *pszText)
|
||||||
i386_ScreenPosX = 0;
|
i386_ScreenPosX = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
MachVideoPutChar(chr, SCREEN_ATTR, i386_ScreenPosX, i386_ScreenPosY);
|
MachVideoPutChar(chr, SCREEN_ATTR, i386_ScreenPosX, i386_ScreenPosY);
|
||||||
i386_ScreenPosX++;
|
i386_ScreenPosX++;
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ PrintText(const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list argptr;
|
va_list argptr;
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
|
|
||||||
va_start(argptr, format);
|
va_start(argptr, format);
|
||||||
_vsnprintf(buffer, sizeof(buffer), format, argptr);
|
_vsnprintf(buffer, sizeof(buffer), format, argptr);
|
||||||
buffer[sizeof(buffer) - 1] = 0;
|
buffer[sizeof(buffer) - 1] = 0;
|
||||||
|
@ -84,10 +84,15 @@ i386PrintFrames(PKTRAP_FRAME TrapFrame)
|
||||||
FRAME *Frame;
|
FRAME *Frame;
|
||||||
|
|
||||||
PrintText("Frames:\n");
|
PrintText("Frames:\n");
|
||||||
|
#ifdef _M_IX86
|
||||||
for (Frame = (FRAME*)TrapFrame->Ebp;
|
for (Frame = (FRAME*)TrapFrame->Ebp;
|
||||||
Frame != 0 && (ULONG_PTR)Frame < STACK32ADDR;
|
Frame != 0 && (ULONG_PTR)Frame < STACK32ADDR;
|
||||||
Frame = Frame->Next)
|
Frame = Frame->Next)
|
||||||
|
#else
|
||||||
|
for (Frame = (FRAME*)TrapFrame->TrapFrame;
|
||||||
|
Frame != 0 && (ULONG_PTR)Frame < STACK32ADDR;
|
||||||
|
Frame = Frame->Next)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
PrintText("%p ", Frame->Address);
|
PrintText("%p ", Frame->Address);
|
||||||
}
|
}
|
||||||
|
@ -105,31 +110,96 @@ i386PrintExceptionText(ULONG TrapIndex, PKTRAP_FRAME TrapFrame, PKSPECIAL_REGIST
|
||||||
VERSION"\n"
|
VERSION"\n"
|
||||||
"Report this error to the ReactOS Development mailing list <ros-dev@reactos.org>\n\n"
|
"Report this error to the ReactOS Development mailing list <ros-dev@reactos.org>\n\n"
|
||||||
"%s\n", i386ExceptionDescriptionText[TrapIndex]);
|
"%s\n", i386ExceptionDescriptionText[TrapIndex]);
|
||||||
|
#ifdef _M_IX86
|
||||||
PrintText("EAX: %.8lx ESP: %.8lx CR0: %.8lx DR0: %.8lx\n",
|
PrintText("EAX: %.8lx ESP: %.8lx CR0: %.8lx DR0: %.8lx\n",
|
||||||
TrapFrame->Eax, TrapFrame->HardwareEsp, Special->Cr0, TrapFrame->Dr0);
|
TrapFrame->Eax, TrapFrame->HardwareEsp, Special->Cr0, TrapFrame->Dr0);
|
||||||
PrintText("EBX: %.8lx EBP: %.8lx CR1: ???????? DR1: %.8lx\n",
|
PrintText("EBX: %.8lx EBP: %.8lx CR1: ???????? DR1: %.8lx\n",
|
||||||
TrapFrame->Ebx, TrapFrame->Ebp, TrapFrame->Dr1);
|
TrapFrame->Ebx, TrapFrame->Ebp, TrapFrame->Dr1);
|
||||||
PrintText("ECX: %.8lx ESI: %.8lx CR2: %.8lx DR2: %.8lx\n",
|
PrintText("ECX: %.8lx ESI: %.8lx CR2: %.8lx DR2: %.8lx\n",
|
||||||
TrapFrame->Ecx, TrapFrame->Esi, Special->Cr2, TrapFrame->Dr2);
|
TrapFrame->Ecx, TrapFrame->Esi, Special->Cr2, TrapFrame->Dr2);
|
||||||
PrintText("EDX: %.8lx EDI: %.8lx CR3: %.8lx DR3: %.8lx\n",
|
PrintText("EDX: %.8lx EDI: %.8lx CR3: %.8lx DR3: %.8lx\n",
|
||||||
TrapFrame->Edx, TrapFrame->Edi, Special->Cr3, TrapFrame->Dr3);
|
TrapFrame->Edx, TrapFrame->Edi, Special->Cr3, TrapFrame->Dr3);
|
||||||
PrintText(" DR6: %.8lx\n",
|
PrintText(" DR6: %.8lx\n",
|
||||||
TrapFrame->Dr6);
|
TrapFrame->Dr6);
|
||||||
PrintText(" DR7: %.8lx\n\n",
|
PrintText(" DR7: %.8lx\n\n",
|
||||||
TrapFrame->Dr7);
|
TrapFrame->Dr7);
|
||||||
PrintText("CS: %.4lx EIP: %.8lx\n",
|
PrintText("CS: %.4lx EIP: %.8lx\n",
|
||||||
TrapFrame->SegCs, TrapFrame->Eip);
|
TrapFrame->SegCs, TrapFrame->Eip);
|
||||||
PrintText("DS: %.4lx ERROR CODE: %.8lx\n",
|
PrintText("DS: %.4lx ERROR CODE: %.8lx\n",
|
||||||
TrapFrame->SegDs, TrapFrame->Eip);
|
TrapFrame->SegDs, TrapFrame->ErrCode);
|
||||||
PrintText("ES: %.4lx EFLAGS: %.8lx\n",
|
PrintText("ES: %.4lx EFLAGS: %.8lx\n",
|
||||||
TrapFrame->SegEs, TrapFrame->EFlags);
|
TrapFrame->SegEs, TrapFrame->EFlags);
|
||||||
PrintText("FS: %.4lx GDTR Base: %.8lx Limit: %.4x\n",
|
PrintText("FS: %.4lx GDTR Base: %.8lx Limit: %.4x\n",
|
||||||
TrapFrame->SegFs, Special->Gdtr.Base, Special->Gdtr.Limit);
|
TrapFrame->SegFs, Special->Gdtr.Base, Special->Gdtr.Limit);
|
||||||
PrintText("GS: %.4lx IDTR Base: %.8lx Limit: %.4x\n",
|
PrintText("GS: %.4lx IDTR Base: %.8lx Limit: %.4x\n",
|
||||||
TrapFrame->SegGs, Special->Idtr.Base, Special->Idtr.Limit);
|
TrapFrame->SegGs, Special->Idtr.Base, Special->Idtr.Limit);
|
||||||
PrintText("SS: %.4lx LDTR: %.4lx TR: %.4lx\n\n",
|
PrintText("SS: %.4lx LDTR: %.4lx TR: %.4lx\n\n",
|
||||||
TrapFrame->HardwareSegSs, Special->Ldtr, Special->Idtr.Limit);
|
TrapFrame->HardwareSegSs, Special->Ldtr, Special->Idtr.Limit);
|
||||||
|
|
||||||
i386PrintFrames(TrapFrame); // Display frames
|
i386PrintFrames(TrapFrame); // Display frames
|
||||||
|
#else
|
||||||
|
PrintText("RAX: %.8lx R8: %.8lx R12: %.8lx RSI: %.8lx\n",
|
||||||
|
TrapFrame->Rax, TrapFrame->R8, 0, TrapFrame->Rsi);
|
||||||
|
PrintText("RBX: %.8lx R9: %.8lx R13: %.8lx RDI: %.8lx\n",
|
||||||
|
TrapFrame->Rbx, TrapFrame->R9, 0, TrapFrame->Rdi);
|
||||||
|
PrintText("RCX: %.8lx R10: %.8lx R14: %.8lx RBP: %.8lx\n",
|
||||||
|
TrapFrame->Rcx, TrapFrame->R10, 0, TrapFrame->Rbp);
|
||||||
|
PrintText("RDX: %.8lx R11: %.8lx R15: %.8lx RSP: %.8lx\n",
|
||||||
|
TrapFrame->Rdx, TrapFrame->R11, 0, TrapFrame->Rsp);
|
||||||
|
|
||||||
|
PrintText("CS: %.4lx RIP: %.8lx\n",
|
||||||
|
TrapFrame->SegCs, TrapFrame->Rip);
|
||||||
|
PrintText("DS: %.4lx ERROR CODE: %.8lx\n",
|
||||||
|
TrapFrame->SegDs, TrapFrame->ErrorCode);
|
||||||
|
PrintText("ES: %.4lx EFLAGS: %.8lx\n",
|
||||||
|
TrapFrame->SegEs, TrapFrame->EFlags);
|
||||||
|
PrintText("FS: %.4lx GDTR Base: %.8lx Limit: %.4x\n",
|
||||||
|
TrapFrame->SegFs, Special->Gdtr.Base, Special->Gdtr.Limit);
|
||||||
|
PrintText("GS: %.4lx IDTR Base: %.8lx Limit: %.4x\n",
|
||||||
|
TrapFrame->SegGs, Special->Idtr.Base, Special->Idtr.Limit);
|
||||||
|
PrintText("SS: %.4lx LDTR: %.4lx TR: %.4lx\n\n",
|
||||||
|
TrapFrame->SegSs, Special->Ldtr, Special->Idtr.Limit);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *BugCodeStrings[] =
|
||||||
|
{
|
||||||
|
"TEST_BUGCHECK",
|
||||||
|
"MISSING_HARDWARE_REQUIREMENTS",
|
||||||
|
};
|
||||||
|
|
||||||
|
ULONG_PTR BugCheckInfo[5];
|
||||||
|
|
||||||
|
void
|
||||||
|
NTAPI
|
||||||
|
FrLdrBugCheckEx(
|
||||||
|
ULONG BugCode,
|
||||||
|
PCHAR File,
|
||||||
|
ULONG Line)
|
||||||
|
{
|
||||||
|
MachVideoClearScreen(SCREEN_ATTR);
|
||||||
|
i386_ScreenPosX = 0;
|
||||||
|
i386_ScreenPosY = 0;
|
||||||
|
|
||||||
|
PrintText("A problem has been detected and FreeLoader boot has been aborted.\n\n");
|
||||||
|
|
||||||
|
PrintText("%ld: %s\n\n", BugCode, BugCodeStrings[BugCode]);
|
||||||
|
|
||||||
|
if (File)
|
||||||
|
{
|
||||||
|
PrintText("Location: %s:%ld\n\n", File, Line);
|
||||||
|
}
|
||||||
|
|
||||||
|
PrintText("Bug Information:\n %p\n %p\n %p\n %p\n %p\n\n",
|
||||||
|
BugCheckInfo[0], BugCheckInfo[1], BugCheckInfo[2], BugCheckInfo[3], BugCheckInfo[4]);
|
||||||
|
|
||||||
|
for (;;);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
NTAPI
|
||||||
|
FrLdrBugCheck(ULONG BugCode)
|
||||||
|
{
|
||||||
|
FrLdrBugCheckEx(BugCode, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue