Module Name:    src
Committed By:   martin
Date:           Fri Sep 20 11:08:25 UTC 2024

Modified Files:
        src/sys/arch/x86/x86 [netbsd-10]: fpu.c

Log Message:
Pull up following revision(s) (requested by rin in ticket #890):

        sys/arch/x86/x86/fpu.c: revision 1.87

x86/fpu: In kernel mode fpu traps, print the instruction pointer.


To generate a diff of this commit:
cvs rdiff -u -r1.79.4.3 -r1.79.4.4 src/sys/arch/x86/x86/fpu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/x86/fpu.c
diff -u src/sys/arch/x86/x86/fpu.c:1.79.4.3 src/sys/arch/x86/x86/fpu.c:1.79.4.4
--- src/sys/arch/x86/x86/fpu.c:1.79.4.3	Thu Jun 20 11:02:16 2024
+++ src/sys/arch/x86/x86/fpu.c	Fri Sep 20 11:08:25 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.c,v 1.79.4.3 2024/06/20 11:02:16 martin Exp $	*/
+/*	$NetBSD: fpu.c,v 1.79.4.4 2024/09/20 11:08:25 martin Exp $	*/
 
 /*
  * Copyright (c) 2008, 2019 The NetBSD Foundation, Inc.  All
@@ -96,8 +96,9 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.79.4.3 2024/06/20 11:02:16 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.79.4.4 2024/09/20 11:08:25 martin Exp $");
 
+#include "opt_ddb.h"
 #include "opt_multiprocessor.h"
 
 #include <sys/param.h>
@@ -121,6 +122,10 @@ __KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.79
 #include <x86/cpu.h>
 #include <x86/fpu.h>
 
+#ifdef DDB
+#include <ddb/ddb.h>
+#endif
+
 #ifdef XENPV
 #define clts() HYPERVISOR_fpu_taskswitch(0)
 #define stts() HYPERVISOR_fpu_taskswitch(1)
@@ -560,7 +565,16 @@ fputrap(struct trapframe *frame)
 	ksiginfo_t ksi;
 
 	if (__predict_false(!USERMODE(frame->tf_cs))) {
-		panic("fpu trap from kernel, trapframe %p\n", frame);
+		register_t ip = X86_TF_RIP(frame);
+		char where[128];
+
+#ifdef DDB
+		db_symstr(where, sizeof(where), (db_expr_t)ip, DB_STGY_PROC);
+#else
+		snprintf(where, sizeof(where), "%p", (void *)ip);
+#endif
+		panic("fpu trap from kernel at %s, trapframe %p\n", where,
+		    frame);
 	}
 
 	KASSERT(curlwp->l_md.md_flags & MDL_FPU_IN_CPU);

Reply via email to