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/ppc_machine.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         while(1) ;
  72         _exception(SIGILL, regs);
  73 }
  74 
  75 FloatingPointCheckException(struct pt_regs *regs)
     /* [previous][next][first][last][top][bottom][index][help] */
  76 {
  77         printk("Floating point check at PC: %x[%x], SR: %x\n", regs->nip, va_to_phys(regs->nip), regs->msr);
  78         _exception(SIGFPE, regs);       
  79 }
  80 
  81 AlignmentException(struct pt_regs *regs)
     /* [previous][next][first][last][top][bottom][index][help] */
  82 {
  83         printk("Alignment error at PC: %x[%x], SR: %x\n", regs->nip, va_to_phys(regs->nip), regs->msr);
  84         _exception(SIGBUS, regs);       
  85 }
  86 
  87 bad_stack(struct pt_regs *regs)
     /* [previous][next][first][last][top][bottom][index][help] */
  88 {
  89         printk("Kernel stack overflow at PC: %x[%x], SR: %x\n", regs->nip, va_to_phys(regs->nip), regs->msr);
  90         dump_regs(regs);
  91         while (1) ;
  92 }
  93 
  94 dump_regs(struct pt_regs *regs)
     /* [previous][next][first][last][top][bottom][index][help] */
  95 {
  96         int i;
  97         printk("NIP: %08X, MSR: %08X, XER: %08X, LR: %08X, FRAME: %08X\n", regs->nip, regs->msr, regs->xer, regs->link, regs);
  98         printk("HASH = %08X/%08X, MISS = %08X/%08X, CMP = %08X/%08X\n", regs->hash1, regs->hash2, regs->imiss, regs->dmiss, regs->icmp, regs->dcmp);
  99         printk("TASK = %x[%d] '%s'\n", current, current->pid, current->comm);
 100         for (i = 0;  i < 32;  i++)
 101         {
 102                 if ((i % 8) == 0)
 103                 {
 104                         printk("GPR%02d: ", i);
 105                 }
 106                 printk("%08X ", regs->gpr[i]);
 107                 if ((i % 8) == 7)
 108                 {
 109                         printk("\n");
 110                 }
 111         }
 112         dump_buf(regs->nip, 32);
 113         dump_buf((regs->nip&0x0FFFFFFF)|KERNELBASE, 32);
 114 }
 115 
 116 trace_syscall(struct pt_regs *regs)
     /* [previous][next][first][last][top][bottom][index][help] */
 117 {
 118         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]);
 119 }
 120 

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