git: 49c6968c1217 - stable/13 - i386: print all GPRs, PSL, and CR3 on double fault

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Wed, 31 Aug 2022 01:32:16 UTC
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=49c6968c1217dbc6233105a918f07cae8dbdac52

commit 49c6968c1217dbc6233105a918f07cae8dbdac52
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-08-18 04:16:09 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-08-31 01:20:27 +0000

    i386: print all GPRs, PSL, and CR3 on double fault
    
    (cherry picked from commit 0f906b30e6fa5bed3c8468a6cab3847cf6909936)
---
 sys/i386/i386/trap.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c
index 7e1c409c806f..c158ed1d0264 100644
--- a/sys/i386/i386/trap.c
+++ b/sys/i386/i386/trap.c
@@ -988,18 +988,26 @@ trap_user_dtrace(struct trapframe *frame, int (**hookp)(struct trapframe *))
 void
 dblfault_handler(void)
 {
+	struct i386tss *t;
+
 #ifdef KDTRACE_HOOKS
 	if (dtrace_doubletrap_func != NULL)
 		(*dtrace_doubletrap_func)();
 #endif
 	printf("\nFatal double fault:\n");
-	printf("eip = 0x%x\n", PCPU_GET(common_tssp)->tss_eip);
-	printf("esp = 0x%x\n", PCPU_GET(common_tssp)->tss_esp);
-	printf("ebp = 0x%x\n", PCPU_GET(common_tssp)->tss_ebp);
+	t = PCPU_GET(common_tssp);
+	printf(
+	    "eip = %#08x esp = %#08x ebp = %#08x eax = %#08x\n"
+	    "edx = %#08x ecx = %#08x edi = %#08x esi = %#08x\n"
+	    "psl = %#08x cs  = %#08x ss  = %#08x ds  = %#08x\n"
+	    "es  = %#08x fs  = %#08x gs  = %#08x cr3 = %#08x\n",
+	    t->tss_eip, t->tss_esp, t->tss_ebp, t->tss_eax,
+	    t->tss_edx, t->tss_ecx, t->tss_edi, t->tss_esi,
+	    t->tss_eflags, t->tss_cs, t->tss_ss, t->tss_ds,
+	    t->tss_es, t->tss_fs, t->tss_gs, t->tss_cr3);
 #ifdef SMP
-	/* two separate prints in case of a trap on an unmapped page */
-	printf("cpuid = %d; ", PCPU_GET(cpuid));
-	printf("apic id = %02x\n", PCPU_GET(apic_id));
+	printf("cpuid = %d; apic id = %02x\n", PCPU_GET(cpuid),
+	    PCPU_GET(apic_id));
 #endif
 	panic("double fault");
 }