aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68k
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert@linux-m68k.org>2013-12-10 05:38:34 -0500
committerGeert Uytterhoeven <geert@linux-m68k.org>2013-12-30 15:01:11 -0500
commit245b815c3faf4a0509948618c35f993160e193a9 (patch)
tree95453db99492c27f461fa6735807d1ff8d752827 /arch/m68k
parent8e398f638179d5968df41ad8eff8f27684454dc4 (diff)
m68k: Convert arch/m68k/kernel/traps.c to pr_*()
Also fix a few printf-style formats, to get rid of the following compiler warnings when DEBUG is enabled: arch/m68k/kernel/traps.c: In function ‘access_error060’: arch/m68k/kernel/traps.c:166: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long unsigned int’ arch/m68k/kernel/traps.c: In function ‘bus_error030’: arch/m68k/kernel/traps.c:568: warning: format ‘%#lx’ expects type ‘long unsigned int’, but argument 2 has type ‘void *’ arch/m68k/kernel/traps.c:682: warning: format ‘%#lx’ expects type ‘long unsigned int’, but argument 2 has type ‘void *’ Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Diffstat (limited to 'arch/m68k')
-rw-r--r--arch/m68k/kernel/traps.c232
1 files changed, 101 insertions, 131 deletions
diff --git a/arch/m68k/kernel/traps.c b/arch/m68k/kernel/traps.c
index 88fcd8c70e7b..6c9ca24830e9 100644
--- a/arch/m68k/kernel/traps.c
+++ b/arch/m68k/kernel/traps.c
@@ -133,9 +133,7 @@ static inline void access_error060 (struct frame *fp)
133{ 133{
134 unsigned long fslw = fp->un.fmt4.pc; /* is really FSLW for access error */ 134 unsigned long fslw = fp->un.fmt4.pc; /* is really FSLW for access error */
135 135
136#ifdef DEBUG 136 pr_debug("fslw=%#lx, fa=%#lx\n", fslw, fp->un.fmt4.effaddr);
137 printk("fslw=%#lx, fa=%#lx\n", fslw, fp->un.fmt4.effaddr);
138#endif
139 137
140 if (fslw & MMU060_BPE) { 138 if (fslw & MMU060_BPE) {
141 /* branch prediction error -> clear branch cache */ 139 /* branch prediction error -> clear branch cache */
@@ -162,9 +160,7 @@ static inline void access_error060 (struct frame *fp)
162 } 160 }
163 if (fslw & MMU060_W) 161 if (fslw & MMU060_W)
164 errorcode |= 2; 162 errorcode |= 2;
165#ifdef DEBUG 163 pr_debug("errorcode = %ld\n", errorcode);
166 printk("errorcode = %d\n", errorcode );
167#endif
168 do_page_fault(&fp->ptregs, addr, errorcode); 164 do_page_fault(&fp->ptregs, addr, errorcode);
169 } else if (fslw & (MMU060_SEE)){ 165 } else if (fslw & (MMU060_SEE)){
170 /* Software Emulation Error. 166 /* Software Emulation Error.
@@ -173,8 +169,9 @@ static inline void access_error060 (struct frame *fp)
173 send_fault_sig(&fp->ptregs); 169 send_fault_sig(&fp->ptregs);
174 } else if (!(fslw & (MMU060_RE|MMU060_WE)) || 170 } else if (!(fslw & (MMU060_RE|MMU060_WE)) ||
175 send_fault_sig(&fp->ptregs) > 0) { 171 send_fault_sig(&fp->ptregs) > 0) {
176 printk("pc=%#lx, fa=%#lx\n", fp->ptregs.pc, fp->un.fmt4.effaddr); 172 pr_err("pc=%#lx, fa=%#lx\n", fp->ptregs.pc,
177 printk( "68060 access error, fslw=%lx\n", fslw ); 173 fp->un.fmt4.effaddr);
174 pr_err("68060 access error, fslw=%lx\n", fslw);
178 trap_c( fp ); 175 trap_c( fp );
179 } 176 }
180} 177}
@@ -225,9 +222,7 @@ static inline int do_040writeback1(unsigned short wbs, unsigned long wba,
225 set_fs(old_fs); 222 set_fs(old_fs);
226 223
227 224
228#ifdef DEBUG 225 pr_debug("do_040writeback1, res=%d\n", res);
229 printk("do_040writeback1, res=%d\n",res);
230#endif
231 226
232 return res; 227 return res;
233} 228}
@@ -249,7 +244,7 @@ static inline void do_040writebacks(struct frame *fp)
249 int res = 0; 244 int res = 0;
250#if 0 245#if 0
251 if (fp->un.fmt7.wb1s & WBV_040) 246 if (fp->un.fmt7.wb1s & WBV_040)
252 printk("access_error040: cannot handle 1st writeback. oops.\n"); 247 pr_err("access_error040: cannot handle 1st writeback. oops.\n");
253#endif 248#endif
254 249
255 if ((fp->un.fmt7.wb2s & WBV_040) && 250 if ((fp->un.fmt7.wb2s & WBV_040) &&
@@ -302,14 +297,12 @@ static inline void access_error040(struct frame *fp)
302 unsigned short ssw = fp->un.fmt7.ssw; 297 unsigned short ssw = fp->un.fmt7.ssw;
303 unsigned long mmusr; 298 unsigned long mmusr;
304 299
305#ifdef DEBUG 300 pr_debug("ssw=%#x, fa=%#lx\n", ssw, fp->un.fmt7.faddr);
306 printk("ssw=%#x, fa=%#lx\n", ssw, fp->un.fmt7.faddr); 301 pr_debug("wb1s=%#x, wb2s=%#x, wb3s=%#x\n", fp->un.fmt7.wb1s,
307 printk("wb1s=%#x, wb2s=%#x, wb3s=%#x\n", fp->un.fmt7.wb1s,
308 fp->un.fmt7.wb2s, fp->un.fmt7.wb3s); 302 fp->un.fmt7.wb2s, fp->un.fmt7.wb3s);
309 printk ("wb2a=%lx, wb3a=%lx, wb2d=%lx, wb3d=%lx\n", 303 pr_debug("wb2a=%lx, wb3a=%lx, wb2d=%lx, wb3d=%lx\n",
310 fp->un.fmt7.wb2a, fp->un.fmt7.wb3a, 304 fp->un.fmt7.wb2a, fp->un.fmt7.wb3a,
311 fp->un.fmt7.wb2d, fp->un.fmt7.wb3d); 305 fp->un.fmt7.wb2d, fp->un.fmt7.wb3d);
312#endif
313 306
314 if (ssw & ATC_040) { 307 if (ssw & ATC_040) {
315 unsigned long addr = fp->un.fmt7.faddr; 308 unsigned long addr = fp->un.fmt7.faddr;
@@ -324,9 +317,7 @@ static inline void access_error040(struct frame *fp)
324 317
325 /* MMU error, get the MMUSR info for this access */ 318 /* MMU error, get the MMUSR info for this access */
326 mmusr = probe040(!(ssw & RW_040), addr, ssw); 319 mmusr = probe040(!(ssw & RW_040), addr, ssw);
327#ifdef DEBUG 320 pr_debug("mmusr = %lx\n", mmusr);
328 printk("mmusr = %lx\n", mmusr);
329#endif
330 errorcode = 1; 321 errorcode = 1;
331 if (!(mmusr & MMU_R_040)) { 322 if (!(mmusr & MMU_R_040)) {
332 /* clear the invalid atc entry */ 323 /* clear the invalid atc entry */
@@ -340,14 +331,10 @@ static inline void access_error040(struct frame *fp)
340 errorcode |= 2; 331 errorcode |= 2;
341 332
342 if (do_page_fault(&fp->ptregs, addr, errorcode)) { 333 if (do_page_fault(&fp->ptregs, addr, errorcode)) {
343#ifdef DEBUG 334 pr_debug("do_page_fault() !=0\n");
344 printk("do_page_fault() !=0\n");
345#endif
346 if (user_mode(&fp->ptregs)){ 335 if (user_mode(&fp->ptregs)){
347 /* delay writebacks after signal delivery */ 336 /* delay writebacks after signal delivery */
348#ifdef DEBUG 337 pr_debug(".. was usermode - return\n");
349 printk(".. was usermode - return\n");
350#endif
351 return; 338 return;
352 } 339 }
353 /* disable writeback into user space from kernel 340 /* disable writeback into user space from kernel
@@ -355,9 +342,7 @@ static inline void access_error040(struct frame *fp)
355 * the writeback won't do good) 342 * the writeback won't do good)
356 */ 343 */
357disable_wb: 344disable_wb:
358#ifdef DEBUG 345 pr_debug(".. disabling wb2\n");
359 printk(".. disabling wb2\n");
360#endif
361 if (fp->un.fmt7.wb2a == fp->un.fmt7.faddr) 346 if (fp->un.fmt7.wb2a == fp->un.fmt7.faddr)
362 fp->un.fmt7.wb2s &= ~WBV_040; 347 fp->un.fmt7.wb2s &= ~WBV_040;
363 if (fp->un.fmt7.wb3a == fp->un.fmt7.faddr) 348 if (fp->un.fmt7.wb3a == fp->un.fmt7.faddr)
@@ -371,7 +356,7 @@ disable_wb:
371 current->thread.signo = SIGBUS; 356 current->thread.signo = SIGBUS;
372 current->thread.faddr = fp->un.fmt7.faddr; 357 current->thread.faddr = fp->un.fmt7.faddr;
373 if (send_fault_sig(&fp->ptregs) >= 0) 358 if (send_fault_sig(&fp->ptregs) >= 0)
374 printk("68040 bus error (ssw=%x, faddr=%lx)\n", ssw, 359 pr_err("68040 bus error (ssw=%x, faddr=%lx)\n", ssw,
375 fp->un.fmt7.faddr); 360 fp->un.fmt7.faddr);
376 goto disable_wb; 361 goto disable_wb;
377 } 362 }
@@ -394,19 +379,17 @@ static inline void bus_error030 (struct frame *fp)
394 unsigned short ssw = fp->un.fmtb.ssw; 379 unsigned short ssw = fp->un.fmtb.ssw;
395 extern unsigned long _sun3_map_test_start, _sun3_map_test_end; 380 extern unsigned long _sun3_map_test_start, _sun3_map_test_end;
396 381
397#ifdef DEBUG
398 if (ssw & (FC | FB)) 382 if (ssw & (FC | FB))
399 printk ("Instruction fault at %#010lx\n", 383 pr_debug("Instruction fault at %#010lx\n",
400 ssw & FC ? 384 ssw & FC ?
401 fp->ptregs.format == 0xa ? fp->ptregs.pc + 2 : fp->un.fmtb.baddr - 2 385 fp->ptregs.format == 0xa ? fp->ptregs.pc + 2 : fp->un.fmtb.baddr - 2
402 : 386 :
403 fp->ptregs.format == 0xa ? fp->ptregs.pc + 4 : fp->un.fmtb.baddr); 387 fp->ptregs.format == 0xa ? fp->ptregs.pc + 4 : fp->un.fmtb.baddr);
404 if (ssw & DF) 388 if (ssw & DF)
405 printk ("Data %s fault at %#010lx in %s (pc=%#lx)\n", 389 pr_debug("Data %s fault at %#010lx in %s (pc=%#lx)\n",
406 ssw & RW ? "read" : "write", 390 ssw & RW ? "read" : "write",
407 fp->un.fmtb.daddr, 391 fp->un.fmtb.daddr,
408 space_names[ssw & DFC], fp->ptregs.pc); 392 space_names[ssw & DFC], fp->ptregs.pc);
409#endif
410 393
411 /* 394 /*
412 * Check if this page should be demand-mapped. This needs to go before 395 * Check if this page should be demand-mapped. This needs to go before
@@ -429,7 +412,7 @@ static inline void bus_error030 (struct frame *fp)
429 return; 412 return;
430 /* instruction fault or kernel data fault! */ 413 /* instruction fault or kernel data fault! */
431 if (ssw & (FC | FB)) 414 if (ssw & (FC | FB))
432 printk ("Instruction fault at %#010lx\n", 415 pr_err("Instruction fault at %#010lx\n",
433 fp->ptregs.pc); 416 fp->ptregs.pc);
434 if (ssw & DF) { 417 if (ssw & DF) {
435 /* was this fault incurred testing bus mappings? */ 418 /* was this fault incurred testing bus mappings? */
@@ -439,12 +422,12 @@ static inline void bus_error030 (struct frame *fp)
439 return; 422 return;
440 } 423 }
441 424
442 printk ("Data %s fault at %#010lx in %s (pc=%#lx)\n", 425 pr_err("Data %s fault at %#010lx in %s (pc=%#lx)\n",
443 ssw & RW ? "read" : "write", 426 ssw & RW ? "read" : "write",
444 fp->un.fmtb.daddr, 427 fp->un.fmtb.daddr,
445 space_names[ssw & DFC], fp->ptregs.pc); 428 space_names[ssw & DFC], fp->ptregs.pc);
446 } 429 }
447 printk ("BAD KERNEL BUSERR\n"); 430 pr_err("BAD KERNEL BUSERR\n");
448 431
449 die_if_kernel("Oops", &fp->ptregs,0); 432 die_if_kernel("Oops", &fp->ptregs,0);
450 force_sig(SIGKILL, current); 433 force_sig(SIGKILL, current);
@@ -473,12 +456,11 @@ static inline void bus_error030 (struct frame *fp)
473 else if (buserr_type & SUN3_BUSERR_INVALID) 456 else if (buserr_type & SUN3_BUSERR_INVALID)
474 errorcode = 0x00; 457 errorcode = 0x00;
475 else { 458 else {
476#ifdef DEBUG 459 pr_debug("*** unexpected busfault type=%#04x\n",
477 printk ("*** unexpected busfault type=%#04x\n", buserr_type); 460 buserr_type);
478 printk ("invalid %s access at %#lx from pc %#lx\n", 461 pr_debug("invalid %s access at %#lx from pc %#lx\n",
479 !(ssw & RW) ? "write" : "read", addr, 462 !(ssw & RW) ? "write" : "read", addr,
480 fp->ptregs.pc); 463 fp->ptregs.pc);
481#endif
482 die_if_kernel ("Oops", &fp->ptregs, buserr_type); 464 die_if_kernel ("Oops", &fp->ptregs, buserr_type);
483 force_sig (SIGBUS, current); 465 force_sig (SIGBUS, current);
484 return; 466 return;
@@ -509,9 +491,7 @@ static inline void bus_error030 (struct frame *fp)
509 if (!mmu_emu_handle_fault(addr, 1, 0)) 491 if (!mmu_emu_handle_fault(addr, 1, 0))
510 do_page_fault (&fp->ptregs, addr, 0); 492 do_page_fault (&fp->ptregs, addr, 0);
511 } else { 493 } else {
512#ifdef DEBUG 494 pr_debug("protection fault on insn access (segv).\n");
513 printk ("protection fault on insn access (segv).\n");
514#endif
515 force_sig (SIGSEGV, current); 495 force_sig (SIGSEGV, current);
516 } 496 }
517} 497}
@@ -525,22 +505,22 @@ static inline void bus_error030 (struct frame *fp)
525 unsigned short ssw = fp->un.fmtb.ssw; 505 unsigned short ssw = fp->un.fmtb.ssw;
526#ifdef DEBUG 506#ifdef DEBUG
527 unsigned long desc; 507 unsigned long desc;
508#endif
528 509
529 printk ("pid = %x ", current->pid); 510 pr_debug("pid = %x ", current->pid);
530 printk ("SSW=%#06x ", ssw); 511 pr_debug("SSW=%#06x ", ssw);
531 512
532 if (ssw & (FC | FB)) 513 if (ssw & (FC | FB))
533 printk ("Instruction fault at %#010lx\n", 514 pr_debug("Instruction fault at %#010lx\n",
534 ssw & FC ? 515 ssw & FC ?
535 fp->ptregs.format == 0xa ? fp->ptregs.pc + 2 : fp->un.fmtb.baddr - 2 516 fp->ptregs.format == 0xa ? fp->ptregs.pc + 2 : fp->un.fmtb.baddr - 2
536 : 517 :
537 fp->ptregs.format == 0xa ? fp->ptregs.pc + 4 : fp->un.fmtb.baddr); 518 fp->ptregs.format == 0xa ? fp->ptregs.pc + 4 : fp->un.fmtb.baddr);
538 if (ssw & DF) 519 if (ssw & DF)
539 printk ("Data %s fault at %#010lx in %s (pc=%#lx)\n", 520 pr_debug("Data %s fault at %#010lx in %s (pc=%#lx)\n",
540 ssw & RW ? "read" : "write", 521 ssw & RW ? "read" : "write",
541 fp->un.fmtb.daddr, 522 fp->un.fmtb.daddr,
542 space_names[ssw & DFC], fp->ptregs.pc); 523 space_names[ssw & DFC], fp->ptregs.pc);
543#endif
544 524
545 /* ++andreas: If a data fault and an instruction fault happen 525 /* ++andreas: If a data fault and an instruction fault happen
546 at the same time map in both pages. */ 526 at the same time map in both pages. */
@@ -554,27 +534,23 @@ static inline void bus_error030 (struct frame *fp)
554 "pmove %%psr,%1" 534 "pmove %%psr,%1"
555 : "=a&" (desc), "=m" (temp) 535 : "=a&" (desc), "=m" (temp)
556 : "a" (addr), "d" (ssw)); 536 : "a" (addr), "d" (ssw));
537 pr_debug("mmusr is %#x for addr %#lx in task %p\n",
538 temp, addr, current);
539 pr_debug("descriptor address is 0x%p, contents %#lx\n",
540 __va(desc), *(unsigned long *)__va(desc));
557#else 541#else
558 asm volatile ("ptestr %2,%1@,#7\n\t" 542 asm volatile ("ptestr %2,%1@,#7\n\t"
559 "pmove %%psr,%0" 543 "pmove %%psr,%0"
560 : "=m" (temp) : "a" (addr), "d" (ssw)); 544 : "=m" (temp) : "a" (addr), "d" (ssw));
561#endif 545#endif
562 mmusr = temp; 546 mmusr = temp;
563
564#ifdef DEBUG
565 printk("mmusr is %#x for addr %#lx in task %p\n",
566 mmusr, addr, current);
567 printk("descriptor address is %#lx, contents %#lx\n",
568 __va(desc), *(unsigned long *)__va(desc));
569#endif
570
571 errorcode = (mmusr & MMU_I) ? 0 : 1; 547 errorcode = (mmusr & MMU_I) ? 0 : 1;
572 if (!(ssw & RW) || (ssw & RM)) 548 if (!(ssw & RW) || (ssw & RM))
573 errorcode |= 2; 549 errorcode |= 2;
574 550
575 if (mmusr & (MMU_I | MMU_WP)) { 551 if (mmusr & (MMU_I | MMU_WP)) {
576 if (ssw & 4) { 552 if (ssw & 4) {
577 printk("Data %s fault at %#010lx in %s (pc=%#lx)\n", 553 pr_err("Data %s fault at %#010lx in %s (pc=%#lx)\n",
578 ssw & RW ? "read" : "write", 554 ssw & RW ? "read" : "write",
579 fp->un.fmtb.daddr, 555 fp->un.fmtb.daddr,
580 space_names[ssw & DFC], fp->ptregs.pc); 556 space_names[ssw & DFC], fp->ptregs.pc);
@@ -587,9 +563,10 @@ static inline void bus_error030 (struct frame *fp)
587 } else if (!(mmusr & MMU_I)) { 563 } else if (!(mmusr & MMU_I)) {
588 /* probably a 020 cas fault */ 564 /* probably a 020 cas fault */
589 if (!(ssw & RM) && send_fault_sig(&fp->ptregs) > 0) 565 if (!(ssw & RM) && send_fault_sig(&fp->ptregs) > 0)
590 printk("unexpected bus error (%#x,%#x)\n", ssw, mmusr); 566 pr_err("unexpected bus error (%#x,%#x)\n", ssw,
567 mmusr);
591 } else if (mmusr & (MMU_B|MMU_L|MMU_S)) { 568 } else if (mmusr & (MMU_B|MMU_L|MMU_S)) {
592 printk("invalid %s access at %#lx from pc %#lx\n", 569 pr_err("invalid %s access at %#lx from pc %#lx\n",
593 !(ssw & RW) ? "write" : "read", addr, 570 !(ssw & RW) ? "write" : "read", addr,
594 fp->ptregs.pc); 571 fp->ptregs.pc);
595 die_if_kernel("Oops",&fp->ptregs,mmusr); 572 die_if_kernel("Oops",&fp->ptregs,mmusr);
@@ -600,7 +577,7 @@ static inline void bus_error030 (struct frame *fp)
600 static volatile long tlong; 577 static volatile long tlong;
601#endif 578#endif
602 579
603 printk("weird %s access at %#lx from pc %#lx (ssw is %#x)\n", 580 pr_err("weird %s access at %#lx from pc %#lx (ssw is %#x)\n",
604 !(ssw & RW) ? "write" : "read", addr, 581 !(ssw & RW) ? "write" : "read", addr,
605 fp->ptregs.pc, ssw); 582 fp->ptregs.pc, ssw);
606 asm volatile ("ptestr #1,%1@,#0\n\t" 583 asm volatile ("ptestr #1,%1@,#0\n\t"
@@ -609,18 +586,16 @@ static inline void bus_error030 (struct frame *fp)
609 : "a" (addr)); 586 : "a" (addr));
610 mmusr = temp; 587 mmusr = temp;
611 588
612 printk ("level 0 mmusr is %#x\n", mmusr); 589 pr_err("level 0 mmusr is %#x\n", mmusr);
613#if 0 590#if 0
614 asm volatile ("pmove %%tt0,%0" 591 asm volatile ("pmove %%tt0,%0"
615 : "=m" (tlong)); 592 : "=m" (tlong));
616 printk("tt0 is %#lx, ", tlong); 593 pr_debug("tt0 is %#lx, ", tlong);
617 asm volatile ("pmove %%tt1,%0" 594 asm volatile ("pmove %%tt1,%0"
618 : "=m" (tlong)); 595 : "=m" (tlong));
619 printk("tt1 is %#lx\n", tlong); 596 pr_debug("tt1 is %#lx\n", tlong);
620#endif
621#ifdef DEBUG
622 printk("Unknown SIGSEGV - 1\n");
623#endif 597#endif
598 pr_debug("Unknown SIGSEGV - 1\n");
624 die_if_kernel("Oops",&fp->ptregs,mmusr); 599 die_if_kernel("Oops",&fp->ptregs,mmusr);
625 force_sig(SIGSEGV, current); 600 force_sig(SIGSEGV, current);
626 return; 601 return;
@@ -641,10 +616,9 @@ static inline void bus_error030 (struct frame *fp)
641 return; 616 return;
642 617
643 if (fp->ptregs.sr & PS_S) { 618 if (fp->ptregs.sr & PS_S) {
644 printk("Instruction fault at %#010lx\n", 619 pr_err("Instruction fault at %#010lx\n", fp->ptregs.pc);
645 fp->ptregs.pc);
646 buserr: 620 buserr:
647 printk ("BAD KERNEL BUSERR\n"); 621 pr_err("BAD KERNEL BUSERR\n");
648 die_if_kernel("Oops",&fp->ptregs,0); 622 die_if_kernel("Oops",&fp->ptregs,0);
649 force_sig(SIGKILL, current); 623 force_sig(SIGKILL, current);
650 return; 624 return;
@@ -668,28 +642,22 @@ static inline void bus_error030 (struct frame *fp)
668 "pmove %%psr,%1" 642 "pmove %%psr,%1"
669 : "=a&" (desc), "=m" (temp) 643 : "=a&" (desc), "=m" (temp)
670 : "a" (addr)); 644 : "a" (addr));
645 pr_debug("mmusr is %#x for addr %#lx in task %p\n",
646 temp, addr, current);
647 pr_debug("descriptor address is 0x%p, contents %#lx\n",
648 __va(desc), *(unsigned long *)__va(desc));
671#else 649#else
672 asm volatile ("ptestr #1,%1@,#7\n\t" 650 asm volatile ("ptestr #1,%1@,#7\n\t"
673 "pmove %%psr,%0" 651 "pmove %%psr,%0"
674 : "=m" (temp) : "a" (addr)); 652 : "=m" (temp) : "a" (addr));
675#endif 653#endif
676 mmusr = temp; 654 mmusr = temp;
677
678#ifdef DEBUG
679 printk ("mmusr is %#x for addr %#lx in task %p\n",
680 mmusr, addr, current);
681 printk ("descriptor address is %#lx, contents %#lx\n",
682 __va(desc), *(unsigned long *)__va(desc));
683#endif
684
685 if (mmusr & MMU_I) 655 if (mmusr & MMU_I)
686 do_page_fault (&fp->ptregs, addr, 0); 656 do_page_fault (&fp->ptregs, addr, 0);
687 else if (mmusr & (MMU_B|MMU_L|MMU_S)) { 657 else if (mmusr & (MMU_B|MMU_L|MMU_S)) {
688 printk ("invalid insn access at %#lx from pc %#lx\n", 658 pr_err("invalid insn access at %#lx from pc %#lx\n",
689 addr, fp->ptregs.pc); 659 addr, fp->ptregs.pc);
690#ifdef DEBUG 660 pr_debug("Unknown SIGSEGV - 2\n");
691 printk("Unknown SIGSEGV - 2\n");
692#endif
693 die_if_kernel("Oops",&fp->ptregs,mmusr); 661 die_if_kernel("Oops",&fp->ptregs,mmusr);
694 force_sig(SIGSEGV, current); 662 force_sig(SIGSEGV, current);
695 return; 663 return;
@@ -791,9 +759,7 @@ asmlinkage void buserr_c(struct frame *fp)
791 if (user_mode(&fp->ptregs)) 759 if (user_mode(&fp->ptregs))
792 current->thread.esp0 = (unsigned long) fp; 760 current->thread.esp0 = (unsigned long) fp;
793 761
794#ifdef DEBUG 762 pr_debug("*** Bus Error *** Format is %x\n", fp->ptregs.format);
795 printk ("*** Bus Error *** Format is %x\n", fp->ptregs.format);
796#endif
797 763
798#if defined(CONFIG_COLDFIRE) && defined(CONFIG_MMU) 764#if defined(CONFIG_COLDFIRE) && defined(CONFIG_MMU)
799 if (CPU_IS_COLDFIRE) { 765 if (CPU_IS_COLDFIRE) {
@@ -836,9 +802,7 @@ asmlinkage void buserr_c(struct frame *fp)
836#endif 802#endif
837 default: 803 default:
838 die_if_kernel("bad frame format",&fp->ptregs,0); 804 die_if_kernel("bad frame format",&fp->ptregs,0);
839#ifdef DEBUG 805 pr_debug("Unknown SIGSEGV - 4\n");
840 printk("Unknown SIGSEGV - 4\n");
841#endif
842 force_sig(SIGSEGV, current); 806 force_sig(SIGSEGV, current);
843 } 807 }
844} 808}
@@ -852,7 +816,7 @@ void show_trace(unsigned long *stack)
852 unsigned long addr; 816 unsigned long addr;
853 int i; 817 int i;
854 818
855 printk("Call Trace:"); 819 pr_info("Call Trace:");
856 addr = (unsigned long)stack + THREAD_SIZE - 1; 820 addr = (unsigned long)stack + THREAD_SIZE - 1;
857 endstack = (unsigned long *)(addr & -THREAD_SIZE); 821 endstack = (unsigned long *)(addr & -THREAD_SIZE);
858 i = 0; 822 i = 0;
@@ -869,13 +833,13 @@ void show_trace(unsigned long *stack)
869 if (__kernel_text_address(addr)) { 833 if (__kernel_text_address(addr)) {
870#ifndef CONFIG_KALLSYMS 834#ifndef CONFIG_KALLSYMS
871 if (i % 5 == 0) 835 if (i % 5 == 0)
872 printk("\n "); 836 pr_cont("\n ");
873#endif 837#endif
874 printk(" [<%08lx>] %pS\n", addr, (void *)addr); 838 pr_cont(" [<%08lx>] %pS\n", addr, (void *)addr);
875 i++; 839 i++;
876 } 840 }
877 } 841 }
878 printk("\n"); 842 pr_cont("\n");
879} 843}
880 844
881void show_registers(struct pt_regs *regs) 845void show_registers(struct pt_regs *regs)
@@ -887,81 +851,87 @@ void show_registers(struct pt_regs *regs)
887 int i; 851 int i;
888 852
889 print_modules(); 853 print_modules();
890 printk("PC: [<%08lx>] %pS\n", regs->pc, (void *)regs->pc); 854 pr_info("PC: [<%08lx>] %pS\n", regs->pc, (void *)regs->pc);
891 printk("SR: %04x SP: %p a2: %08lx\n", regs->sr, regs, regs->a2); 855 pr_info("SR: %04x SP: %p a2: %08lx\n", regs->sr, regs, regs->a2);
892 printk("d0: %08lx d1: %08lx d2: %08lx d3: %08lx\n", 856 pr_info("d0: %08lx d1: %08lx d2: %08lx d3: %08lx\n",
893 regs->d0, regs->d1, regs->d2, regs->d3); 857 regs->d0, regs->d1, regs->d2, regs->d3);
894 printk("d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n", 858 pr_info("d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n",
895 regs->d4, regs->d5, regs->a0, regs->a1); 859 regs->d4, regs->d5, regs->a0, regs->a1);
896 860
897 printk("Process %s (pid: %d, task=%p)\n", 861 pr_info("Process %s (pid: %d, task=%p)\n",
898 current->comm, task_pid_nr(current), current); 862 current->comm, task_pid_nr(current), current);
899 addr = (unsigned long)&fp->un; 863 addr = (unsigned long)&fp->un;
900 printk("Frame format=%X ", regs->format); 864 pr_info("Frame format=%X ", regs->format);
901 switch (regs->format) { 865 switch (regs->format) {
902 case 0x2: 866 case 0x2:
903 printk("instr addr=%08lx\n", fp->un.fmt2.iaddr); 867 pr_cont("instr addr=%08lx\n", fp->un.fmt2.iaddr);
904 addr += sizeof(fp->un.fmt2); 868 addr += sizeof(fp->un.fmt2);
905 break; 869 break;
906 case 0x3: 870 case 0x3:
907 printk("eff addr=%08lx\n", fp->un.fmt3.effaddr); 871 pr_cont("eff addr=%08lx\n", fp->un.fmt3.effaddr);
908 addr += sizeof(fp->un.fmt3); 872 addr += sizeof(fp->un.fmt3);
909 break; 873 break;
910 case 0x4: 874 case 0x4:
911 printk((CPU_IS_060 ? "fault addr=%08lx fslw=%08lx\n" 875 if (CPU_IS_060)
912 : "eff addr=%08lx pc=%08lx\n"), 876 pr_cont("fault addr=%08lx fslw=%08lx\n",
913 fp->un.fmt4.effaddr, fp->un.fmt4.pc); 877 fp->un.fmt4.effaddr, fp->un.fmt4.pc);
878 else
879 pr_cont("eff addr=%08lx pc=%08lx\n",
880 fp->un.fmt4.effaddr, fp->un.fmt4.pc);
914 addr += sizeof(fp->un.fmt4); 881 addr += sizeof(fp->un.fmt4);
915 break; 882 break;
916 case 0x7: 883 case 0x7:
917 printk("eff addr=%08lx ssw=%04x faddr=%08lx\n", 884 pr_cont("eff addr=%08lx ssw=%04x faddr=%08lx\n",
918 fp->un.fmt7.effaddr, fp->un.fmt7.ssw, fp->un.fmt7.faddr); 885 fp->un.fmt7.effaddr, fp->un.fmt7.ssw, fp->un.fmt7.faddr);
919 printk("wb 1 stat/addr/data: %04x %08lx %08lx\n", 886 pr_info("wb 1 stat/addr/data: %04x %08lx %08lx\n",
920 fp->un.fmt7.wb1s, fp->un.fmt7.wb1a, fp->un.fmt7.wb1dpd0); 887 fp->un.fmt7.wb1s, fp->un.fmt7.wb1a, fp->un.fmt7.wb1dpd0);
921 printk("wb 2 stat/addr/data: %04x %08lx %08lx\n", 888 pr_info("wb 2 stat/addr/data: %04x %08lx %08lx\n",
922 fp->un.fmt7.wb2s, fp->un.fmt7.wb2a, fp->un.fmt7.wb2d); 889 fp->un.fmt7.wb2s, fp->un.fmt7.wb2a, fp->un.fmt7.wb2d);
923 printk("wb 3 stat/addr/data: %04x %08lx %08lx\n", 890 pr_info("wb 3 stat/addr/data: %04x %08lx %08lx\n",
924 fp->un.fmt7.wb3s, fp->un.fmt7.wb3a, fp->un.fmt7.wb3d); 891 fp->un.fmt7.wb3s, fp->un.fmt7.wb3a, fp->un.fmt7.wb3d);
925 printk("push data: %08lx %08lx %08lx %08lx\n", 892 pr_info("push data: %08lx %08lx %08lx %08lx\n",
926 fp->un.fmt7.wb1dpd0, fp->un.fmt7.pd1, fp->un.fmt7.pd2, 893 fp->un.fmt7.wb1dpd0, fp->un.fmt7.pd1, fp->un.fmt7.pd2,
927 fp->un.fmt7.pd3); 894 fp->un.fmt7.pd3);
928 addr += sizeof(fp->un.fmt7); 895 addr += sizeof(fp->un.fmt7);
929 break; 896 break;
930 case 0x9: 897 case 0x9:
931 printk("instr addr=%08lx\n", fp->un.fmt9.iaddr); 898 pr_cont("instr addr=%08lx\n", fp->un.fmt9.iaddr);
932 addr += sizeof(fp->un.fmt9); 899 addr += sizeof(fp->un.fmt9);
933 break; 900 break;
934 case 0xa: 901 case 0xa:
935 printk("ssw=%04x isc=%04x isb=%04x daddr=%08lx dobuf=%08lx\n", 902 pr_cont("ssw=%04x isc=%04x isb=%04x daddr=%08lx dobuf=%08lx\n",
936 fp->un.fmta.ssw, fp->un.fmta.isc, fp->un.fmta.isb, 903 fp->un.fmta.ssw, fp->un.fmta.isc, fp->un.fmta.isb,
937 fp->un.fmta.daddr, fp->un.fmta.dobuf); 904 fp->un.fmta.daddr, fp->un.fmta.dobuf);
938 addr += sizeof(fp->un.fmta); 905 addr += sizeof(fp->un.fmta);
939 break; 906 break;
940 case 0xb: 907 case 0xb:
941 printk("ssw=%04x isc=%04x isb=%04x daddr=%08lx dobuf=%08lx\n", 908 pr_cont("ssw=%04x isc=%04x isb=%04x daddr=%08lx dobuf=%08lx\n",
942 fp->un.fmtb.ssw, fp->un.fmtb.isc, fp->un.fmtb.isb, 909 fp->un.fmtb.ssw, fp->un.fmtb.isc, fp->un.fmtb.isb,
943 fp->un.fmtb.daddr, fp->un.fmtb.dobuf); 910 fp->un.fmtb.daddr, fp->un.fmtb.dobuf);
944 printk("baddr=%08lx dibuf=%08lx ver=%x\n", 911 pr_info("baddr=%08lx dibuf=%08lx ver=%x\n",
945 fp->un.fmtb.baddr, fp->un.fmtb.dibuf, fp->un.fmtb.ver); 912 fp->un.fmtb.baddr, fp->un.fmtb.dibuf, fp->un.fmtb.ver);
946 addr += sizeof(fp->un.fmtb); 913 addr += sizeof(fp->un.fmtb);
947 break; 914 break;
948 default: 915 default:
949 printk("\n"); 916 pr_cont("\n");
950 } 917 }
951 show_stack(NULL, (unsigned long *)addr); 918 show_stack(NULL, (unsigned long *)addr);
952 919
953 printk("Code:"); 920 pr_info("Code:");
954 set_fs(KERNEL_DS); 921 set_fs(KERNEL_DS);
955 cp = (u16 *)regs->pc; 922 cp = (u16 *)regs->pc;
956 for (i = -8; i < 16; i++) { 923 for (i = -8; i < 16; i++) {
957 if (get_user(c, cp + i) && i >= 0) { 924 if (get_user(c, cp + i) && i >= 0) {
958 printk(" Bad PC value."); 925 pr_cont(" Bad PC value.");
959 break; 926 break;
960 } 927 }
961 printk(i ? " %04x" : " <%04x>", c); 928 if (i)
929 pr_cont(" %04x", c);
930 else
931 pr_cont(" <%04x>", c);
962 } 932 }
963 set_fs(old_fs); 933 set_fs(old_fs);
964 printk ("\n"); 934 pr_cont("\n");
965} 935}
966 936
967void show_stack(struct task_struct *task, unsigned long *stack) 937void show_stack(struct task_struct *task, unsigned long *stack)
@@ -978,16 +948,16 @@ void show_stack(struct task_struct *task, unsigned long *stack)
978 } 948 }
979 endstack = (unsigned long *)(((unsigned long)stack + THREAD_SIZE - 1) & -THREAD_SIZE); 949 endstack = (unsigned long *)(((unsigned long)stack + THREAD_SIZE - 1) & -THREAD_SIZE);
980 950
981 printk("Stack from %08lx:", (unsigned long)stack); 951 pr_info("Stack from %08lx:", (unsigned long)stack);
982 p = stack; 952 p = stack;
983 for (i = 0; i < kstack_depth_to_print; i++) { 953 for (i = 0; i < kstack_depth_to_print; i++) {
984 if (p + 1 > endstack) 954 if (p + 1 > endstack)
985 break; 955 break;
986 if (i % 8 == 0) 956 if (i % 8 == 0)
987 printk("\n "); 957 pr_cont("\n ");
988 printk(" %08lx", *p++); 958 pr_cont(" %08lx", *p++);
989 } 959 }
990 printk("\n"); 960 pr_cont("\n");
991 show_trace(stack); 961 show_trace(stack);
992} 962}
993 963
@@ -1005,32 +975,32 @@ void bad_super_trap (struct frame *fp)
1005 975
1006 console_verbose(); 976 console_verbose();
1007 if (vector < ARRAY_SIZE(vec_names)) 977 if (vector < ARRAY_SIZE(vec_names))
1008 printk ("*** %s *** FORMAT=%X\n", 978 pr_err("*** %s *** FORMAT=%X\n",
1009 vec_names[vector], 979 vec_names[vector],
1010 fp->ptregs.format); 980 fp->ptregs.format);
1011 else 981 else
1012 printk ("*** Exception %d *** FORMAT=%X\n", 982 pr_err("*** Exception %d *** FORMAT=%X\n",
1013 vector, fp->ptregs.format); 983 vector, fp->ptregs.format);
1014 if (vector == VEC_ADDRERR && CPU_IS_020_OR_030) { 984 if (vector == VEC_ADDRERR && CPU_IS_020_OR_030) {
1015 unsigned short ssw = fp->un.fmtb.ssw; 985 unsigned short ssw = fp->un.fmtb.ssw;
1016 986
1017 printk ("SSW=%#06x ", ssw); 987 pr_err("SSW=%#06x ", ssw);
1018 988
1019 if (ssw & RC) 989 if (ssw & RC)
1020 printk ("Pipe stage C instruction fault at %#010lx\n", 990 pr_err("Pipe stage C instruction fault at %#010lx\n",
1021 (fp->ptregs.format) == 0xA ? 991 (fp->ptregs.format) == 0xA ?
1022 fp->ptregs.pc + 2 : fp->un.fmtb.baddr - 2); 992 fp->ptregs.pc + 2 : fp->un.fmtb.baddr - 2);
1023 if (ssw & RB) 993 if (ssw & RB)
1024 printk ("Pipe stage B instruction fault at %#010lx\n", 994 pr_err("Pipe stage B instruction fault at %#010lx\n",
1025 (fp->ptregs.format) == 0xA ? 995 (fp->ptregs.format) == 0xA ?
1026 fp->ptregs.pc + 4 : fp->un.fmtb.baddr); 996 fp->ptregs.pc + 4 : fp->un.fmtb.baddr);
1027 if (ssw & DF) 997 if (ssw & DF)
1028 printk ("Data %s fault at %#010lx in %s (pc=%#lx)\n", 998 pr_err("Data %s fault at %#010lx in %s (pc=%#lx)\n",
1029 ssw & RW ? "read" : "write", 999 ssw & RW ? "read" : "write",
1030 fp->un.fmtb.daddr, space_names[ssw & DFC], 1000 fp->un.fmtb.daddr, space_names[ssw & DFC],
1031 fp->ptregs.pc); 1001 fp->ptregs.pc);
1032 } 1002 }
1033 printk ("Current process id is %d\n", task_pid_nr(current)); 1003 pr_err("Current process id is %d\n", task_pid_nr(current));
1034 die_if_kernel("BAD KERNEL TRAP", &fp->ptregs, 0); 1004 die_if_kernel("BAD KERNEL TRAP", &fp->ptregs, 0);
1035} 1005}
1036 1006
@@ -1162,7 +1132,7 @@ void die_if_kernel (char *str, struct pt_regs *fp, int nr)
1162 return; 1132 return;
1163 1133
1164 console_verbose(); 1134 console_verbose();
1165 printk("%s: %08x\n",str,nr); 1135 pr_crit("%s: %08x\n", str, nr);
1166 show_registers(fp); 1136 show_registers(fp);
1167 add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE); 1137 add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE);
1168 do_exit(SIGSEGV); 1138 do_exit(SIGSEGV);