/* * Hardware exception handling * * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch> * Copyright (C) 2004 Microtronix Datacom Ltd. * Copyright (C) 2001 Vic Phillips * * This file is subject to the terms and conditions of the GNU General * Public License. See the file COPYING in the main directory of this * archive for more details.
*/
void die(constchar *str, struct pt_regs *regs, long err)
{
console_verbose();
spin_lock_irq(&die_lock);
pr_warn("Oops: %s, sig: %ld\n", str, err);
show_regs(regs);
spin_unlock_irq(&die_lock); /* * make_task_dead() should take care of panic'ing from an interrupt * context so we don't handle it here
*/
make_task_dead(err);
}
void _exception(int signo, struct pt_regs *regs, int code, unsignedlong addr)
{ if (!user_mode(regs))
die("Exception in kernel mode", regs, signo);
_send_sig(signo, code, addr);
}
/* * The show_stack() is external API which we do not use ourselves.
*/
printk("%sStack from %08lx:", loglvl, (unsignedlong)stack); for (i = 0; i < kstack_depth_to_print; i++) { if (stack + 1 > endstack) break; if (i % 8 == 0)
printk("%s\n ", loglvl);
printk("%s %08lx", loglvl, *stack++);
}
printk("%s\nCall Trace:", loglvl);
i = 0; while (stack + 1 <= endstack) {
addr = *stack++; /* * If the address is either in the text segment of the * kernel, or in the region which contains vmalloc'ed * memory, it *may* be the address of a calling * routine; if so, print it so that someone tracing * down the cause of the crash will be able to figure * out the call path that was taken.
*/ if (((addr >= (unsignedlong) _stext) &&
(addr <= (unsignedlong) _etext))) { if (i % 4 == 0)
pr_emerg("\n ");
printk("%s [<%08lx>]", loglvl, addr);
i++;
}
}
printk("%s\n", loglvl);
}
/* Breakpoint handler */
asmlinkage void breakpoint_c(struct pt_regs *fp)
{ /* * The breakpoint entry code has moved the PC on by 4 bytes, so we must * move it back. This could be done on the host but we do it here * because monitor.S of JTAG gdbserver does it too.
*/
fp->ea -= 4;
_exception(SIGTRAP, fp, TRAP_BRKPT, fp->ea);
}
if (!user_mode(fp)) {
pr_alert("Unaligned access from kernel mode, this might be a hardware\n");
pr_alert("problem, dump registers and restart the instruction\n");
pr_alert(" BADADDR 0x%08lx\n", addr);
pr_alert(" cause %d\n", cause);
pr_alert(" op-code 0x%08lx\n", *(unsignedlong *)(fp->ea));
show_regs(fp); return;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.