aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68knommu
diff options
context:
space:
mode:
authorGreg Ungerer <gerg@uclinux.org>2010-10-07 03:16:56 -0400
committerGreg Ungerer <gerg@uclinux.org>2010-10-20 20:17:31 -0400
commit730251f27df1ed0177609d1e49817f0c3ada0b1a (patch)
tree9ffee6982b122cb40d9e39722ee1ec8775a7bbba /arch/m68knommu
parentdea2aff876c004cccf29549242c93b208787aa64 (diff)
m68knommu: mask of vector bits in exception word properly
The vector field of the processors exception frame actually contains both the vector exception number and fault status field bits. The exception processing code was not correctly masking out the fault status field bits before switching on the vector number. The default case was catching the bad check, but we are reporting the wrong kind of exception in some cases. Reported-by: Alexander Stein <alexander.stein@systec-electronic.com> Signed-off-by: Greg Ungerer <gerg@uclinux.org>
Diffstat (limited to 'arch/m68knommu')
-rw-r--r--arch/m68knommu/kernel/traps.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/arch/m68knommu/kernel/traps.c b/arch/m68knommu/kernel/traps.c
index e8b813d2d0e..a768008dfd0 100644
--- a/arch/m68knommu/kernel/traps.c
+++ b/arch/m68knommu/kernel/traps.c
@@ -179,14 +179,16 @@ static void __show_stack(struct task_struct *task, unsigned long *stack)
179 179
180void bad_super_trap(struct frame *fp) 180void bad_super_trap(struct frame *fp)
181{ 181{
182 int vector = (fp->ptregs.vector >> 2) & 0xff;
183
182 console_verbose(); 184 console_verbose();
183 if (fp->ptregs.vector < 4 * ARRAY_SIZE(vec_names)) 185 if (vector < ARRAY_SIZE(vec_names))
184 printk (KERN_WARNING "*** %s *** FORMAT=%X\n", 186 printk (KERN_WARNING "*** %s *** FORMAT=%X\n",
185 vec_names[(fp->ptregs.vector) >> 2], 187 vec_names[vector],
186 fp->ptregs.format); 188 fp->ptregs.format);
187 else 189 else
188 printk (KERN_WARNING "*** Exception %d *** FORMAT=%X\n", 190 printk (KERN_WARNING "*** Exception %d *** FORMAT=%X\n",
189 (fp->ptregs.vector) >> 2, 191 vector,
190 fp->ptregs.format); 192 fp->ptregs.format);
191 printk (KERN_WARNING "Current process id is %d\n", current->pid); 193 printk (KERN_WARNING "Current process id is %d\n", current->pid);
192 die_if_kernel("BAD KERNEL TRAP", &fp->ptregs, 0); 194 die_if_kernel("BAD KERNEL TRAP", &fp->ptregs, 0);
@@ -195,10 +197,11 @@ void bad_super_trap(struct frame *fp)
195asmlinkage void trap_c(struct frame *fp) 197asmlinkage void trap_c(struct frame *fp)
196{ 198{
197 int sig; 199 int sig;
200 int vector = (fp->ptregs.vector >> 2) & 0xff;
198 siginfo_t info; 201 siginfo_t info;
199 202
200 if (fp->ptregs.sr & PS_S) { 203 if (fp->ptregs.sr & PS_S) {
201 if ((fp->ptregs.vector >> 2) == VEC_TRACE) { 204 if (vector == VEC_TRACE) {
202 /* traced a trapping instruction */ 205 /* traced a trapping instruction */
203 } else 206 } else
204 bad_super_trap(fp); 207 bad_super_trap(fp);
@@ -206,7 +209,7 @@ asmlinkage void trap_c(struct frame *fp)
206 } 209 }
207 210
208 /* send the appropriate signal to the user program */ 211 /* send the appropriate signal to the user program */
209 switch ((fp->ptregs.vector) >> 2) { 212 switch (vector) {
210 case VEC_ADDRERR: 213 case VEC_ADDRERR:
211 info.si_code = BUS_ADRALN; 214 info.si_code = BUS_ADRALN;
212 sig = SIGBUS; 215 sig = SIGBUS;