git: 01a33b2af534 - main - x86: print trap name in addition of trap number

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Wed, 24 Aug 2022 19:25:16 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=01a33b2af534445ef4d417175dc77a27d7575a76

commit 01a33b2af534445ef4d417175dc77a27d7575a76
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-08-21 01:46:13 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-08-24 19:12:37 +0000

    x86: print trap name in addition of trap number
    
    for the "trap with interrupts disabled" warning.
    
    Reviewed by:    jhb
    Tested by:      pho
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D36302
---
 sys/amd64/amd64/trap.c | 6 ++++--
 sys/i386/i386/trap.c   | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c
index df26797ca129..42fb19819111 100644
--- a/sys/amd64/amd64/trap.c
+++ b/sys/amd64/amd64/trap.c
@@ -277,8 +277,10 @@ trap(struct trapframe *frame)
 		 */
 		if (TRAPF_USERMODE(frame)) {
 			uprintf(
-			    "pid %ld (%s): trap %d with interrupts disabled\n",
-			    (long)curproc->p_pid, curthread->td_name, type);
+			    "pid %ld (%s): trap %d (%s) "
+			    "with interrupts disabled\n",
+			    (long)curproc->p_pid, curthread->td_name, type,
+			    trap_msg[type]);
 		} else {
 			switch (type) {
 			case T_NMI:
diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c
index 8765bebfd5b9..5a247a36d2e9 100644
--- a/sys/i386/i386/trap.c
+++ b/sys/i386/i386/trap.c
@@ -283,8 +283,10 @@ trap(struct trapframe *frame)
 	 */
 	if ((frame->tf_eflags & PSL_I) == 0 && TRAPF_USERMODE(frame) &&
 	    (curpcb->pcb_flags & PCB_VM86CALL) == 0)
-		uprintf("pid %ld (%s): trap %d with interrupts disabled\n",
-		    (long)curproc->p_pid, curthread->td_name, type);
+		uprintf("pid %ld (%s): usermode trap %d (%s) with "
+		    "interrupts disabled\n",
+		    (long)curproc->p_pid, curthread->td_name, type,
+		    trap_data[type].msg);
 
 	/*
 	 * Conditionally reenable interrupts.  If we hold a spin lock,