root/arch/ppc/kernel/traps.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. trap_init
  2. _exception
  3. MachineCheckException
  4. ProgramCheckException
  5. FloatingPointCheckException
  6. AlignmentException
  7. bad_stack
  8. dump_regs
  9. trace_syscall

   1 /*
   2  *  linux/arch/ppc/kernel/traps.c
   3  *
   4  *  Copyright (C) 1995  Gary Thomas
   5  *  Adapted for PowerPC by Gary THomas
   6  */
   7 
   8 /*
   9  * This file handles the architecture-dependent parts of hardware exceptions
  10  */
  11 
  12 #include <linux/errno.h>
  13 #include <linux/sched.h>
  14 #include <linux/kernel.h>
  15 #include <linux/mm.h>
  16 #include <linux/stddef.h>
  17 #include <linux/unistd.h>
  18 #include <linux/ptrace.h>
  19 #include <linux/malloc.h>
  20 #include <linux/ldt.h>
  21 #include <linux/user.h>
  22 #include <linux/a.out.h>
  23 
  24 #include <asm/pgtable.h>
  25 #include <asm/segment.h>
  26 #include <asm/system.h>
  27 #include <asm/io.h>
  28 
  29 #include <asm/processor.h>
  30 
  31 /*
  32  * Trap & Exception support
  33  */
  34 
  35 void
  36 trap_init(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  37 {
  38 }
  39 
  40 void
  41 _exception(int signr, struct pt_regs *regs)
     /* [previous][next][first][last][top][bottom][index][help] */
  42 {
  43         dump_regs(regs);
  44         send_sig(signr, current, 1);
  45         if (!user_mode(regs))
  46         {
  47                 printk("Failure in kernel at PC: %x, MSR: %x\n", regs->nip, regs->msr);
  48                 while (1) ;
  49         }
  50 }
  51 
  52 MachineCheckException(struct pt_regs *regs)
     /* [previous][next][first][last][top][bottom][index][help] */
  53 {
  54         unsigned long *eagle_ip = (unsigned long *)0x80000CF8;
  55         unsigned long *eagle_id = (unsigned long *)0x80000CFC;
  56         printk("Machine check at PC: %x[%x], SR: %x\n", regs->nip, va_to_phys(regs->nip), regs->msr);
  57 #if 0   
  58         *eagle_ip = 0xC0000080;  /* Memory error register */
  59         printk("Error regs = %08X", *eagle_id);
  60         *eagle_ip = 0xC4000080;  /* Memory error register */
  61         printk("/%08X", *eagle_id);
  62         *eagle_ip = 0xC8000080;  /* Memory error register */
  63         printk("/%08X\n", *eagle_id);
  64 #endif
  65         _exception(SIGSEGV, regs);      
  66 }
  67 
  68 ProgramCheckException(struct pt_regs *regs)
     /* [previous][next][first][last][top][bottom][index][help] */
  69 {
  70         printk("Program check at PC: %x[%x], SR: %x\n", regs->nip, va_to_phys(regs->nip), regs->msr);
  71         _exception(SIGILL, regs);       
  72 }
  73 
  74 FloatingPointCheckException(struct pt_regs *regs)
     /* [previous][next][first][last][top][bottom][index][help] */
  75 {
  76         printk("Floating point check at PC: %x[%x], SR: %x\n", regs->nip, va_to_phys(regs->nip), regs->msr);
  77         _exception(SIGFPE, regs);       
  78 }
  79 
  80 AlignmentException(struct pt_regs *regs)
     /* [previous][next][first][last][top][bottom][index][help] */
  81 {
  82         printk("Alignment error at PC: %x[%x], SR: %x\n", regs->nip, va_to_phys(regs->nip), regs->msr);
  83         _exception(SIGBUS, regs);       
  84 }
  85 
  86 bad_stack(struct pt_regs *regs)
     /* [previous][next][first][last][top][bottom][index][help] */
  87 {
  88         printk("Kernel stack overflow at PC: %x[%x], SR: %x\n", regs->nip, va_to_phys(regs->nip), regs->msr);
  89         dump_regs(regs);
  90         while (1) ;
  91 }
  92 
  93 dump_regs(struct pt_regs *regs)
     /* [previous][next][first][last][top][bottom][index][help] */
  94 {
  95         int i;
  96         printk("NIP: %08X, MSR: %08X, XER: %08X, LR: %08X, FRAME: %08X\n", regs->nip, regs->msr, regs->xer, regs->link, regs);
  97         printk("HASH = %08X/%08X, MISS = %08X/%08X, CMP = %08X/%08X\n", regs->hash1, regs->hash2, regs->imiss, regs->dmiss, regs->icmp, regs->dcmp);
  98         printk("TASK = %x[%d] '%s'\n", current, current->pid, current->comm);
  99         for (i = 0;  i < 32;  i++)
 100         {
 101                 if ((i % 8) == 0)
 102                 {
 103                         printk("GPR%02d: ", i);
 104                 }
 105                 printk("%08X ", regs->gpr[i]);
 106                 if ((i % 8) == 7)
 107                 {
 108                         printk("\n");
 109                 }
 110         }
 111         dump_buf(regs->nip, 32);
 112         dump_buf((regs->nip&0x0FFFFFFF)|KERNELBASE, 32);
 113 }
 114 
 115 trace_syscall(struct pt_regs *regs)
     /* [previous][next][first][last][top][bottom][index][help] */
 116 {
 117         printk("Task: %08X(%d), PC: %08X/%08X, Syscall: %3d, Result: %d\n", current, current->pid, regs->nip, regs->link, regs->gpr[0], regs->gpr[3]);
 118 }
 119 

/* [previous][next][first][last][top][bottom][index][help] */