traps.c (78fab4c04c76b8c9327541bd270f82b85b42bbf7) traps.c (cce1f106c64dc1d19d5e9406320fde18dfc662df)
1/*
2 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
3 * Copyright 2007-2010 Freescale Semiconductor, Inc.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.

--- 41 unchanged lines hidden (view full) ---

50#include <asm/backlight.h>
51#endif
52#ifdef CONFIG_PPC64
53#include <asm/firmware.h>
54#include <asm/processor.h>
55#endif
56#include <asm/kexec.h>
57#include <asm/ppc-opcode.h>
1/*
2 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
3 * Copyright 2007-2010 Freescale Semiconductor, Inc.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.

--- 41 unchanged lines hidden (view full) ---

50#include <asm/backlight.h>
51#endif
52#ifdef CONFIG_PPC64
53#include <asm/firmware.h>
54#include <asm/processor.h>
55#endif
56#include <asm/kexec.h>
57#include <asm/ppc-opcode.h>
58#include <asm/rio.h>
58
59#if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC)
60int (*__debugger)(struct pt_regs *regs) __read_mostly;
61int (*__debugger_ipi)(struct pt_regs *regs) __read_mostly;
62int (*__debugger_bpt)(struct pt_regs *regs) __read_mostly;
63int (*__debugger_sstep)(struct pt_regs *regs) __read_mostly;
64int (*__debugger_iabr_match)(struct pt_regs *regs) __read_mostly;
65int (*__debugger_dabr_match)(struct pt_regs *regs) __read_mostly;

--- 72 unchanged lines hidden (view full) ---

138#ifdef CONFIG_DEBUG_PAGEALLOC
139 printk("DEBUG_PAGEALLOC ");
140#endif
141#ifdef CONFIG_NUMA
142 printk("NUMA ");
143#endif
144 printk("%s\n", ppc_md.name ? ppc_md.name : "");
145
59
60#if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC)
61int (*__debugger)(struct pt_regs *regs) __read_mostly;
62int (*__debugger_ipi)(struct pt_regs *regs) __read_mostly;
63int (*__debugger_bpt)(struct pt_regs *regs) __read_mostly;
64int (*__debugger_sstep)(struct pt_regs *regs) __read_mostly;
65int (*__debugger_iabr_match)(struct pt_regs *regs) __read_mostly;
66int (*__debugger_dabr_match)(struct pt_regs *regs) __read_mostly;

--- 72 unchanged lines hidden (view full) ---

139#ifdef CONFIG_DEBUG_PAGEALLOC
140 printk("DEBUG_PAGEALLOC ");
141#endif
142#ifdef CONFIG_NUMA
143 printk("NUMA ");
144#endif
145 printk("%s\n", ppc_md.name ? ppc_md.name : "");
146
146 sysfs_printk_last_file();
147 if (notify_die(DIE_OOPS, str, regs, err, 255,
148 SIGSEGV) == NOTIFY_STOP)
149 return 1;
150
151 print_modules();
152 show_regs(regs);
153 } else {
154 printk("Recursive die() failure, output suppressed\n");

--- 39 unchanged lines hidden (view full) ---

194 "at %016lx nip %016lx lr %016lx code %x\n";
195
196 if (!user_mode(regs)) {
197 if (die("Exception in kernel mode", regs, signr))
198 return;
199 } else if (show_unhandled_signals &&
200 unhandled_signal(current, signr) &&
201 printk_ratelimit()) {
147 if (notify_die(DIE_OOPS, str, regs, err, 255,
148 SIGSEGV) == NOTIFY_STOP)
149 return 1;
150
151 print_modules();
152 show_regs(regs);
153 } else {
154 printk("Recursive die() failure, output suppressed\n");

--- 39 unchanged lines hidden (view full) ---

194 "at %016lx nip %016lx lr %016lx code %x\n";
195
196 if (!user_mode(regs)) {
197 if (die("Exception in kernel mode", regs, signr))
198 return;
199 } else if (show_unhandled_signals &&
200 unhandled_signal(current, signr) &&
201 printk_ratelimit()) {
202 printk(regs->msr & MSR_SF ? fmt64 : fmt32,
202 printk(regs->msr & MSR_64BIT ? fmt64 : fmt32,
203 current->comm, current->pid, signr,
204 addr, regs->nip, regs->link, code);
205 }
206
207 memset(&info, 0, sizeof(info));
208 info.si_signo = signr;
209 info.si_code = code;
210 info.si_addr = (void __user *) addr;

--- 5 unchanged lines hidden (view full) ---

216{
217 /* See if any machine dependent calls */
218 if (ppc_md.system_reset_exception) {
219 if (ppc_md.system_reset_exception(regs))
220 return;
221 }
222
223#ifdef CONFIG_KEXEC
203 current->comm, current->pid, signr,
204 addr, regs->nip, regs->link, code);
205 }
206
207 memset(&info, 0, sizeof(info));
208 info.si_signo = signr;
209 info.si_code = code;
210 info.si_addr = (void __user *) addr;

