root/arch/alpha/kernel/traps.c

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

DEFINITIONS

This source file includes following definitions.
  1. die_if_kernel
  2. do_entArith
  3. do_entIF
  4. do_entUna
  5. do_entSys
  6. trap_init

   1 /*
   2  * kernel/traps.c
   3  *
   4  * (C) Copyright 1994 Linus Torvalds
   5  */
   6 
   7 /*
   8  * This file initializes the trap entry points
   9  */
  10 
  11 #include <linux/sched.h>
  12 
  13 void die_if_kernel(char * str, struct pt_regs * regs, long err)
     /* [previous][next][first][last][top][bottom][index][help] */
  14 {
  15         unsigned long i;
  16 
  17         printk("%s %ld\n", str, err);
  18         printk("pc = %016lx ps = %04lx\n", regs->pc, regs->ps);
  19         printk("rp = %016lx sp = %p\n", regs->r26, regs+1);
  20         for (i = 0 ; i < 5000000000 ; i++)
  21                 /* pause */;
  22         halt();
  23 }
  24 
  25 asmlinkage void do_entArith(unsigned long summary, unsigned long write_mask,
     /* [previous][next][first][last][top][bottom][index][help] */
  26         unsigned long a2, unsigned long a3, unsigned long a4, unsigned long a5,
  27         struct pt_regs regs)
  28 {
  29         printk("Arithmetic trap: %02lx %016lx\n", summary, write_mask);
  30         die_if_kernel("Arithmetic fault", &regs, 0);
  31 }
  32 
  33 asmlinkage void do_entIF(unsigned long type, unsigned long a1, unsigned long a2,
     /* [previous][next][first][last][top][bottom][index][help] */
  34         unsigned long a3, unsigned long a4, unsigned long a5,
  35         struct pt_regs regs)
  36 {
  37         die_if_kernel("Instruction fault", &regs, type);
  38 }
  39 
  40 asmlinkage void do_entUna(unsigned long va, unsigned long opcode, unsigned long reg,
     /* [previous][next][first][last][top][bottom][index][help] */
  41         unsigned long a3, unsigned long a4, unsigned long a5,
  42         struct pt_regs regs)
  43 {
  44         printk("Unaligned trap: %016lx %ld %ld\n", va, opcode, reg);
  45         die_if_kernel("Unaligned", &regs, 0);
  46 }
  47 
  48 /*
  49  * DEC means people to use the "retsys" instruction for return from
  50  * a system call, but they are clearly misguided about this. We use
  51  * "rti" in all cases, and fill in the stack with the return values.
  52  * That should make signal handling etc much cleaner.
  53  *
  54  * Even more horribly, DEC doesn't allow system calls from kernel mode.
  55  * "Security" features letting the user do something the kernel can't
  56  * are a thinko. DEC palcode is strange. The PAL-code designers probably
  57  * got terminally tainted by VMS at some point.
  58  */
  59 asmlinkage void do_entSys(unsigned long a0, unsigned long a1, unsigned long a2,
     /* [previous][next][first][last][top][bottom][index][help] */
  60         unsigned long a3, unsigned long a4, unsigned long a5, struct pt_regs regs)
  61 {
  62         printk("System call %ld(%ld,%ld)\n", regs.r0, a0, a1);
  63         die_if_kernel("Syscall", &regs, 0);
  64 }
  65 
  66 extern asmlinkage void entMM(void);
  67 extern asmlinkage void entIF(void);
  68 extern asmlinkage void entArith(void);
  69 extern asmlinkage void entUna(void);
  70 extern asmlinkage void entSys(void);
  71 
  72 void trap_init(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  73 {
  74         unsigned long gptr;
  75 
  76         /*
  77          * Tell PAL-code what global pointer we want in the kernel..
  78          */
  79         __asm__("br %0,___tmp\n"
  80                 "___tmp:\tldgp %0,0(%0)"
  81                 : "=r" (gptr));
  82         wrkgp(gptr);
  83 
  84         wrent(entArith, 1);
  85         wrent(entMM, 2);
  86         wrent(entIF, 3);
  87         wrent(entUna, 4);
  88         wrent(entSys, 5);
  89 }

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