aboutsummaryrefslogtreecommitdiff
path: root/sys/sparc64/sparc64/trap.c
diff options
context:
space:
mode:
authorMarius Strobl <marius@FreeBSD.org>2012-03-31 13:56:24 +0000
committerMarius Strobl <marius@FreeBSD.org>2012-03-31 13:56:24 +0000
commit2cc35382453df5446a6e40dfe37c788118ef7960 (patch)
tree0663e519505f9d0f4dc2a6db9f5cc7e5d2dc0c37 /sys/sparc64/sparc64/trap.c
parent71c8e5f440afd42537ff9f85207854bb65eff3ec (diff)
downloadsrc-2cc35382453df5446a6e40dfe37c788118ef7960.tar.gz
src-2cc35382453df5446a6e40dfe37c788118ef7960.zip
Fix panic on kernel traps having a mapping in trap_sig b0rked in r206086.
Repored by: David E. Cross MFC after: 3 days
Notes
Notes: svn path=/head/; revision=233747
Diffstat (limited to 'sys/sparc64/sparc64/trap.c')
-rw-r--r--sys/sparc64/sparc64/trap.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/sparc64/sparc64/trap.c b/sys/sparc64/sparc64/trap.c
index 7037e462ad0e..93ebcfad7d75 100644
--- a/sys/sparc64/sparc64/trap.c
+++ b/sys/sparc64/sparc64/trap.c
@@ -215,6 +215,9 @@ static const int trap_sig[] = {
-1, /* kernel stack fault */
};
+CTASSERT(sizeof(trap_msg) / sizeof(*trap_msg) == T_MAX);
+CTASSERT(sizeof(trap_sig) / sizeof(*trap_sig) == T_MAX);
+
CTASSERT(sizeof(struct trapframe) == 256);
int debugger_on_signal = 0;
@@ -298,7 +301,7 @@ trap(struct trapframe *tf)
sig = trap_cecc();
break;
default:
- if (tf->tf_type < 0 || tf->tf_type >= T_MAX)
+ if (tf->tf_type < 0 || tf->tf_type > T_MAX)
panic("trap: bad trap type %#lx (user)",
tf->tf_type);
else if (trap_sig[tf->tf_type] == -1)
@@ -402,12 +405,10 @@ trap(struct trapframe *tf)
if (error != 0) {
tf->tf_type &= ~T_KERNEL;
- if (tf->tf_type < 0 || tf->tf_type >= T_MAX)
+ if (tf->tf_type < 0 || tf->tf_type > T_MAX)
panic("trap: bad trap type %#lx (kernel)",
tf->tf_type);
- else if (trap_sig[tf->tf_type] == -1)
- panic("trap: %s (kernel)",
- trap_msg[tf->tf_type]);
+ panic("trap: %s (kernel)", trap_msg[tf->tf_type]);
}
}
CTR1(KTR_TRAP, "trap: td=%p return", td);