--- 5 unchanged lines hidden (view full) ---

216{
217 /* See if any machine dependent calls */
218 if (ppc_md.system_reset_exception) {
219 if (ppc_md.system_reset_exception(regs))
220 return;
221 }
222
223#ifdef CONFIG_KEXEC
224 cpu_set(smp_processor_id(), cpus_in_sr);
224 cpumask_set_cpu(smp_processor_id(), &cpus_in_sr);
225#endif
226
227 die("System Reset", regs, SIGABRT);
228
229 /*
230 * Some CPUs when released from the debugger will execute this path.
231 * These CPUs entered the debugger via a soft-reset. If the CPU was
232 * hung before entering the debugger it will return to the hung

--- 187 unchanged lines hidden (view full) ---

420}
421#elif defined(CONFIG_E500)
422int machine_check_e500mc(struct pt_regs *regs)
423{
424 unsigned long mcsr = mfspr(SPRN_MCSR);
425 unsigned long reason = mcsr;
426 int recoverable = 1;
427
225#endif
226
227 die("System Reset", regs, SIGABRT);
228
229 /*
230 * Some CPUs when released from the debugger will execute this path.
231 * These CPUs entered the debugger via a soft-reset. If the CPU was
232 * hung before entering the debugger it will return to the hung

--- 187 unchanged lines hidden (view full) ---

420}
421#elif defined(CONFIG_E500)
422int machine_check_e500mc(struct pt_regs *regs)
423{
424 unsigned long mcsr = mfspr(SPRN_MCSR);
425 unsigned long reason = mcsr;
426 int recoverable = 1;
427
428 if (reason & MCSR_BUS_RBERR) {
429 recoverable = fsl_rio_mcheck_exception(regs);
430 if (recoverable == 1)
431 goto silent_out;
432 }
433
428 printk("Machine check in kernel mode.\n");
429 printk("Caused by (from MCSR=%lx): ", reason);
430
431 if (reason & MCSR_MCP)
432 printk("Machine Check Signal\n");
433
434 if (reason & MCSR_ICPERR) {
435 printk("Instruction Cache Parity Error\n");

--- 59 unchanged lines hidden (view full) ---

495
496 addr = mfspr(SPRN_MCAR);
497 addr |= (u64)mfspr(SPRN_MCARU) << 32;
498
499 printk("Machine Check %s Address: %#llx\n",
500 reason & MCSR_MEA ? "Effective" : "Physical", addr);
501 }
502
434 printk("Machine check in kernel mode.\n");
435 printk("Caused by (from MCSR=%lx): ", reason);
436
437 if (reason & MCSR_MCP)
438 printk("Machine Check Signal\n");
439
440 if (reason & MCSR_ICPERR) {
441 printk("Instruction Cache Parity Error\n");

--- 59 unchanged lines hidden (view full) ---

501
502 addr = mfspr(SPRN_MCAR);
503 addr |= (u64)mfspr(SPRN_MCARU) << 32;
504
505 printk("Machine Check %s Address: %#llx\n",
506 reason & MCSR_MEA ? "Effective" : "Physical", addr);
507 }
508
509silent_out:
503 mtspr(SPRN_MCSR, mcsr);
504 return mfspr(SPRN_MCSR) == 0 && recoverable;
505}
506
507int machine_check_e500(struct pt_regs *regs)
508{
509 unsigned long reason = get_mc_reason(regs);
510
510 mtspr(SPRN_MCSR, mcsr);
511 return mfspr(SPRN_MCSR) == 0 && recoverable;
512}
513
514int machine_check_e500(struct pt_regs *regs)
515{
516 unsigned long reason = get_mc_reason(regs);
517
518 if (reason & MCSR_BUS_RBERR) {
519 if (fsl_rio_mcheck_exception(regs))
520 return 1;
521 }
522
511 printk("Machine check in kernel mode.\n");
512 printk("Caused by (from MCSR=%lx): ", reason);
513
514 if (reason & MCSR_MCP)
515 printk("Machine Check Signal\n");
516 if (reason & MCSR_ICPERR)
517 printk("Instruction Cache Parity Error\n");
518 if (reason & MCSR_DCP_PERR)

--- 385 unchanged lines hidden (view full) ---

904 }
905
906 /* Emulate isel (Integer Select) instruction */
907 if ((instword & PPC_INST_ISEL_MASK) == PPC_INST_ISEL) {
908 PPC_WARN_EMULATED(isel, regs);
909 return emulate_isel(regs, instword);
910 }
911
523 printk("Machine check in kernel mode.\n");
524 printk("Caused by (from MCSR=%lx): ", reason);
525
526 if (reason & MCSR_MCP)
527 printk("Machine Check Signal\n");
528 if (reason & MCSR_ICPERR)
529 printk("Instruction Cache Parity Error\n");
530 if (reason & MCSR_DCP_PERR)

--- 385 unchanged lines hidden (view full) ---

916 }
917
918 /* Emulate isel (Integer Select) instruction */
919 if ((instword & PPC_INST_ISEL_MASK) == PPC_INST_ISEL) {
920 PPC_WARN_EMULATED(isel, regs);
921 return emulate_isel(regs, instword);
922 }
923
924#ifdef CONFIG_PPC64
925 /* Emulate the mfspr rD, DSCR. */
926 if (((instword & PPC_INST_MFSPR_DSCR_MASK) == PPC_INST_MFSPR_DSCR) &&
927 cpu_has_feature(CPU_FTR_DSCR)) {
928 PPC_WARN_EMULATED(mfdscr, regs);
929 rd = (instword >> 21) & 0x1f;
930 regs->gpr[rd] = mfspr(SPRN_DSCR);
931 return 0;
932 }
933 /* Emulate the mtspr DSCR, rD. */
934 if (((instword & PPC_INST_MTSPR_DSCR_MASK) == PPC_INST_MTSPR_DSCR) &&
935 cpu_has_feature(CPU_FTR_DSCR)) {
936 PPC_WARN_EMULATED(mtdscr, regs);
937 rd = (instword >> 21) & 0x1f;
938 mtspr(SPRN_DSCR, regs->gpr[rd]);
939 current->thread.dscr_inherit = 1;
940 return 0;
941 }
942#endif
943
912 return -EINVAL;
913}
914
915int is_valid_bugaddr(unsigned long addr)
916{
917 return is_kernel_addr(addr);
918}
919

