mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 16:23:01 +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
|
@ -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,7 +110,7 @@ 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",
|
||||||
|
@ -121,7 +126,7 @@ i386PrintExceptionText(ULONG TrapIndex, PKTRAP_FRAME TrapFrame, PKSPECIAL_REGIST
|
||||||
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",
|
||||||
|
@ -132,4 +137,69 @@ i386PrintExceptionText(ULONG TrapIndex, PKTRAP_FRAME TrapFrame, PKSPECIAL_REGIST
|
||||||
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