Print whole machine state on double fault.

It is quite useful when double fault is not caused by a stack overflow.

Tested by:	pho (as part of the larger patch)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2017-08-14 11:23:07 +00:00
parent 0fd7ea1f21
commit baec5778ed

View File

@ -822,10 +822,24 @@ dblfault_handler(struct trapframe *frame)
if (dtrace_doubletrap_func != NULL) if (dtrace_doubletrap_func != NULL)
(*dtrace_doubletrap_func)(); (*dtrace_doubletrap_func)();
#endif #endif
printf("\nFatal double fault\n"); printf("\nFatal double fault\n"
printf("rip = 0x%lx\n", frame->tf_rip); "rip %#lx rsp %#lx rbp %#lx\n"
printf("rsp = 0x%lx\n", frame->tf_rsp); "rax %#lx rdx %#lx rbx %#lx\n"
printf("rbp = 0x%lx\n", frame->tf_rbp); "rcx %#lx rsi %#lx rdi %#lx\n"
"r8 %#lx r9 %#lx r10 %#lx\n"
"r11 %#lx r12 %#lx r13 %#lx\n"
"r14 %#lx r15 %#lx rflags %#lx\n"
"cs %#lx ss %#lx ds %#hx es %#hx fs %#hx gs %#hx\n"
"fsbase %#lx gsbase %#lx kgsbase %#lx\n",
frame->tf_rip, frame->tf_rsp, frame->tf_rbp,
frame->tf_rax, frame->tf_rdx, frame->tf_rbx,
frame->tf_rcx, frame->tf_rdi, frame->tf_rsi,
frame->tf_r8, frame->tf_r9, frame->tf_r10,
frame->tf_r11, frame->tf_r12, frame->tf_r13,
frame->tf_r14, frame->tf_r15, frame->tf_rflags,
frame->tf_cs, frame->tf_ss, frame->tf_ds, frame->tf_es,
frame->tf_fs, frame->tf_gs,
rdmsr(MSR_FSBASE), rdmsr(MSR_GSBASE), rdmsr(MSR_KGSBASE));
#ifdef SMP #ifdef SMP
/* two separate prints in case of a trap on an unmapped page */ /* two separate prints in case of a trap on an unmapped page */
printf("cpuid = %d; ", PCPU_GET(cpuid)); printf("cpuid = %d; ", PCPU_GET(cpuid));