114cf11afSPaul Mackerras /* 214cf11afSPaul Mackerras * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org) 314cf11afSPaul Mackerras * 414cf11afSPaul Mackerras * This program is free software; you can redistribute it and/or 514cf11afSPaul Mackerras * modify it under the terms of the GNU General Public License 614cf11afSPaul Mackerras * as published by the Free Software Foundation; either version 714cf11afSPaul Mackerras * 2 of the License, or (at your option) any later version. 814cf11afSPaul Mackerras * 914cf11afSPaul Mackerras * Modified by Cort Dougan (cort@cs.nmt.edu) 1014cf11afSPaul Mackerras * and Paul Mackerras (paulus@samba.org) 1114cf11afSPaul Mackerras */ 1214cf11afSPaul Mackerras 1314cf11afSPaul Mackerras /* 1414cf11afSPaul Mackerras * This file handles the architecture-dependent parts of hardware exceptions 1514cf11afSPaul Mackerras */ 1614cf11afSPaul Mackerras 1714cf11afSPaul Mackerras #include <linux/config.h> 1814cf11afSPaul Mackerras #include <linux/errno.h> 1914cf11afSPaul Mackerras #include <linux/sched.h> 2014cf11afSPaul Mackerras #include <linux/kernel.h> 2114cf11afSPaul Mackerras #include <linux/mm.h> 2214cf11afSPaul Mackerras #include <linux/stddef.h> 2314cf11afSPaul Mackerras #include <linux/unistd.h> 248dad3f92SPaul Mackerras #include <linux/ptrace.h> 2514cf11afSPaul Mackerras #include <linux/slab.h> 2614cf11afSPaul Mackerras #include <linux/user.h> 2714cf11afSPaul Mackerras #include <linux/a.out.h> 2814cf11afSPaul Mackerras #include <linux/interrupt.h> 2914cf11afSPaul Mackerras #include <linux/init.h> 3014cf11afSPaul Mackerras #include <linux/module.h> 318dad3f92SPaul Mackerras #include <linux/prctl.h> 3214cf11afSPaul Mackerras #include <linux/delay.h> 3314cf11afSPaul Mackerras #include <linux/kprobes.h> 34cc532915SMichael Ellerman #include <linux/kexec.h> 355474c120SMichael Hanselmann #include <linux/backlight.h> 3614cf11afSPaul Mackerras 3786417780SPaul Mackerras #include <asm/kdebug.h> 3814cf11afSPaul Mackerras #include <asm/pgtable.h> 3914cf11afSPaul Mackerras #include <asm/uaccess.h> 4014cf11afSPaul Mackerras #include <asm/system.h> 4114cf11afSPaul Mackerras #include <asm/io.h> 4286417780SPaul Mackerras #include <asm/machdep.h> 4386417780SPaul Mackerras #include <asm/rtas.h> 44f7f6f4feSDavid Gibson #include <asm/pmc.h> 45dc1c1ca3SStephen Rothwell #ifdef CONFIG_PPC32 4614cf11afSPaul Mackerras #include <asm/reg.h> 4786417780SPaul Mackerras #endif 4814cf11afSPaul Mackerras #ifdef CONFIG_PMAC_BACKLIGHT 4914cf11afSPaul Mackerras #include <asm/backlight.h> 5014cf11afSPaul Mackerras #endif 51dc1c1ca3SStephen Rothwell #ifdef CONFIG_PPC64 5286417780SPaul Mackerras #include <asm/firmware.h> 53dc1c1ca3SStephen Rothwell #include <asm/processor.h> 54dc1c1ca3SStephen Rothwell #endif 55*c0ce7d08SDavid Wilder #include <asm/kexec.h> 56dc1c1ca3SStephen Rothwell 5786417780SPaul Mackerras #ifdef CONFIG_PPC64 /* XXX */ 5886417780SPaul Mackerras #define _IO_BASE pci_io_base 59*c0ce7d08SDavid Wilder #ifdef CONFIG_KEXEC 60*c0ce7d08SDavid Wilder cpumask_t cpus_in_sr = CPU_MASK_NONE; 61*c0ce7d08SDavid Wilder #endif 6286417780SPaul Mackerras #endif 6386417780SPaul Mackerras 6414cf11afSPaul Mackerras #ifdef CONFIG_DEBUGGER 6514cf11afSPaul Mackerras int (*__debugger)(struct pt_regs *regs); 6614cf11afSPaul Mackerras int (*__debugger_ipi)(struct pt_regs *regs); 6714cf11afSPaul Mackerras int (*__debugger_bpt)(struct pt_regs *regs); 6814cf11afSPaul Mackerras int (*__debugger_sstep)(struct pt_regs *regs); 6914cf11afSPaul Mackerras int (*__debugger_iabr_match)(struct pt_regs *regs); 7014cf11afSPaul Mackerras int (*__debugger_dabr_match)(struct pt_regs *regs); 7114cf11afSPaul Mackerras int (*__debugger_fault_handler)(struct pt_regs *regs); 7214cf11afSPaul Mackerras 7314cf11afSPaul Mackerras EXPORT_SYMBOL(__debugger); 7414cf11afSPaul Mackerras EXPORT_SYMBOL(__debugger_ipi); 7514cf11afSPaul Mackerras EXPORT_SYMBOL(__debugger_bpt); 7614cf11afSPaul Mackerras EXPORT_SYMBOL(__debugger_sstep); 7714cf11afSPaul Mackerras EXPORT_SYMBOL(__debugger_iabr_match); 7814cf11afSPaul Mackerras EXPORT_SYMBOL(__debugger_dabr_match); 7914cf11afSPaul Mackerras EXPORT_SYMBOL(__debugger_fault_handler); 8014cf11afSPaul Mackerras #endif 8114cf11afSPaul Mackerras 82e041c683SAlan Stern ATOMIC_NOTIFIER_HEAD(powerpc_die_chain); 8314cf11afSPaul Mackerras 8414cf11afSPaul Mackerras int register_die_notifier(struct notifier_block *nb) 8514cf11afSPaul Mackerras { 86e041c683SAlan Stern return atomic_notifier_chain_register(&powerpc_die_chain, nb); 8714cf11afSPaul Mackerras } 88e041c683SAlan Stern EXPORT_SYMBOL(register_die_notifier); 89e041c683SAlan Stern 90e041c683SAlan Stern int unregister_die_notifier(struct notifier_block *nb) 91e041c683SAlan Stern { 92e041c683SAlan Stern return atomic_notifier_chain_unregister(&powerpc_die_chain, nb); 93e041c683SAlan Stern } 94e041c683SAlan Stern EXPORT_SYMBOL(unregister_die_notifier); 9514cf11afSPaul Mackerras 9614cf11afSPaul Mackerras /* 9714cf11afSPaul Mackerras * Trap & Exception support 9814cf11afSPaul Mackerras */ 9914cf11afSPaul Mackerras 10014cf11afSPaul Mackerras static DEFINE_SPINLOCK(die_lock); 10114cf11afSPaul Mackerras 10214cf11afSPaul Mackerras int die(const char *str, struct pt_regs *regs, long err) 10314cf11afSPaul Mackerras { 104*c0ce7d08SDavid Wilder static int die_counter; 10514cf11afSPaul Mackerras 10614cf11afSPaul Mackerras if (debugger(regs)) 10714cf11afSPaul Mackerras return 1; 10814cf11afSPaul Mackerras 10914cf11afSPaul Mackerras console_verbose(); 11014cf11afSPaul Mackerras spin_lock_irq(&die_lock); 11114cf11afSPaul Mackerras bust_spinlocks(1); 1128dad3f92SPaul Mackerras #ifdef CONFIG_PMAC_BACKLIGHT 1135474c120SMichael Hanselmann mutex_lock(&pmac_backlight_mutex); 1145474c120SMichael Hanselmann if (machine_is(powermac) && pmac_backlight) { 1155474c120SMichael Hanselmann struct backlight_properties *props; 1165474c120SMichael Hanselmann 1175474c120SMichael Hanselmann down(&pmac_backlight->sem); 1185474c120SMichael Hanselmann props = pmac_backlight->props; 1195474c120SMichael Hanselmann props->brightness = props->max_brightness; 1205474c120SMichael Hanselmann props->power = FB_BLANK_UNBLANK; 1215474c120SMichael Hanselmann props->update_status(pmac_backlight); 1225474c120SMichael Hanselmann up(&pmac_backlight->sem); 12314cf11afSPaul Mackerras } 1245474c120SMichael Hanselmann mutex_unlock(&pmac_backlight_mutex); 12514cf11afSPaul Mackerras #endif 12614cf11afSPaul Mackerras printk("Oops: %s, sig: %ld [#%d]\n", str, err, ++die_counter); 12714cf11afSPaul Mackerras #ifdef CONFIG_PREEMPT 12814cf11afSPaul Mackerras printk("PREEMPT "); 12914cf11afSPaul Mackerras #endif 13014cf11afSPaul Mackerras #ifdef CONFIG_SMP 13114cf11afSPaul Mackerras printk("SMP NR_CPUS=%d ", NR_CPUS); 13214cf11afSPaul Mackerras #endif 13314cf11afSPaul Mackerras #ifdef CONFIG_DEBUG_PAGEALLOC 13414cf11afSPaul Mackerras printk("DEBUG_PAGEALLOC "); 13514cf11afSPaul Mackerras #endif 13614cf11afSPaul Mackerras #ifdef CONFIG_NUMA 13714cf11afSPaul Mackerras printk("NUMA "); 13814cf11afSPaul Mackerras #endif 139e8222502SBenjamin Herrenschmidt printk("%s\n", ppc_md.name ? "" : ppc_md.name); 140e8222502SBenjamin Herrenschmidt 14114cf11afSPaul Mackerras print_modules(); 14214cf11afSPaul Mackerras show_regs(regs); 14314cf11afSPaul Mackerras bust_spinlocks(0); 144*c0ce7d08SDavid Wilder spin_unlock_irq(&die_lock); 145cc532915SMichael Ellerman 146*c0ce7d08SDavid Wilder if (kexec_should_crash(current) || 147*c0ce7d08SDavid Wilder kexec_sr_activated(smp_processor_id())) 148cc532915SMichael Ellerman crash_kexec(regs); 149*c0ce7d08SDavid Wilder crash_kexec_secondary(regs); 15014cf11afSPaul Mackerras 15114cf11afSPaul Mackerras if (in_interrupt()) 15214cf11afSPaul Mackerras panic("Fatal exception in interrupt"); 15314cf11afSPaul Mackerras 15414cf11afSPaul Mackerras if (panic_on_oops) { 155dc1c1ca3SStephen Rothwell #ifdef CONFIG_PPC64 156dc1c1ca3SStephen Rothwell printk(KERN_EMERG "Fatal exception: panic in 5 seconds\n"); 157dc1c1ca3SStephen Rothwell ssleep(5); 158dc1c1ca3SStephen Rothwell #endif 15914cf11afSPaul Mackerras panic("Fatal exception"); 16014cf11afSPaul Mackerras } 16114cf11afSPaul Mackerras do_exit(err); 16214cf11afSPaul Mackerras 16314cf11afSPaul Mackerras return 0; 16414cf11afSPaul Mackerras } 16514cf11afSPaul Mackerras 16614cf11afSPaul Mackerras void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr) 16714cf11afSPaul Mackerras { 16814cf11afSPaul Mackerras siginfo_t info; 16914cf11afSPaul Mackerras 17014cf11afSPaul Mackerras if (!user_mode(regs)) { 17114cf11afSPaul Mackerras if (die("Exception in kernel mode", regs, signr)) 17214cf11afSPaul Mackerras return; 17314cf11afSPaul Mackerras } 17414cf11afSPaul Mackerras 17514cf11afSPaul Mackerras memset(&info, 0, sizeof(info)); 17614cf11afSPaul Mackerras info.si_signo = signr; 17714cf11afSPaul Mackerras info.si_code = code; 17814cf11afSPaul Mackerras info.si_addr = (void __user *) addr; 17914cf11afSPaul Mackerras force_sig_info(signr, &info, current); 18014cf11afSPaul Mackerras 18114cf11afSPaul Mackerras /* 18214cf11afSPaul Mackerras * Init gets no signals that it doesn't have a handler for. 18314cf11afSPaul Mackerras * That's all very well, but if it has caused a synchronous 18414cf11afSPaul Mackerras * exception and we ignore the resulting signal, it will just 18514cf11afSPaul Mackerras * generate the same exception over and over again and we get 18614cf11afSPaul Mackerras * nowhere. Better to kill it and let the kernel panic. 18714cf11afSPaul Mackerras */ 18814cf11afSPaul Mackerras if (current->pid == 1) { 18914cf11afSPaul Mackerras __sighandler_t handler; 19014cf11afSPaul Mackerras 19114cf11afSPaul Mackerras spin_lock_irq(¤t->sighand->siglock); 19214cf11afSPaul Mackerras handler = current->sighand->action[signr-1].sa.sa_handler; 19314cf11afSPaul Mackerras spin_unlock_irq(¤t->sighand->siglock); 19414cf11afSPaul Mackerras if (handler == SIG_DFL) { 19514cf11afSPaul Mackerras /* init has generated a synchronous exception 19614cf11afSPaul Mackerras and it doesn't have a handler for the signal */ 19714cf11afSPaul Mackerras printk(KERN_CRIT "init has generated signal %d " 19814cf11afSPaul Mackerras "but has no handler for it\n", signr); 19914cf11afSPaul Mackerras do_exit(signr); 20014cf11afSPaul Mackerras } 20114cf11afSPaul Mackerras } 20214cf11afSPaul Mackerras } 20314cf11afSPaul Mackerras 20414cf11afSPaul Mackerras #ifdef CONFIG_PPC64 20514cf11afSPaul Mackerras void system_reset_exception(struct pt_regs *regs) 20614cf11afSPaul Mackerras { 20714cf11afSPaul Mackerras /* See if any machine dependent calls */ 208c902be71SArnd Bergmann if (ppc_md.system_reset_exception) { 209c902be71SArnd Bergmann if (ppc_md.system_reset_exception(regs)) 210c902be71SArnd Bergmann return; 211c902be71SArnd Bergmann } 21214cf11afSPaul Mackerras 213*c0ce7d08SDavid Wilder #ifdef CONFIG_KEXEC 214*c0ce7d08SDavid Wilder cpu_set(smp_processor_id(), cpus_in_sr); 215*c0ce7d08SDavid Wilder #endif 216*c0ce7d08SDavid Wilder 2178dad3f92SPaul Mackerras die("System Reset", regs, SIGABRT); 21814cf11afSPaul Mackerras 21914cf11afSPaul Mackerras /* Must die if the interrupt is not recoverable */ 22014cf11afSPaul Mackerras if (!(regs->msr & MSR_RI)) 22114cf11afSPaul Mackerras panic("Unrecoverable System Reset"); 22214cf11afSPaul Mackerras 22314cf11afSPaul Mackerras /* What should we do here? We could issue a shutdown or hard reset. */ 22414cf11afSPaul Mackerras } 22514cf11afSPaul Mackerras #endif 22614cf11afSPaul Mackerras 22714cf11afSPaul Mackerras /* 22814cf11afSPaul Mackerras * I/O accesses can cause machine checks on powermacs. 22914cf11afSPaul Mackerras * Check if the NIP corresponds to the address of a sync 23014cf11afSPaul Mackerras * instruction for which there is an entry in the exception 23114cf11afSPaul Mackerras * table. 23214cf11afSPaul Mackerras * Note that the 601 only takes a machine check on TEA 23314cf11afSPaul Mackerras * (transfer error ack) signal assertion, and does not 23414cf11afSPaul Mackerras * set any of the top 16 bits of SRR1. 23514cf11afSPaul Mackerras * -- paulus. 23614cf11afSPaul Mackerras */ 23714cf11afSPaul Mackerras static inline int check_io_access(struct pt_regs *regs) 23814cf11afSPaul Mackerras { 2391a6a4ffeSKumar Gala #if defined(CONFIG_PPC_PMAC) && defined(CONFIG_PPC32) 24014cf11afSPaul Mackerras unsigned long msr = regs->msr; 24114cf11afSPaul Mackerras const struct exception_table_entry *entry; 24214cf11afSPaul Mackerras unsigned int *nip = (unsigned int *)regs->nip; 24314cf11afSPaul Mackerras 24414cf11afSPaul Mackerras if (((msr & 0xffff0000) == 0 || (msr & (0x80000 | 0x40000))) 24514cf11afSPaul Mackerras && (entry = search_exception_tables(regs->nip)) != NULL) { 24614cf11afSPaul Mackerras /* 24714cf11afSPaul Mackerras * Check that it's a sync instruction, or somewhere 24814cf11afSPaul Mackerras * in the twi; isync; nop sequence that inb/inw/inl uses. 24914cf11afSPaul Mackerras * As the address is in the exception table 25014cf11afSPaul Mackerras * we should be able to read the instr there. 25114cf11afSPaul Mackerras * For the debug message, we look at the preceding 25214cf11afSPaul Mackerras * load or store. 25314cf11afSPaul Mackerras */ 25414cf11afSPaul Mackerras if (*nip == 0x60000000) /* nop */ 25514cf11afSPaul Mackerras nip -= 2; 25614cf11afSPaul Mackerras else if (*nip == 0x4c00012c) /* isync */ 25714cf11afSPaul Mackerras --nip; 25814cf11afSPaul Mackerras if (*nip == 0x7c0004ac || (*nip >> 26) == 3) { 25914cf11afSPaul Mackerras /* sync or twi */ 26014cf11afSPaul Mackerras unsigned int rb; 26114cf11afSPaul Mackerras 26214cf11afSPaul Mackerras --nip; 26314cf11afSPaul Mackerras rb = (*nip >> 11) & 0x1f; 26414cf11afSPaul Mackerras printk(KERN_DEBUG "%s bad port %lx at %p\n", 26514cf11afSPaul Mackerras (*nip & 0x100)? "OUT to": "IN from", 26614cf11afSPaul Mackerras regs->gpr[rb] - _IO_BASE, nip); 26714cf11afSPaul Mackerras regs->msr |= MSR_RI; 26814cf11afSPaul Mackerras regs->nip = entry->fixup; 26914cf11afSPaul Mackerras return 1; 27014cf11afSPaul Mackerras } 27114cf11afSPaul Mackerras } 2721a6a4ffeSKumar Gala #endif /* CONFIG_PPC_PMAC && CONFIG_PPC32 */ 27314cf11afSPaul Mackerras return 0; 27414cf11afSPaul Mackerras } 27514cf11afSPaul Mackerras 27614cf11afSPaul Mackerras #if defined(CONFIG_4xx) || defined(CONFIG_BOOKE) 27714cf11afSPaul Mackerras /* On 4xx, the reason for the machine check or program exception 27814cf11afSPaul Mackerras is in the ESR. */ 27914cf11afSPaul Mackerras #define get_reason(regs) ((regs)->dsisr) 28014cf11afSPaul Mackerras #ifndef CONFIG_FSL_BOOKE 28114cf11afSPaul Mackerras #define get_mc_reason(regs) ((regs)->dsisr) 28214cf11afSPaul Mackerras #else 28314cf11afSPaul Mackerras #define get_mc_reason(regs) (mfspr(SPRN_MCSR)) 28414cf11afSPaul Mackerras #endif 28514cf11afSPaul Mackerras #define REASON_FP ESR_FP 28614cf11afSPaul Mackerras #define REASON_ILLEGAL (ESR_PIL | ESR_PUO) 28714cf11afSPaul Mackerras #define REASON_PRIVILEGED ESR_PPR 28814cf11afSPaul Mackerras #define REASON_TRAP ESR_PTR 28914cf11afSPaul Mackerras 29014cf11afSPaul Mackerras /* single-step stuff */ 29114cf11afSPaul Mackerras #define single_stepping(regs) (current->thread.dbcr0 & DBCR0_IC) 29214cf11afSPaul Mackerras #define clear_single_step(regs) (current->thread.dbcr0 &= ~DBCR0_IC) 29314cf11afSPaul Mackerras 29414cf11afSPaul Mackerras #else 29514cf11afSPaul Mackerras /* On non-4xx, the reason for the machine check or program 29614cf11afSPaul Mackerras exception is in the MSR. */ 29714cf11afSPaul Mackerras #define get_reason(regs) ((regs)->msr) 29814cf11afSPaul Mackerras #define get_mc_reason(regs) ((regs)->msr) 29914cf11afSPaul Mackerras #define REASON_FP 0x100000 30014cf11afSPaul Mackerras #define REASON_ILLEGAL 0x80000 30114cf11afSPaul Mackerras #define REASON_PRIVILEGED 0x40000 30214cf11afSPaul Mackerras #define REASON_TRAP 0x20000 30314cf11afSPaul Mackerras 30414cf11afSPaul Mackerras #define single_stepping(regs) ((regs)->msr & MSR_SE) 30514cf11afSPaul Mackerras #define clear_single_step(regs) ((regs)->msr &= ~MSR_SE) 30614cf11afSPaul Mackerras #endif 30714cf11afSPaul Mackerras 30814cf11afSPaul Mackerras /* 30914cf11afSPaul Mackerras * This is "fall-back" implementation for configurations 31014cf11afSPaul Mackerras * which don't provide platform-specific machine check info 31114cf11afSPaul Mackerras */ 31214cf11afSPaul Mackerras void __attribute__ ((weak)) 31314cf11afSPaul Mackerras platform_machine_check(struct pt_regs *regs) 31414cf11afSPaul Mackerras { 31514cf11afSPaul Mackerras } 31614cf11afSPaul Mackerras 317dc1c1ca3SStephen Rothwell void machine_check_exception(struct pt_regs *regs) 31814cf11afSPaul Mackerras { 31914cf11afSPaul Mackerras int recover = 0; 3201a6a4ffeSKumar Gala unsigned long reason = get_mc_reason(regs); 32114cf11afSPaul Mackerras 32214cf11afSPaul Mackerras /* See if any machine dependent calls */ 32314cf11afSPaul Mackerras if (ppc_md.machine_check_exception) 32414cf11afSPaul Mackerras recover = ppc_md.machine_check_exception(regs); 32514cf11afSPaul Mackerras 32614cf11afSPaul Mackerras if (recover) 32714cf11afSPaul Mackerras return; 32814cf11afSPaul Mackerras 32914cf11afSPaul Mackerras if (user_mode(regs)) { 33014cf11afSPaul Mackerras regs->msr |= MSR_RI; 33114cf11afSPaul Mackerras _exception(SIGBUS, regs, BUS_ADRERR, regs->nip); 33214cf11afSPaul Mackerras return; 33314cf11afSPaul Mackerras } 33414cf11afSPaul Mackerras 33514cf11afSPaul Mackerras #if defined(CONFIG_8xx) && defined(CONFIG_PCI) 33614cf11afSPaul Mackerras /* the qspan pci read routines can cause machine checks -- Cort */ 33714cf11afSPaul Mackerras bad_page_fault(regs, regs->dar, SIGBUS); 33814cf11afSPaul Mackerras return; 33914cf11afSPaul Mackerras #endif 34014cf11afSPaul Mackerras 34114cf11afSPaul Mackerras if (debugger_fault_handler(regs)) { 34214cf11afSPaul Mackerras regs->msr |= MSR_RI; 34314cf11afSPaul Mackerras return; 34414cf11afSPaul Mackerras } 34514cf11afSPaul Mackerras 34614cf11afSPaul Mackerras if (check_io_access(regs)) 34714cf11afSPaul Mackerras return; 34814cf11afSPaul Mackerras 34914cf11afSPaul Mackerras #if defined(CONFIG_4xx) && !defined(CONFIG_440A) 35014cf11afSPaul Mackerras if (reason & ESR_IMCP) { 35114cf11afSPaul Mackerras printk("Instruction"); 35214cf11afSPaul Mackerras mtspr(SPRN_ESR, reason & ~ESR_IMCP); 35314cf11afSPaul Mackerras } else 35414cf11afSPaul Mackerras printk("Data"); 35514cf11afSPaul Mackerras printk(" machine check in kernel mode.\n"); 35614cf11afSPaul Mackerras #elif defined(CONFIG_440A) 35714cf11afSPaul Mackerras printk("Machine check in kernel mode.\n"); 35814cf11afSPaul Mackerras if (reason & ESR_IMCP){ 35914cf11afSPaul Mackerras printk("Instruction Synchronous Machine Check exception\n"); 36014cf11afSPaul Mackerras mtspr(SPRN_ESR, reason & ~ESR_IMCP); 36114cf11afSPaul Mackerras } 36214cf11afSPaul Mackerras else { 36314cf11afSPaul Mackerras u32 mcsr = mfspr(SPRN_MCSR); 36414cf11afSPaul Mackerras if (mcsr & MCSR_IB) 36514cf11afSPaul Mackerras printk("Instruction Read PLB Error\n"); 36614cf11afSPaul Mackerras if (mcsr & MCSR_DRB) 36714cf11afSPaul Mackerras printk("Data Read PLB Error\n"); 36814cf11afSPaul Mackerras if (mcsr & MCSR_DWB) 36914cf11afSPaul Mackerras printk("Data Write PLB Error\n"); 37014cf11afSPaul Mackerras if (mcsr & MCSR_TLBP) 37114cf11afSPaul Mackerras printk("TLB Parity Error\n"); 37214cf11afSPaul Mackerras if (mcsr & MCSR_ICP){ 37314cf11afSPaul Mackerras flush_instruction_cache(); 37414cf11afSPaul Mackerras printk("I-Cache Parity Error\n"); 37514cf11afSPaul Mackerras } 37614cf11afSPaul Mackerras if (mcsr & MCSR_DCSP) 37714cf11afSPaul Mackerras printk("D-Cache Search Parity Error\n"); 37814cf11afSPaul Mackerras if (mcsr & MCSR_DCFP) 37914cf11afSPaul Mackerras printk("D-Cache Flush Parity Error\n"); 38014cf11afSPaul Mackerras if (mcsr & MCSR_IMPE) 38114cf11afSPaul Mackerras printk("Machine Check exception is imprecise\n"); 38214cf11afSPaul Mackerras 38314cf11afSPaul Mackerras /* Clear MCSR */ 38414cf11afSPaul Mackerras mtspr(SPRN_MCSR, mcsr); 38514cf11afSPaul Mackerras } 38614cf11afSPaul Mackerras #elif defined (CONFIG_E500) 38714cf11afSPaul Mackerras printk("Machine check in kernel mode.\n"); 38814cf11afSPaul Mackerras printk("Caused by (from MCSR=%lx): ", reason); 38914cf11afSPaul Mackerras 39014cf11afSPaul Mackerras if (reason & MCSR_MCP) 39114cf11afSPaul Mackerras printk("Machine Check Signal\n"); 39214cf11afSPaul Mackerras if (reason & MCSR_ICPERR) 39314cf11afSPaul Mackerras printk("Instruction Cache Parity Error\n"); 39414cf11afSPaul Mackerras if (reason & MCSR_DCP_PERR) 39514cf11afSPaul Mackerras printk("Data Cache Push Parity Error\n"); 39614cf11afSPaul Mackerras if (reason & MCSR_DCPERR) 39714cf11afSPaul Mackerras printk("Data Cache Parity Error\n"); 39814cf11afSPaul Mackerras if (reason & MCSR_GL_CI) 39914cf11afSPaul Mackerras printk("Guarded Load or Cache-Inhibited stwcx.\n"); 40014cf11afSPaul Mackerras if (reason & MCSR_BUS_IAERR) 40114cf11afSPaul Mackerras printk("Bus - Instruction Address Error\n"); 40214cf11afSPaul Mackerras if (reason & MCSR_BUS_RAERR) 40314cf11afSPaul Mackerras printk("Bus - Read Address Error\n"); 40414cf11afSPaul Mackerras if (reason & MCSR_BUS_WAERR) 40514cf11afSPaul Mackerras printk("Bus - Write Address Error\n"); 40614cf11afSPaul Mackerras if (reason & MCSR_BUS_IBERR) 40714cf11afSPaul Mackerras printk("Bus - Instruction Data Error\n"); 40814cf11afSPaul Mackerras if (reason & MCSR_BUS_RBERR) 40914cf11afSPaul Mackerras printk("Bus - Read Data Bus Error\n"); 41014cf11afSPaul Mackerras if (reason & MCSR_BUS_WBERR) 41114cf11afSPaul Mackerras printk("Bus - Read Data Bus Error\n"); 41214cf11afSPaul Mackerras if (reason & MCSR_BUS_IPERR) 41314cf11afSPaul Mackerras printk("Bus - Instruction Parity Error\n"); 41414cf11afSPaul Mackerras if (reason & MCSR_BUS_RPERR) 41514cf11afSPaul Mackerras printk("Bus - Read Parity Error\n"); 41614cf11afSPaul Mackerras #elif defined (CONFIG_E200) 41714cf11afSPaul Mackerras printk("Machine check in kernel mode.\n"); 41814cf11afSPaul Mackerras printk("Caused by (from MCSR=%lx): ", reason); 41914cf11afSPaul Mackerras 42014cf11afSPaul Mackerras if (reason & MCSR_MCP) 42114cf11afSPaul Mackerras printk("Machine Check Signal\n"); 42214cf11afSPaul Mackerras if (reason & MCSR_CP_PERR) 42314cf11afSPaul Mackerras printk("Cache Push Parity Error\n"); 42414cf11afSPaul Mackerras if (reason & MCSR_CPERR) 42514cf11afSPaul Mackerras printk("Cache Parity Error\n"); 42614cf11afSPaul Mackerras if (reason & MCSR_EXCP_ERR) 42714cf11afSPaul Mackerras printk("ISI, ITLB, or Bus Error on first instruction fetch for an exception handler\n"); 42814cf11afSPaul Mackerras if (reason & MCSR_BUS_IRERR) 42914cf11afSPaul Mackerras printk("Bus - Read Bus Error on instruction fetch\n"); 43014cf11afSPaul Mackerras if (reason & MCSR_BUS_DRERR) 43114cf11afSPaul Mackerras printk("Bus - Read Bus Error on data load\n"); 43214cf11afSPaul Mackerras if (reason & MCSR_BUS_WRERR) 43314cf11afSPaul Mackerras printk("Bus - Write Bus Error on buffered store or cache line push\n"); 43414cf11afSPaul Mackerras #else /* !CONFIG_4xx && !CONFIG_E500 && !CONFIG_E200 */ 43514cf11afSPaul Mackerras printk("Machine check in kernel mode.\n"); 43614cf11afSPaul Mackerras printk("Caused by (from SRR1=%lx): ", reason); 43714cf11afSPaul Mackerras switch (reason & 0x601F0000) { 43814cf11afSPaul Mackerras case 0x80000: 43914cf11afSPaul Mackerras printk("Machine check signal\n"); 44014cf11afSPaul Mackerras break; 44114cf11afSPaul Mackerras case 0: /* for 601 */ 44214cf11afSPaul Mackerras case 0x40000: 44314cf11afSPaul Mackerras case 0x140000: /* 7450 MSS error and TEA */ 44414cf11afSPaul Mackerras printk("Transfer error ack signal\n"); 44514cf11afSPaul Mackerras break; 44614cf11afSPaul Mackerras case 0x20000: 44714cf11afSPaul Mackerras printk("Data parity error signal\n"); 44814cf11afSPaul Mackerras break; 44914cf11afSPaul Mackerras case 0x10000: 45014cf11afSPaul Mackerras printk("Address parity error signal\n"); 45114cf11afSPaul Mackerras break; 45214cf11afSPaul Mackerras case 0x20000000: 45314cf11afSPaul Mackerras printk("L1 Data Cache error\n"); 45414cf11afSPaul Mackerras break; 45514cf11afSPaul Mackerras case 0x40000000: 45614cf11afSPaul Mackerras printk("L1 Instruction Cache error\n"); 45714cf11afSPaul Mackerras break; 45814cf11afSPaul Mackerras case 0x00100000: 45914cf11afSPaul Mackerras printk("L2 data cache parity error\n"); 46014cf11afSPaul Mackerras break; 46114cf11afSPaul Mackerras default: 46214cf11afSPaul Mackerras printk("Unknown values in msr\n"); 46314cf11afSPaul Mackerras } 46414cf11afSPaul Mackerras #endif /* CONFIG_4xx */ 46514cf11afSPaul Mackerras 46614cf11afSPaul Mackerras /* 46714cf11afSPaul Mackerras * Optional platform-provided routine to print out 46814cf11afSPaul Mackerras * additional info, e.g. bus error registers. 46914cf11afSPaul Mackerras */ 47014cf11afSPaul Mackerras platform_machine_check(regs); 47114cf11afSPaul Mackerras 47214cf11afSPaul Mackerras if (debugger_fault_handler(regs)) 47314cf11afSPaul Mackerras return; 4748dad3f92SPaul Mackerras die("Machine check", regs, SIGBUS); 47514cf11afSPaul Mackerras 47614cf11afSPaul Mackerras /* Must die if the interrupt is not recoverable */ 47714cf11afSPaul Mackerras if (!(regs->msr & MSR_RI)) 47814cf11afSPaul Mackerras panic("Unrecoverable Machine check"); 47914cf11afSPaul Mackerras } 48014cf11afSPaul Mackerras 48114cf11afSPaul Mackerras void SMIException(struct pt_regs *regs) 48214cf11afSPaul Mackerras { 48314cf11afSPaul Mackerras die("System Management Interrupt", regs, SIGABRT); 48414cf11afSPaul Mackerras } 48514cf11afSPaul Mackerras 486dc1c1ca3SStephen Rothwell void unknown_exception(struct pt_regs *regs) 48714cf11afSPaul Mackerras { 48814cf11afSPaul Mackerras printk("Bad trap at PC: %lx, SR: %lx, vector=%lx\n", 48914cf11afSPaul Mackerras regs->nip, regs->msr, regs->trap); 49014cf11afSPaul Mackerras 49114cf11afSPaul Mackerras _exception(SIGTRAP, regs, 0, 0); 49214cf11afSPaul Mackerras } 49314cf11afSPaul Mackerras 494dc1c1ca3SStephen Rothwell void instruction_breakpoint_exception(struct pt_regs *regs) 49514cf11afSPaul Mackerras { 49614cf11afSPaul Mackerras if (notify_die(DIE_IABR_MATCH, "iabr_match", regs, 5, 49714cf11afSPaul Mackerras 5, SIGTRAP) == NOTIFY_STOP) 49814cf11afSPaul Mackerras return; 49914cf11afSPaul Mackerras if (debugger_iabr_match(regs)) 50014cf11afSPaul Mackerras return; 50114cf11afSPaul Mackerras _exception(SIGTRAP, regs, TRAP_BRKPT, regs->nip); 50214cf11afSPaul Mackerras } 50314cf11afSPaul Mackerras 50414cf11afSPaul Mackerras void RunModeException(struct pt_regs *regs) 50514cf11afSPaul Mackerras { 50614cf11afSPaul Mackerras _exception(SIGTRAP, regs, 0, 0); 50714cf11afSPaul Mackerras } 50814cf11afSPaul Mackerras 5098dad3f92SPaul Mackerras void __kprobes single_step_exception(struct pt_regs *regs) 51014cf11afSPaul Mackerras { 51114cf11afSPaul Mackerras regs->msr &= ~(MSR_SE | MSR_BE); /* Turn off 'trace' bits */ 51214cf11afSPaul Mackerras 51314cf11afSPaul Mackerras if (notify_die(DIE_SSTEP, "single_step", regs, 5, 51414cf11afSPaul Mackerras 5, SIGTRAP) == NOTIFY_STOP) 51514cf11afSPaul Mackerras return; 51614cf11afSPaul Mackerras if (debugger_sstep(regs)) 51714cf11afSPaul Mackerras return; 51814cf11afSPaul Mackerras 51914cf11afSPaul Mackerras _exception(SIGTRAP, regs, TRAP_TRACE, regs->nip); 52014cf11afSPaul Mackerras } 52114cf11afSPaul Mackerras 52214cf11afSPaul Mackerras /* 52314cf11afSPaul Mackerras * After we have successfully emulated an instruction, we have to 52414cf11afSPaul Mackerras * check if the instruction was being single-stepped, and if so, 52514cf11afSPaul Mackerras * pretend we got a single-step exception. This was pointed out 52614cf11afSPaul Mackerras * by Kumar Gala. -- paulus 52714cf11afSPaul Mackerras */ 5288dad3f92SPaul Mackerras static void emulate_single_step(struct pt_regs *regs) 52914cf11afSPaul Mackerras { 53014cf11afSPaul Mackerras if (single_stepping(regs)) { 53114cf11afSPaul Mackerras clear_single_step(regs); 53214cf11afSPaul Mackerras _exception(SIGTRAP, regs, TRAP_TRACE, 0); 53314cf11afSPaul Mackerras } 53414cf11afSPaul Mackerras } 53514cf11afSPaul Mackerras 536dc1c1ca3SStephen Rothwell static void parse_fpe(struct pt_regs *regs) 537dc1c1ca3SStephen Rothwell { 538dc1c1ca3SStephen Rothwell int code = 0; 539dc1c1ca3SStephen Rothwell unsigned long fpscr; 540dc1c1ca3SStephen Rothwell 541dc1c1ca3SStephen Rothwell flush_fp_to_thread(current); 542dc1c1ca3SStephen Rothwell 54325c8a78bSDavid Gibson fpscr = current->thread.fpscr.val; 544dc1c1ca3SStephen Rothwell 545dc1c1ca3SStephen Rothwell /* Invalid operation */ 546dc1c1ca3SStephen Rothwell if ((fpscr & FPSCR_VE) && (fpscr & FPSCR_VX)) 547dc1c1ca3SStephen Rothwell code = FPE_FLTINV; 548dc1c1ca3SStephen Rothwell 549dc1c1ca3SStephen Rothwell /* Overflow */ 550dc1c1ca3SStephen Rothwell else if ((fpscr & FPSCR_OE) && (fpscr & FPSCR_OX)) 551dc1c1ca3SStephen Rothwell code = FPE_FLTOVF; 552dc1c1ca3SStephen Rothwell 553dc1c1ca3SStephen Rothwell /* Underflow */ 554dc1c1ca3SStephen Rothwell else if ((fpscr & FPSCR_UE) && (fpscr & FPSCR_UX)) 555dc1c1ca3SStephen Rothwell code = FPE_FLTUND; 556dc1c1ca3SStephen Rothwell 557dc1c1ca3SStephen Rothwell /* Divide by zero */ 558dc1c1ca3SStephen Rothwell else if ((fpscr & FPSCR_ZE) && (fpscr & FPSCR_ZX)) 559dc1c1ca3SStephen Rothwell code = FPE_FLTDIV; 560dc1c1ca3SStephen Rothwell 561dc1c1ca3SStephen Rothwell /* Inexact result */ 562dc1c1ca3SStephen Rothwell else if ((fpscr & FPSCR_XE) && (fpscr & FPSCR_XX)) 563dc1c1ca3SStephen Rothwell code = FPE_FLTRES; 564dc1c1ca3SStephen Rothwell 565dc1c1ca3SStephen Rothwell _exception(SIGFPE, regs, code, regs->nip); 566dc1c1ca3SStephen Rothwell } 567dc1c1ca3SStephen Rothwell 568dc1c1ca3SStephen Rothwell /* 569dc1c1ca3SStephen Rothwell * Illegal instruction emulation support. Originally written to 57014cf11afSPaul Mackerras * provide the PVR to user applications using the mfspr rd, PVR. 57114cf11afSPaul Mackerras * Return non-zero if we can't emulate, or -EFAULT if the associated 57214cf11afSPaul Mackerras * memory access caused an access fault. Return zero on success. 57314cf11afSPaul Mackerras * 57414cf11afSPaul Mackerras * There are a couple of ways to do this, either "decode" the instruction 57514cf11afSPaul Mackerras * or directly match lots of bits. In this case, matching lots of 57614cf11afSPaul Mackerras * bits is faster and easier. 57786417780SPaul Mackerras * 57814cf11afSPaul Mackerras */ 57914cf11afSPaul Mackerras #define INST_MFSPR_PVR 0x7c1f42a6 58014cf11afSPaul Mackerras #define INST_MFSPR_PVR_MASK 0xfc1fffff 58114cf11afSPaul Mackerras 58214cf11afSPaul Mackerras #define INST_DCBA 0x7c0005ec 58314cf11afSPaul Mackerras #define INST_DCBA_MASK 0x7c0007fe 58414cf11afSPaul Mackerras 58514cf11afSPaul Mackerras #define INST_MCRXR 0x7c000400 58614cf11afSPaul Mackerras #define INST_MCRXR_MASK 0x7c0007fe 58714cf11afSPaul Mackerras 58814cf11afSPaul Mackerras #define INST_STRING 0x7c00042a 58914cf11afSPaul Mackerras #define INST_STRING_MASK 0x7c0007fe 59014cf11afSPaul Mackerras #define INST_STRING_GEN_MASK 0x7c00067e 59114cf11afSPaul Mackerras #define INST_LSWI 0x7c0004aa 59214cf11afSPaul Mackerras #define INST_LSWX 0x7c00042a 59314cf11afSPaul Mackerras #define INST_STSWI 0x7c0005aa 59414cf11afSPaul Mackerras #define INST_STSWX 0x7c00052a 59514cf11afSPaul Mackerras 59614cf11afSPaul Mackerras static int emulate_string_inst(struct pt_regs *regs, u32 instword) 59714cf11afSPaul Mackerras { 59814cf11afSPaul Mackerras u8 rT = (instword >> 21) & 0x1f; 59914cf11afSPaul Mackerras u8 rA = (instword >> 16) & 0x1f; 60014cf11afSPaul Mackerras u8 NB_RB = (instword >> 11) & 0x1f; 60114cf11afSPaul Mackerras u32 num_bytes; 60214cf11afSPaul Mackerras unsigned long EA; 60314cf11afSPaul Mackerras int pos = 0; 60414cf11afSPaul Mackerras 60514cf11afSPaul Mackerras /* Early out if we are an invalid form of lswx */ 60614cf11afSPaul Mackerras if ((instword & INST_STRING_MASK) == INST_LSWX) 60714cf11afSPaul Mackerras if ((rT == rA) || (rT == NB_RB)) 60814cf11afSPaul Mackerras return -EINVAL; 60914cf11afSPaul Mackerras 61014cf11afSPaul Mackerras EA = (rA == 0) ? 0 : regs->gpr[rA]; 61114cf11afSPaul Mackerras 61214cf11afSPaul Mackerras switch (instword & INST_STRING_MASK) { 61314cf11afSPaul Mackerras case INST_LSWX: 61414cf11afSPaul Mackerras case INST_STSWX: 61514cf11afSPaul Mackerras EA += NB_RB; 61614cf11afSPaul Mackerras num_bytes = regs->xer & 0x7f; 61714cf11afSPaul Mackerras break; 61814cf11afSPaul Mackerras case INST_LSWI: 61914cf11afSPaul Mackerras case INST_STSWI: 62014cf11afSPaul Mackerras num_bytes = (NB_RB == 0) ? 32 : NB_RB; 62114cf11afSPaul Mackerras break; 62214cf11afSPaul Mackerras default: 62314cf11afSPaul Mackerras return -EINVAL; 62414cf11afSPaul Mackerras } 62514cf11afSPaul Mackerras 62614cf11afSPaul Mackerras while (num_bytes != 0) 62714cf11afSPaul Mackerras { 62814cf11afSPaul Mackerras u8 val; 62914cf11afSPaul Mackerras u32 shift = 8 * (3 - (pos & 0x3)); 63014cf11afSPaul Mackerras 63114cf11afSPaul Mackerras switch ((instword & INST_STRING_MASK)) { 63214cf11afSPaul Mackerras case INST_LSWX: 63314cf11afSPaul Mackerras case INST_LSWI: 63414cf11afSPaul Mackerras if (get_user(val, (u8 __user *)EA)) 63514cf11afSPaul Mackerras return -EFAULT; 63614cf11afSPaul Mackerras /* first time updating this reg, 63714cf11afSPaul Mackerras * zero it out */ 63814cf11afSPaul Mackerras if (pos == 0) 63914cf11afSPaul Mackerras regs->gpr[rT] = 0; 64014cf11afSPaul Mackerras regs->gpr[rT] |= val << shift; 64114cf11afSPaul Mackerras break; 64214cf11afSPaul Mackerras case INST_STSWI: 64314cf11afSPaul Mackerras case INST_STSWX: 64414cf11afSPaul Mackerras val = regs->gpr[rT] >> shift; 64514cf11afSPaul Mackerras if (put_user(val, (u8 __user *)EA)) 64614cf11afSPaul Mackerras return -EFAULT; 64714cf11afSPaul Mackerras break; 64814cf11afSPaul Mackerras } 64914cf11afSPaul Mackerras /* move EA to next address */ 65014cf11afSPaul Mackerras EA += 1; 65114cf11afSPaul Mackerras num_bytes--; 65214cf11afSPaul Mackerras 65314cf11afSPaul Mackerras /* manage our position within the register */ 65414cf11afSPaul Mackerras if (++pos == 4) { 65514cf11afSPaul Mackerras pos = 0; 65614cf11afSPaul Mackerras if (++rT == 32) 65714cf11afSPaul Mackerras rT = 0; 65814cf11afSPaul Mackerras } 65914cf11afSPaul Mackerras } 66014cf11afSPaul Mackerras 66114cf11afSPaul Mackerras return 0; 66214cf11afSPaul Mackerras } 66314cf11afSPaul Mackerras 66414cf11afSPaul Mackerras static int emulate_instruction(struct pt_regs *regs) 66514cf11afSPaul Mackerras { 66614cf11afSPaul Mackerras u32 instword; 66714cf11afSPaul Mackerras u32 rd; 66814cf11afSPaul Mackerras 669fab5db97SPaul Mackerras if (!user_mode(regs) || (regs->msr & MSR_LE)) 67014cf11afSPaul Mackerras return -EINVAL; 67114cf11afSPaul Mackerras CHECK_FULL_REGS(regs); 67214cf11afSPaul Mackerras 67314cf11afSPaul Mackerras if (get_user(instword, (u32 __user *)(regs->nip))) 67414cf11afSPaul Mackerras return -EFAULT; 67514cf11afSPaul Mackerras 67614cf11afSPaul Mackerras /* Emulate the mfspr rD, PVR. */ 67714cf11afSPaul Mackerras if ((instword & INST_MFSPR_PVR_MASK) == INST_MFSPR_PVR) { 67814cf11afSPaul Mackerras rd = (instword >> 21) & 0x1f; 67914cf11afSPaul Mackerras regs->gpr[rd] = mfspr(SPRN_PVR); 68014cf11afSPaul Mackerras return 0; 68114cf11afSPaul Mackerras } 68214cf11afSPaul Mackerras 68314cf11afSPaul Mackerras /* Emulating the dcba insn is just a no-op. */ 6848dad3f92SPaul Mackerras if ((instword & INST_DCBA_MASK) == INST_DCBA) 68514cf11afSPaul Mackerras return 0; 68614cf11afSPaul Mackerras 68714cf11afSPaul Mackerras /* Emulate the mcrxr insn. */ 68814cf11afSPaul Mackerras if ((instword & INST_MCRXR_MASK) == INST_MCRXR) { 68986417780SPaul Mackerras int shift = (instword >> 21) & 0x1c; 69014cf11afSPaul Mackerras unsigned long msk = 0xf0000000UL >> shift; 69114cf11afSPaul Mackerras 69214cf11afSPaul Mackerras regs->ccr = (regs->ccr & ~msk) | ((regs->xer >> shift) & msk); 69314cf11afSPaul Mackerras regs->xer &= ~0xf0000000UL; 69414cf11afSPaul Mackerras return 0; 69514cf11afSPaul Mackerras } 69614cf11afSPaul Mackerras 69714cf11afSPaul Mackerras /* Emulate load/store string insn. */ 69814cf11afSPaul Mackerras if ((instword & INST_STRING_GEN_MASK) == INST_STRING) 69914cf11afSPaul Mackerras return emulate_string_inst(regs, instword); 70014cf11afSPaul Mackerras 70114cf11afSPaul Mackerras return -EINVAL; 70214cf11afSPaul Mackerras } 70314cf11afSPaul Mackerras 70414cf11afSPaul Mackerras /* 70514cf11afSPaul Mackerras * Look through the list of trap instructions that are used for BUG(), 70614cf11afSPaul Mackerras * BUG_ON() and WARN_ON() and see if we hit one. At this point we know 70714cf11afSPaul Mackerras * that the exception was caused by a trap instruction of some kind. 70814cf11afSPaul Mackerras * Returns 1 if we should continue (i.e. it was a WARN_ON) or 0 70914cf11afSPaul Mackerras * otherwise. 71014cf11afSPaul Mackerras */ 71114cf11afSPaul Mackerras extern struct bug_entry __start___bug_table[], __stop___bug_table[]; 71214cf11afSPaul Mackerras 71314cf11afSPaul Mackerras #ifndef CONFIG_MODULES 71414cf11afSPaul Mackerras #define module_find_bug(x) NULL 71514cf11afSPaul Mackerras #endif 71614cf11afSPaul Mackerras 71714cf11afSPaul Mackerras struct bug_entry *find_bug(unsigned long bugaddr) 71814cf11afSPaul Mackerras { 71914cf11afSPaul Mackerras struct bug_entry *bug; 72014cf11afSPaul Mackerras 72114cf11afSPaul Mackerras for (bug = __start___bug_table; bug < __stop___bug_table; ++bug) 72214cf11afSPaul Mackerras if (bugaddr == bug->bug_addr) 72314cf11afSPaul Mackerras return bug; 72414cf11afSPaul Mackerras return module_find_bug(bugaddr); 72514cf11afSPaul Mackerras } 72614cf11afSPaul Mackerras 727dc1c1ca3SStephen Rothwell static int check_bug_trap(struct pt_regs *regs) 72814cf11afSPaul Mackerras { 72914cf11afSPaul Mackerras struct bug_entry *bug; 73014cf11afSPaul Mackerras unsigned long addr; 73114cf11afSPaul Mackerras 73214cf11afSPaul Mackerras if (regs->msr & MSR_PR) 73314cf11afSPaul Mackerras return 0; /* not in kernel */ 73414cf11afSPaul Mackerras addr = regs->nip; /* address of trap instruction */ 73514cf11afSPaul Mackerras if (addr < PAGE_OFFSET) 73614cf11afSPaul Mackerras return 0; 73714cf11afSPaul Mackerras bug = find_bug(regs->nip); 73814cf11afSPaul Mackerras if (bug == NULL) 73914cf11afSPaul Mackerras return 0; 74014cf11afSPaul Mackerras if (bug->line & BUG_WARNING_TRAP) { 74114cf11afSPaul Mackerras /* this is a WARN_ON rather than BUG/BUG_ON */ 742104dd65fSPaul Mackerras printk(KERN_ERR "Badness in %s at %s:%ld\n", 74314cf11afSPaul Mackerras bug->function, bug->file, 74414cf11afSPaul Mackerras bug->line & ~BUG_WARNING_TRAP); 74514cf11afSPaul Mackerras dump_stack(); 74614cf11afSPaul Mackerras return 1; 74714cf11afSPaul Mackerras } 748104dd65fSPaul Mackerras printk(KERN_CRIT "kernel BUG in %s at %s:%ld!\n", 74914cf11afSPaul Mackerras bug->function, bug->file, bug->line); 75014cf11afSPaul Mackerras 75114cf11afSPaul Mackerras return 0; 75214cf11afSPaul Mackerras } 75314cf11afSPaul Mackerras 7548dad3f92SPaul Mackerras void __kprobes program_check_exception(struct pt_regs *regs) 75514cf11afSPaul Mackerras { 75614cf11afSPaul Mackerras unsigned int reason = get_reason(regs); 75714cf11afSPaul Mackerras extern int do_mathemu(struct pt_regs *regs); 75814cf11afSPaul Mackerras 7598dad3f92SPaul Mackerras #ifdef CONFIG_MATH_EMULATION 76014cf11afSPaul Mackerras /* (reason & REASON_ILLEGAL) would be the obvious thing here, 76114cf11afSPaul Mackerras * but there seems to be a hardware bug on the 405GP (RevD) 76214cf11afSPaul Mackerras * that means ESR is sometimes set incorrectly - either to 76314cf11afSPaul Mackerras * ESR_DST (!?) or 0. In the process of chasing this with the 76414cf11afSPaul Mackerras * hardware people - not sure if it can happen on any illegal 76514cf11afSPaul Mackerras * instruction or only on FP instructions, whether there is a 76614cf11afSPaul Mackerras * pattern to occurences etc. -dgibson 31/Mar/2003 */ 76714cf11afSPaul Mackerras if (!(reason & REASON_TRAP) && do_mathemu(regs) == 0) { 76814cf11afSPaul Mackerras emulate_single_step(regs); 76914cf11afSPaul Mackerras return; 77014cf11afSPaul Mackerras } 7718dad3f92SPaul Mackerras #endif /* CONFIG_MATH_EMULATION */ 77214cf11afSPaul Mackerras 77314cf11afSPaul Mackerras if (reason & REASON_FP) { 77414cf11afSPaul Mackerras /* IEEE FP exception */ 775dc1c1ca3SStephen Rothwell parse_fpe(regs); 7768dad3f92SPaul Mackerras return; 7778dad3f92SPaul Mackerras } 7788dad3f92SPaul Mackerras if (reason & REASON_TRAP) { 77914cf11afSPaul Mackerras /* trap exception */ 780dc1c1ca3SStephen Rothwell if (notify_die(DIE_BPT, "breakpoint", regs, 5, 5, SIGTRAP) 781dc1c1ca3SStephen Rothwell == NOTIFY_STOP) 782dc1c1ca3SStephen Rothwell return; 78314cf11afSPaul Mackerras if (debugger_bpt(regs)) 78414cf11afSPaul Mackerras return; 78514cf11afSPaul Mackerras if (check_bug_trap(regs)) { 78614cf11afSPaul Mackerras regs->nip += 4; 78714cf11afSPaul Mackerras return; 78814cf11afSPaul Mackerras } 7898dad3f92SPaul Mackerras _exception(SIGTRAP, regs, TRAP_BRKPT, regs->nip); 7908dad3f92SPaul Mackerras return; 7918dad3f92SPaul Mackerras } 7928dad3f92SPaul Mackerras 793cd8a5673SPaul Mackerras local_irq_enable(); 794cd8a5673SPaul Mackerras 7958dad3f92SPaul Mackerras /* Try to emulate it if we should. */ 7968dad3f92SPaul Mackerras if (reason & (REASON_ILLEGAL | REASON_PRIVILEGED)) { 79714cf11afSPaul Mackerras switch (emulate_instruction(regs)) { 79814cf11afSPaul Mackerras case 0: 79914cf11afSPaul Mackerras regs->nip += 4; 80014cf11afSPaul Mackerras emulate_single_step(regs); 8018dad3f92SPaul Mackerras return; 80214cf11afSPaul Mackerras case -EFAULT: 80314cf11afSPaul Mackerras _exception(SIGSEGV, regs, SEGV_MAPERR, regs->nip); 8048dad3f92SPaul Mackerras return; 8058dad3f92SPaul Mackerras } 8068dad3f92SPaul Mackerras } 8078dad3f92SPaul Mackerras 80814cf11afSPaul Mackerras if (reason & REASON_PRIVILEGED) 80914cf11afSPaul Mackerras _exception(SIGILL, regs, ILL_PRVOPC, regs->nip); 81014cf11afSPaul Mackerras else 81114cf11afSPaul Mackerras _exception(SIGILL, regs, ILL_ILLOPC, regs->nip); 81214cf11afSPaul Mackerras } 81314cf11afSPaul Mackerras 814dc1c1ca3SStephen Rothwell void alignment_exception(struct pt_regs *regs) 81514cf11afSPaul Mackerras { 816e9370ae1SPaul Mackerras int fixed = 0; 81714cf11afSPaul Mackerras 818e9370ae1SPaul Mackerras /* we don't implement logging of alignment exceptions */ 819e9370ae1SPaul Mackerras if (!(current->thread.align_ctl & PR_UNALIGN_SIGBUS)) 82014cf11afSPaul Mackerras fixed = fix_alignment(regs); 82114cf11afSPaul Mackerras 82214cf11afSPaul Mackerras if (fixed == 1) { 82314cf11afSPaul Mackerras regs->nip += 4; /* skip over emulated instruction */ 82414cf11afSPaul Mackerras emulate_single_step(regs); 82514cf11afSPaul Mackerras return; 82614cf11afSPaul Mackerras } 82714cf11afSPaul Mackerras 82814cf11afSPaul Mackerras /* Operand address was bad */ 82914cf11afSPaul Mackerras if (fixed == -EFAULT) { 83014cf11afSPaul Mackerras if (user_mode(regs)) 8318dad3f92SPaul Mackerras _exception(SIGSEGV, regs, SEGV_ACCERR, regs->dar); 83214cf11afSPaul Mackerras else 83314cf11afSPaul Mackerras /* Search exception table */ 83414cf11afSPaul Mackerras bad_page_fault(regs, regs->dar, SIGSEGV); 83514cf11afSPaul Mackerras return; 83614cf11afSPaul Mackerras } 8378dad3f92SPaul Mackerras _exception(SIGBUS, regs, BUS_ADRALN, regs->dar); 83814cf11afSPaul Mackerras } 83914cf11afSPaul Mackerras 84014cf11afSPaul Mackerras void StackOverflow(struct pt_regs *regs) 84114cf11afSPaul Mackerras { 84214cf11afSPaul Mackerras printk(KERN_CRIT "Kernel stack overflow in process %p, r1=%lx\n", 84314cf11afSPaul Mackerras current, regs->gpr[1]); 84414cf11afSPaul Mackerras debugger(regs); 84514cf11afSPaul Mackerras show_regs(regs); 84614cf11afSPaul Mackerras panic("kernel stack overflow"); 84714cf11afSPaul Mackerras } 84814cf11afSPaul Mackerras 84914cf11afSPaul Mackerras void nonrecoverable_exception(struct pt_regs *regs) 85014cf11afSPaul Mackerras { 85114cf11afSPaul Mackerras printk(KERN_ERR "Non-recoverable exception at PC=%lx MSR=%lx\n", 85214cf11afSPaul Mackerras regs->nip, regs->msr); 85314cf11afSPaul Mackerras debugger(regs); 85414cf11afSPaul Mackerras die("nonrecoverable exception", regs, SIGKILL); 85514cf11afSPaul Mackerras } 85614cf11afSPaul Mackerras 85714cf11afSPaul Mackerras void trace_syscall(struct pt_regs *regs) 85814cf11afSPaul Mackerras { 85914cf11afSPaul Mackerras printk("Task: %p(%d), PC: %08lX/%08lX, Syscall: %3ld, Result: %s%ld %s\n", 86014cf11afSPaul Mackerras current, current->pid, regs->nip, regs->link, regs->gpr[0], 86114cf11afSPaul Mackerras regs->ccr&0x10000000?"Error=":"", regs->gpr[3], print_tainted()); 86214cf11afSPaul Mackerras } 86314cf11afSPaul Mackerras 864dc1c1ca3SStephen Rothwell void kernel_fp_unavailable_exception(struct pt_regs *regs) 865dc1c1ca3SStephen Rothwell { 866dc1c1ca3SStephen Rothwell printk(KERN_EMERG "Unrecoverable FP Unavailable Exception " 867dc1c1ca3SStephen Rothwell "%lx at %lx\n", regs->trap, regs->nip); 868dc1c1ca3SStephen Rothwell die("Unrecoverable FP Unavailable Exception", regs, SIGABRT); 869dc1c1ca3SStephen Rothwell } 870dc1c1ca3SStephen Rothwell 871dc1c1ca3SStephen Rothwell void altivec_unavailable_exception(struct pt_regs *regs) 872dc1c1ca3SStephen Rothwell { 8738dad3f92SPaul Mackerras #if !defined(CONFIG_ALTIVEC) 874dc1c1ca3SStephen Rothwell if (user_mode(regs)) { 875dc1c1ca3SStephen Rothwell /* A user program has executed an altivec instruction, 876dc1c1ca3SStephen Rothwell but this kernel doesn't support altivec. */ 877dc1c1ca3SStephen Rothwell _exception(SIGILL, regs, ILL_ILLOPC, regs->nip); 878dc1c1ca3SStephen Rothwell return; 879dc1c1ca3SStephen Rothwell } 880dc1c1ca3SStephen Rothwell #endif 881dc1c1ca3SStephen Rothwell printk(KERN_EMERG "Unrecoverable VMX/Altivec Unavailable Exception " 882dc1c1ca3SStephen Rothwell "%lx at %lx\n", regs->trap, regs->nip); 883dc1c1ca3SStephen Rothwell die("Unrecoverable VMX/Altivec Unavailable Exception", regs, SIGABRT); 884dc1c1ca3SStephen Rothwell } 885dc1c1ca3SStephen Rothwell 886dc1c1ca3SStephen Rothwell void performance_monitor_exception(struct pt_regs *regs) 887dc1c1ca3SStephen Rothwell { 888dc1c1ca3SStephen Rothwell perf_irq(regs); 889dc1c1ca3SStephen Rothwell } 890dc1c1ca3SStephen Rothwell 8918dad3f92SPaul Mackerras #ifdef CONFIG_8xx 89214cf11afSPaul Mackerras void SoftwareEmulation(struct pt_regs *regs) 89314cf11afSPaul Mackerras { 89414cf11afSPaul Mackerras extern int do_mathemu(struct pt_regs *); 89514cf11afSPaul Mackerras extern int Soft_emulate_8xx(struct pt_regs *); 89614cf11afSPaul Mackerras int errcode; 89714cf11afSPaul Mackerras 89814cf11afSPaul Mackerras CHECK_FULL_REGS(regs); 89914cf11afSPaul Mackerras 90014cf11afSPaul Mackerras if (!user_mode(regs)) { 90114cf11afSPaul Mackerras debugger(regs); 90214cf11afSPaul Mackerras die("Kernel Mode Software FPU Emulation", regs, SIGFPE); 90314cf11afSPaul Mackerras } 90414cf11afSPaul Mackerras 90514cf11afSPaul Mackerras #ifdef CONFIG_MATH_EMULATION 90614cf11afSPaul Mackerras errcode = do_mathemu(regs); 90714cf11afSPaul Mackerras #else 90814cf11afSPaul Mackerras errcode = Soft_emulate_8xx(regs); 90914cf11afSPaul Mackerras #endif 91014cf11afSPaul Mackerras if (errcode) { 91114cf11afSPaul Mackerras if (errcode > 0) 91214cf11afSPaul Mackerras _exception(SIGFPE, regs, 0, 0); 91314cf11afSPaul Mackerras else if (errcode == -EFAULT) 91414cf11afSPaul Mackerras _exception(SIGSEGV, regs, 0, 0); 91514cf11afSPaul Mackerras else 91614cf11afSPaul Mackerras _exception(SIGILL, regs, ILL_ILLOPC, regs->nip); 91714cf11afSPaul Mackerras } else 91814cf11afSPaul Mackerras emulate_single_step(regs); 91914cf11afSPaul Mackerras } 9208dad3f92SPaul Mackerras #endif /* CONFIG_8xx */ 92114cf11afSPaul Mackerras 92214cf11afSPaul Mackerras #if defined(CONFIG_40x) || defined(CONFIG_BOOKE) 92314cf11afSPaul Mackerras 92414cf11afSPaul Mackerras void DebugException(struct pt_regs *regs, unsigned long debug_status) 92514cf11afSPaul Mackerras { 92614cf11afSPaul Mackerras if (debug_status & DBSR_IC) { /* instruction completion */ 92714cf11afSPaul Mackerras regs->msr &= ~MSR_DE; 92814cf11afSPaul Mackerras if (user_mode(regs)) { 92914cf11afSPaul Mackerras current->thread.dbcr0 &= ~DBCR0_IC; 93014cf11afSPaul Mackerras } else { 93114cf11afSPaul Mackerras /* Disable instruction completion */ 93214cf11afSPaul Mackerras mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) & ~DBCR0_IC); 93314cf11afSPaul Mackerras /* Clear the instruction completion event */ 93414cf11afSPaul Mackerras mtspr(SPRN_DBSR, DBSR_IC); 93514cf11afSPaul Mackerras if (debugger_sstep(regs)) 93614cf11afSPaul Mackerras return; 93714cf11afSPaul Mackerras } 93814cf11afSPaul Mackerras _exception(SIGTRAP, regs, TRAP_TRACE, 0); 93914cf11afSPaul Mackerras } 94014cf11afSPaul Mackerras } 94114cf11afSPaul Mackerras #endif /* CONFIG_4xx || CONFIG_BOOKE */ 94214cf11afSPaul Mackerras 94314cf11afSPaul Mackerras #if !defined(CONFIG_TAU_INT) 94414cf11afSPaul Mackerras void TAUException(struct pt_regs *regs) 94514cf11afSPaul Mackerras { 94614cf11afSPaul Mackerras printk("TAU trap at PC: %lx, MSR: %lx, vector=%lx %s\n", 94714cf11afSPaul Mackerras regs->nip, regs->msr, regs->trap, print_tainted()); 94814cf11afSPaul Mackerras } 94914cf11afSPaul Mackerras #endif /* CONFIG_INT_TAU */ 95014cf11afSPaul Mackerras 95114cf11afSPaul Mackerras #ifdef CONFIG_ALTIVEC 952dc1c1ca3SStephen Rothwell void altivec_assist_exception(struct pt_regs *regs) 95314cf11afSPaul Mackerras { 95414cf11afSPaul Mackerras int err; 95514cf11afSPaul Mackerras 95614cf11afSPaul Mackerras if (!user_mode(regs)) { 95714cf11afSPaul Mackerras printk(KERN_EMERG "VMX/Altivec assist exception in kernel mode" 95814cf11afSPaul Mackerras " at %lx\n", regs->nip); 9598dad3f92SPaul Mackerras die("Kernel VMX/Altivec assist exception", regs, SIGILL); 96014cf11afSPaul Mackerras } 96114cf11afSPaul Mackerras 962dc1c1ca3SStephen Rothwell flush_altivec_to_thread(current); 963dc1c1ca3SStephen Rothwell 96414cf11afSPaul Mackerras err = emulate_altivec(regs); 96514cf11afSPaul Mackerras if (err == 0) { 96614cf11afSPaul Mackerras regs->nip += 4; /* skip emulated instruction */ 96714cf11afSPaul Mackerras emulate_single_step(regs); 96814cf11afSPaul Mackerras return; 96914cf11afSPaul Mackerras } 97014cf11afSPaul Mackerras 97114cf11afSPaul Mackerras if (err == -EFAULT) { 97214cf11afSPaul Mackerras /* got an error reading the instruction */ 97314cf11afSPaul Mackerras _exception(SIGSEGV, regs, SEGV_ACCERR, regs->nip); 97414cf11afSPaul Mackerras } else { 97514cf11afSPaul Mackerras /* didn't recognize the instruction */ 97614cf11afSPaul Mackerras /* XXX quick hack for now: set the non-Java bit in the VSCR */ 97714cf11afSPaul Mackerras if (printk_ratelimit()) 97814cf11afSPaul Mackerras printk(KERN_ERR "Unrecognized altivec instruction " 97914cf11afSPaul Mackerras "in %s at %lx\n", current->comm, regs->nip); 98014cf11afSPaul Mackerras current->thread.vscr.u[3] |= 0x10000; 98114cf11afSPaul Mackerras } 98214cf11afSPaul Mackerras } 98314cf11afSPaul Mackerras #endif /* CONFIG_ALTIVEC */ 98414cf11afSPaul Mackerras 98514cf11afSPaul Mackerras #ifdef CONFIG_FSL_BOOKE 98614cf11afSPaul Mackerras void CacheLockingException(struct pt_regs *regs, unsigned long address, 98714cf11afSPaul Mackerras unsigned long error_code) 98814cf11afSPaul Mackerras { 98914cf11afSPaul Mackerras /* We treat cache locking instructions from the user 99014cf11afSPaul Mackerras * as priv ops, in the future we could try to do 99114cf11afSPaul Mackerras * something smarter 99214cf11afSPaul Mackerras */ 99314cf11afSPaul Mackerras if (error_code & (ESR_DLK|ESR_ILK)) 99414cf11afSPaul Mackerras _exception(SIGILL, regs, ILL_PRVOPC, regs->nip); 99514cf11afSPaul Mackerras return; 99614cf11afSPaul Mackerras } 99714cf11afSPaul Mackerras #endif /* CONFIG_FSL_BOOKE */ 99814cf11afSPaul Mackerras 99914cf11afSPaul Mackerras #ifdef CONFIG_SPE 100014cf11afSPaul Mackerras void SPEFloatingPointException(struct pt_regs *regs) 100114cf11afSPaul Mackerras { 100214cf11afSPaul Mackerras unsigned long spefscr; 100314cf11afSPaul Mackerras int fpexc_mode; 100414cf11afSPaul Mackerras int code = 0; 100514cf11afSPaul Mackerras 100614cf11afSPaul Mackerras spefscr = current->thread.spefscr; 100714cf11afSPaul Mackerras fpexc_mode = current->thread.fpexc_mode; 100814cf11afSPaul Mackerras 100914cf11afSPaul Mackerras /* Hardware does not neccessarily set sticky 101014cf11afSPaul Mackerras * underflow/overflow/invalid flags */ 101114cf11afSPaul Mackerras if ((spefscr & SPEFSCR_FOVF) && (fpexc_mode & PR_FP_EXC_OVF)) { 101214cf11afSPaul Mackerras code = FPE_FLTOVF; 101314cf11afSPaul Mackerras spefscr |= SPEFSCR_FOVFS; 101414cf11afSPaul Mackerras } 101514cf11afSPaul Mackerras else if ((spefscr & SPEFSCR_FUNF) && (fpexc_mode & PR_FP_EXC_UND)) { 101614cf11afSPaul Mackerras code = FPE_FLTUND; 101714cf11afSPaul Mackerras spefscr |= SPEFSCR_FUNFS; 101814cf11afSPaul Mackerras } 101914cf11afSPaul Mackerras else if ((spefscr & SPEFSCR_FDBZ) && (fpexc_mode & PR_FP_EXC_DIV)) 102014cf11afSPaul Mackerras code = FPE_FLTDIV; 102114cf11afSPaul Mackerras else if ((spefscr & SPEFSCR_FINV) && (fpexc_mode & PR_FP_EXC_INV)) { 102214cf11afSPaul Mackerras code = FPE_FLTINV; 102314cf11afSPaul Mackerras spefscr |= SPEFSCR_FINVS; 102414cf11afSPaul Mackerras } 102514cf11afSPaul Mackerras else if ((spefscr & (SPEFSCR_FG | SPEFSCR_FX)) && (fpexc_mode & PR_FP_EXC_RES)) 102614cf11afSPaul Mackerras code = FPE_FLTRES; 102714cf11afSPaul Mackerras 102814cf11afSPaul Mackerras current->thread.spefscr = spefscr; 102914cf11afSPaul Mackerras 103014cf11afSPaul Mackerras _exception(SIGFPE, regs, code, regs->nip); 103114cf11afSPaul Mackerras return; 103214cf11afSPaul Mackerras } 103314cf11afSPaul Mackerras #endif 103414cf11afSPaul Mackerras 1035dc1c1ca3SStephen Rothwell /* 1036dc1c1ca3SStephen Rothwell * We enter here if we get an unrecoverable exception, that is, one 1037dc1c1ca3SStephen Rothwell * that happened at a point where the RI (recoverable interrupt) bit 1038dc1c1ca3SStephen Rothwell * in the MSR is 0. This indicates that SRR0/1 are live, and that 1039dc1c1ca3SStephen Rothwell * we therefore lost state by taking this exception. 1040dc1c1ca3SStephen Rothwell */ 1041dc1c1ca3SStephen Rothwell void unrecoverable_exception(struct pt_regs *regs) 1042dc1c1ca3SStephen Rothwell { 1043dc1c1ca3SStephen Rothwell printk(KERN_EMERG "Unrecoverable exception %lx at %lx\n", 1044dc1c1ca3SStephen Rothwell regs->trap, regs->nip); 1045dc1c1ca3SStephen Rothwell die("Unrecoverable exception", regs, SIGABRT); 1046dc1c1ca3SStephen Rothwell } 1047dc1c1ca3SStephen Rothwell 104814cf11afSPaul Mackerras #ifdef CONFIG_BOOKE_WDT 104914cf11afSPaul Mackerras /* 105014cf11afSPaul Mackerras * Default handler for a Watchdog exception, 105114cf11afSPaul Mackerras * spins until a reboot occurs 105214cf11afSPaul Mackerras */ 105314cf11afSPaul Mackerras void __attribute__ ((weak)) WatchdogHandler(struct pt_regs *regs) 105414cf11afSPaul Mackerras { 105514cf11afSPaul Mackerras /* Generic WatchdogHandler, implement your own */ 105614cf11afSPaul Mackerras mtspr(SPRN_TCR, mfspr(SPRN_TCR)&(~TCR_WIE)); 105714cf11afSPaul Mackerras return; 105814cf11afSPaul Mackerras } 105914cf11afSPaul Mackerras 106014cf11afSPaul Mackerras void WatchdogException(struct pt_regs *regs) 106114cf11afSPaul Mackerras { 106214cf11afSPaul Mackerras printk (KERN_EMERG "PowerPC Book-E Watchdog Exception\n"); 106314cf11afSPaul Mackerras WatchdogHandler(regs); 106414cf11afSPaul Mackerras } 106514cf11afSPaul Mackerras #endif 1066dc1c1ca3SStephen Rothwell 1067dc1c1ca3SStephen Rothwell /* 1068dc1c1ca3SStephen Rothwell * We enter here if we discover during exception entry that we are 1069dc1c1ca3SStephen Rothwell * running in supervisor mode with a userspace value in the stack pointer. 1070dc1c1ca3SStephen Rothwell */ 1071dc1c1ca3SStephen Rothwell void kernel_bad_stack(struct pt_regs *regs) 1072dc1c1ca3SStephen Rothwell { 1073dc1c1ca3SStephen Rothwell printk(KERN_EMERG "Bad kernel stack pointer %lx at %lx\n", 1074dc1c1ca3SStephen Rothwell regs->gpr[1], regs->nip); 1075dc1c1ca3SStephen Rothwell die("Bad kernel stack pointer", regs, SIGABRT); 1076dc1c1ca3SStephen Rothwell } 107714cf11afSPaul Mackerras 107814cf11afSPaul Mackerras void __init trap_init(void) 107914cf11afSPaul Mackerras { 108014cf11afSPaul Mackerras } 1081