root/arch/sparc/kernel/traps.c

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

DEFINITIONS

This source file includes following definitions.
  1. do_hw_interrupt
  2. do_illegal_instruction
  3. do_priv_instruction
  4. do_memaccess_unaligned
  5. do_fpd_trap
  6. do_fpe_trap
  7. handle_tag_overflow
  8. handle_watchpoint
  9. handle_reg_access
  10. handle_iacc_error
  11. handle_cp_disabled
  12. handle_bad_flush
  13. handle_cp_exception
  14. handle_dacc_error
  15. handle_hw_divzero
  16. handle_dstore_error
  17. handle_dacc_mmu_miss
  18. handle_iacc_mmu_miss
  19. trap_init
  20. die_if_kernel

   1 /*
   2  * arch/sparc/kernel/traps.c
   3  *
   4  * Copyright 1995 David S. Miller (davem@caip.rutgers.edu)
   5  */
   6 
   7 /*
   8  * I hate traps on the sparc, grrr...
   9  */
  10 
  11 #include <linux/sched.h>  /* for jiffies */
  12 #include <linux/kernel.h>
  13 
  14 #include <asm/delay.h>
  15 #include <asm/system.h>
  16 #include <asm/ptrace.h>
  17 #include <asm/oplib.h>
  18 #include <asm/page.h>
  19 #include <asm/pgtable.h>
  20 #include <asm/mp.h>
  21 #include <asm/kdebug.h>
  22 
  23 void
  24 do_hw_interrupt(unsigned long type, unsigned long psr, unsigned long pc)
     /* [previous][next][first][last][top][bottom][index][help] */
  25 {
  26 
  27   printk("Unimplemented Sparc TRAP, type = %02lx psr = %08lx pc = %08lx\n",
  28          type, psr, pc);
  29   halt();
  30 
  31   return;
  32 }
  33 
  34 void
  35 do_illegal_instruction(struct pt_regs *regs, unsigned long pc, unsigned long npc,
     /* [previous][next][first][last][top][bottom][index][help] */
  36                        unsigned long psr)
  37 {
  38         printk("Illegal instruction at PC %08lx NPC %08lx PSR %08lx\n",
  39                pc, npc, psr);
  40         halt();
  41         return;
  42 }
  43 
  44 void
  45 do_priv_instruction(struct pt_regs *regs, unsigned long pc, unsigned long npc,
     /* [previous][next][first][last][top][bottom][index][help] */
  46                        unsigned long psr)
  47 {
  48         printk("Privileged instruction at PC %08lx NPC %08lx PSR %08lx\n",
  49                pc, npc, psr);
  50         halt();
  51         return;
  52 }
  53 
  54 void
  55 do_memaccess_unaligned(struct pt_regs *regs, unsigned long pc, unsigned long npc,
     /* [previous][next][first][last][top][bottom][index][help] */
  56                        unsigned long psr)
  57 {
  58         printk("Unaligned memory access at PC %08lx NPC %08lx PSR %08lx\n",
  59                pc, npc, psr);
  60         halt();
  61         return;
  62 }
  63 
  64 void
  65 do_fpd_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc,
     /* [previous][next][first][last][top][bottom][index][help] */
  66                        unsigned long psr)
  67 {
  68         printk("Floating Point Disabled trap at PC %08lx NPC %08lx PSR %08lx\n",
  69                pc, npc, psr);
  70         halt();
  71         return;
  72 }
  73 
  74 void
  75 do_fpe_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc,
     /* [previous][next][first][last][top][bottom][index][help] */
  76                        unsigned long psr)
  77 {
  78         printk("Floating Point Exception at PC %08lx NPC %08lx PSR %08lx\n",
  79                pc, npc, psr);
  80         halt();
  81         return;
  82 }
  83 
  84 void
  85 handle_tag_overflow(struct pt_regs *regs, unsigned long pc, unsigned long npc,
     /* [previous][next][first][last][top][bottom][index][help] */
  86                        unsigned long psr)
  87 {
  88         printk("Tag overflow trap at PC %08lx NPC %08lx PSR %08lx\n",
  89                pc, npc, psr);
  90         halt();
  91         return;
  92 }
  93 
  94 void
  95 handle_watchpoint(struct pt_regs *regs, unsigned long pc, unsigned long npc,
     /* [previous][next][first][last][top][bottom][index][help] */
  96                        unsigned long psr)
  97 {
  98         printk("Watchpoint detected at PC %08lx NPC %08lx PSR %08lx\n",
  99                pc, npc, psr);
 100         halt();
 101         return;
 102 }
 103 
 104 void
 105 handle_reg_access(struct pt_regs *regs, unsigned long pc, unsigned long npc,
     /* [previous][next][first][last][top][bottom][index][help] */
 106                        unsigned long psr)
 107 {
 108         printk("Register Access Exception at PC %08lx NPC %08lx PSR %08lx\n",
 109                pc, npc, psr);
 110         halt();
 111         return;
 112 }
 113 
 114 void
 115 handle_iacc_error(struct pt_regs *regs, unsigned long pc, unsigned long npc,
     /* [previous][next][first][last][top][bottom][index][help] */
 116                        unsigned long psr)
 117 {
 118         printk("Instruction Access Error at PC %08lx NPC %08lx PSR %08lx\n",
 119                pc, npc, psr);
 120         halt();
 121         return;
 122 }
 123 
 124 void
 125 handle_cp_disabled(struct pt_regs *regs, unsigned long pc, unsigned long npc,
     /* [previous][next][first][last][top][bottom][index][help] */
 126                        unsigned long psr)
 127 {
 128         printk("Co-Processor disabled trap at PC %08lx NPC %08lx PSR %08lx\n",
 129                pc, npc, psr);
 130         halt();
 131         return;
 132 }
 133 
 134 void
 135 handle_bad_flush(struct pt_regs *regs, unsigned long pc, unsigned long npc,
     /* [previous][next][first][last][top][bottom][index][help] */
 136                        unsigned long psr)
 137 {
 138         printk("Unimplemented FLUSH Exception at PC %08lx NPC %08lx PSR %08lx\n",
 139                pc, npc, psr);
 140         halt();
 141         return;
 142 }
 143 
 144 void
 145 handle_cp_exception(struct pt_regs *regs, unsigned long pc, unsigned long npc,
     /* [previous][next][first][last][top][bottom][index][help] */
 146                        unsigned long psr)
 147 {
 148         printk("Co-Processor Exception at PC %08lx NPC %08lx PSR %08lx\n",
 149                pc, npc, psr);
 150         halt();
 151         return;
 152 }
 153 
 154 void
 155 handle_dacc_error(struct pt_regs *regs, unsigned long pc, unsigned long npc,
     /* [previous][next][first][last][top][bottom][index][help] */
 156                        unsigned long psr)
 157 {
 158         printk("Data Access Error at PC %08lx NPC %08lx PSR %08lx\n",
 159                pc, npc, psr);
 160         halt();
 161         return;
 162 }
 163 
 164 void
 165 handle_hw_divzero(struct pt_regs *regs, unsigned long pc, unsigned long npc,
     /* [previous][next][first][last][top][bottom][index][help] */
 166                        unsigned long psr)
 167 {
 168         printk("Divide By Zero Exception at PC %08lx NPC %08lx PSR %08lx\n",
 169                pc, npc, psr);
 170         halt();
 171         return;
 172 }
 173 
 174 void
 175 handle_dstore_error(struct pt_regs *regs, unsigned long pc, unsigned long npc,
     /* [previous][next][first][last][top][bottom][index][help] */
 176                        unsigned long psr)
 177 {
 178         printk("Data Store Error at PC %08lx NPC %08lx PSR %08lx\n",
 179                pc, npc, psr);
 180         halt();
 181         return;
 182 }
 183 
 184 void
 185 handle_dacc_mmu_miss(struct pt_regs *regs, unsigned long pc, unsigned long npc,
     /* [previous][next][first][last][top][bottom][index][help] */
 186                        unsigned long psr)
 187 {
 188         printk("Data Access MMU-Miss Exception at PC %08lx NPC %08lx PSR %08lx\n",
 189                pc, npc, psr);
 190         halt();
 191         return;
 192 }
 193 
 194 void
 195 handle_iacc_mmu_miss(struct pt_regs *regs, unsigned long pc, unsigned long npc,
     /* [previous][next][first][last][top][bottom][index][help] */
 196                        unsigned long psr)
 197 {
 198         printk("Instruction Access MMU-Miss Exception at PC %08lx NPC %08lx PSR %08lx\n",
 199                pc, npc, psr);
 200         halt();
 201         return;
 202 }
 203 
 204 /* Since we have our mappings set up, on multiprocessors we can spin them
 205  * up here so that timer interrupts work during initialization.
 206  */
 207 
 208 extern void sparc_cpu_startup(void);
 209 
 210 extern int linux_num_cpus;
 211 extern pgd_t *lnx_root;
 212 
 213 int linux_smp_still_initting;
 214 unsigned int thiscpus_tbr;
 215 int thiscpus_mid;
 216 
 217 /* #define SMP_TESTING */
 218 
 219 void
 220 trap_init(void)
     /* [previous][next][first][last][top][bottom][index][help] */
 221 {
 222         struct linux_prom_registers ctx_reg;
 223         int i;
 224 
 225         if(linux_num_cpus == 1) {
 226                 printk("trap_init: Uniprocessor detected.\n");
 227                 return;
 228         }
 229         if(sparc_cpu_model != sun4m) {
 230                 printk("trap_init: Multiprocessor on a non-sun4m! Aieee...\n");
 231                 printk("trap_init: Cannot continue, bailing out.\n");
 232                 prom_halt();
 233         }
 234         /* Ok, we are on a sun4m with multiple cpu's */
 235         printk("trap_init: Multiprocessor detected, initiating CPU-startup. cpus=%d\n",
 236                linux_num_cpus);
 237         linux_smp_still_initting = 1;
 238         ctx_reg.which_io = 0x0;  /* real ram */
 239         ctx_reg.phys_addr = (char *) (((unsigned long) lnx_root) - PAGE_OFFSET);
 240         ctx_reg.reg_size = 0x0;
 241         /* This basically takes every cpu, loads up our Linux context table
 242          * into it's context table pointer register, inits it at the low level
 243          * and then makes it spin in an endless loop...
 244          */
 245         for(i=0; i<linux_num_cpus; i++) {
 246                 if((linux_cpus[i].mid & (~8)) != 0x0) {
 247                         static int cpuid = 0;
 248                         cpuid = (linux_cpus[i].mid & (~8));
 249                         percpu_table[cpuid].cpu_is_alive = 0;
 250                         thiscpus_mid = linux_cpus[i].mid;
 251                         thiscpus_tbr = (unsigned int)
 252                                 percpu_table[cpuid].trap_table;
 253 #ifdef SMP_TESTING
 254                         printk("thiscpus_tbr = %08x\n", thiscpus_tbr);
 255                         printk("About to fire up cpu %d mid %d cpuid %d\n", i,
 256                                linux_cpus[i].mid, cpuid);
 257 #endif
 258                         prom_startcpu(linux_cpus[i].prom_node, &ctx_reg, 0x0,
 259                                       (char *) sparc_cpu_startup);
 260                         printk("Waiting for cpu %d to start up...\n", i);
 261                         while(percpu_table[cpuid].cpu_is_alive == 0) {
 262                                 static int counter = 0;
 263                                 counter++;
 264                                 if(counter>200) {
 265 #ifdef SMP_TESTING
 266                                         printk("UGH, CPU would not start up ;-( \n");
 267 #endif
 268                                         break;
 269                                 }
 270                                 __delay(200000);
 271                         }
 272                 }
 273         }
 274 
 275         linux_smp_still_initting = 1;
 276 
 277         return;
 278 }
 279 
 280 void
 281 die_if_kernel(char * str, struct pt_regs * regs, long err)
     /* [previous][next][first][last][top][bottom][index][help] */
 282 {
 283   return;
 284 }

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