From e1ea0a67e36ee6d6902dc21a0bf087f03c7d35b9 Mon Sep 17 00:00:00 2001 From: jhb Date: Fri, 18 Nov 2005 19:26:46 +0000 Subject: [PATCH] - Always print the trap number so that we have something to start with for mystery traps. If we don't have a message for a given trap, just use UNKNOWN for the message. - Add trap messages for T_XMMFLT and T_RESERVED. MFC after: 1 week --- sys/amd64/amd64/trap.c | 13 +++++++++---- sys/i386/i386/trap.c | 15 ++++++++++----- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index 173ee2c5f52f..09fd4fc0afbe 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -100,7 +100,7 @@ static int trap_pfault(struct trapframe *, int); static void trap_fatal(struct trapframe *, vm_offset_t); void dblfault_handler(void); -#define MAX_TRAP_MSG 28 +#define MAX_TRAP_MSG 30 static char *trap_msg[] = { "", /* 0 unused */ "privileged instruction fault", /* 1 T_PRIVINFLT */ @@ -131,6 +131,8 @@ static char *trap_msg[] = { "segment not present fault", /* 26 T_SEGNPFLT */ "stack fault", /* 27 T_STKFLT */ "machine check trap", /* 28 T_MCHK */ + "SIMD floating-point exception", /* 29 T_XMMFLT */ + "reserved (unknown) fault", /* 30 T_RESERVED */ }; #ifdef KDB @@ -609,15 +611,18 @@ trap_fatal(frame, eva) int code, type, ss; long esp; struct soft_segment_descriptor softseg; + char *msg; code = frame->tf_err; type = frame->tf_trapno; sdtossd(&gdt[IDXSEL(frame->tf_cs & 0xffff)], &softseg); if (type <= MAX_TRAP_MSG) - printf("\n\nFatal trap %d: %s while in %s mode\n", - type, trap_msg[type], - ISPL(frame->tf_cs) == SEL_UPL ? "user" : "kernel"); + msg = trap_msg[type]; + else + msg = "UNKNOWN"; + printf("\n\nFatal trap %d: %s while in %s mode\n", type, msg, + ISPL(frame->tf_cs) == SEL_UPL ? "user" : "kernel"); #ifdef SMP /* two separate prints in case of a trap on an unmapped page */ printf("cpuid = %d; ", PCPU_GET(cpuid)); diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c index acd02e9fbe7f..c6945af039e0 100644 --- a/sys/i386/i386/trap.c +++ b/sys/i386/i386/trap.c @@ -110,7 +110,7 @@ void dblfault_handler(void); extern inthand_t IDTVEC(lcall_syscall); -#define MAX_TRAP_MSG 28 +#define MAX_TRAP_MSG 30 static char *trap_msg[] = { "", /* 0 unused */ "privileged instruction fault", /* 1 T_PRIVINFLT */ @@ -141,6 +141,8 @@ static char *trap_msg[] = { "segment not present fault", /* 26 T_SEGNPFLT */ "stack fault", /* 27 T_STKFLT */ "machine check trap", /* 28 T_MCHK */ + "SIMD floating-point exception", /* 29 T_XMMFLT */ + "reserved (unknown) fault", /* 30 T_RESERVED */ }; #if defined(I586_CPU) && !defined(NO_F00F_HACK) @@ -782,16 +784,19 @@ trap_fatal(frame, eva) { int code, type, ss, esp; struct soft_segment_descriptor softseg; + char *msg; code = frame->tf_err; type = frame->tf_trapno; sdtossd(&gdt[IDXSEL(frame->tf_cs & 0xffff)].sd, &softseg); if (type <= MAX_TRAP_MSG) - printf("\n\nFatal trap %d: %s while in %s mode\n", - type, trap_msg[type], - frame->tf_eflags & PSL_VM ? "vm86" : - ISPL(frame->tf_cs) == SEL_UPL ? "user" : "kernel"); + msg = trap_msg[type]; + else + msg = "UNKNOWN"; + printf("\n\nFatal trap %d: %s while in %s mode\n", type, msg, + frame->tf_eflags & PSL_VM ? "vm86" : + ISPL(frame->tf_cs) == SEL_UPL ? "user" : "kernel"); #ifdef SMP /* two separate prints in case of a trap on an unmapped page */ printf("cpuid = %d; ", PCPU_GET(cpuid));