--- 581 unchanged lines hidden (view full) ---

1501#ifdef CONFIG_MATH_EMULATION
1502 WARN_EMULATED_SETUP(math),
1503#elif defined(CONFIG_8XX_MINIMAL_FPEMU)
1504 WARN_EMULATED_SETUP(8xx),
1505#endif
1506#ifdef CONFIG_VSX
1507 WARN_EMULATED_SETUP(vsx),
1508#endif
944 return -EINVAL;
945}
946
947int is_valid_bugaddr(unsigned long addr)
948{
949 return is_kernel_addr(addr);
950}
951

--- 581 unchanged lines hidden (view full) ---

1533#ifdef CONFIG_MATH_EMULATION
1534 WARN_EMULATED_SETUP(math),
1535#elif defined(CONFIG_8XX_MINIMAL_FPEMU)
1536 WARN_EMULATED_SETUP(8xx),
1537#endif
1538#ifdef CONFIG_VSX
1539 WARN_EMULATED_SETUP(vsx),
1540#endif
1541#ifdef CONFIG_PPC64
1542 WARN_EMULATED_SETUP(mfdscr),
1543 WARN_EMULATED_SETUP(mtdscr),
1544#endif
1509};
1510
1511u32 ppc_warn_emulated;
1512
1513void ppc_warn_emulated_print(const char *type)
1514{
1515 if (printk_ratelimit())
1516 pr_warning("%s used emulated %s instruction\n", current->comm,

--- 39 unchanged lines hidden ---
1545};
1546
1547u32 ppc_warn_emulated;
1548
1549void ppc_warn_emulated_print(const char *type)
1550{
1551 if (printk_ratelimit())
1552 pr_warning("%s used emulated %s instruction\n", current->comm,

--- 39 unchanged lines hidden ---