git: d96dc612b363 - stable/13 - x86: print trap name in addition of trap number

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

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

commit d96dc612b363f2407a0153faa989b4d7f1803a42
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-08-21 01:46:13 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-08-31 01:20:28 +0000

    x86: print trap name in addition of trap number
    
    (cherry picked from commit 01a33b2af534445ef4d417175dc77a27d7575a76)
---
 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 271191b785d2..6b4f7df9d174 100644
--- a/sys/amd64/amd64/trap.c
+++ b/sys/amd64/amd64/trap.c
@@ -275,8 +275,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 c158ed1d0264..271ef2c3118f 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,