sh: Consolidate die definitions for trap handlers.
This kills off the _64 versions and consolidates on the more robust _32 versions instead. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
This commit is contained in:
Родитель
37c9ee0161
Коммит
5f857bce21
|
@ -110,6 +110,10 @@ do { \
|
|||
#include <asm-generic/bug.h>
|
||||
|
||||
struct pt_regs;
|
||||
|
||||
/* arch/sh/kernel/traps.c */
|
||||
extern void die(const char *str, struct pt_regs *regs, long err) __attribute__ ((noreturn));
|
||||
extern void die_if_kernel(const char *str, struct pt_regs *regs, long err);
|
||||
extern void die_if_no_fixup(const char *str, struct pt_regs *regs, long err);
|
||||
|
||||
#endif /* __ASM_SH_BUG_H */
|
||||
|
|
|
@ -6,9 +6,80 @@
|
|||
#include <linux/sched.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/hardirq.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/kexec.h>
|
||||
#include <linux/module.h>
|
||||
#include <asm/unwinder.h>
|
||||
#include <asm/traps.h>
|
||||
|
||||
static DEFINE_SPINLOCK(die_lock);
|
||||
|
||||
void die(const char *str, struct pt_regs *regs, long err)
|
||||
{
|
||||
static int die_counter;
|
||||
|
||||
oops_enter();
|
||||
|
||||
spin_lock_irq(&die_lock);
|
||||
console_verbose();
|
||||
bust_spinlocks(1);
|
||||
|
||||
printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
|
||||
print_modules();
|
||||
show_regs(regs);
|
||||
|
||||
printk("Process: %s (pid: %d, stack limit = %p)\n", current->comm,
|
||||
task_pid_nr(current), task_stack_page(current) + 1);
|
||||
|
||||
if (!user_mode(regs) || in_interrupt())
|
||||
dump_mem("Stack: ", regs->regs[15], THREAD_SIZE +
|
||||
(unsigned long)task_stack_page(current));
|
||||
|
||||
notify_die(DIE_OOPS, str, regs, err, 255, SIGSEGV);
|
||||
|
||||
bust_spinlocks(0);
|
||||
add_taint(TAINT_DIE);
|
||||
spin_unlock_irq(&die_lock);
|
||||
oops_exit();
|
||||
|
||||
if (kexec_should_crash(current))
|
||||
crash_kexec(regs);
|
||||
|
||||
if (in_interrupt())
|
||||
panic("Fatal exception in interrupt");
|
||||
|
||||
if (panic_on_oops)
|
||||
panic("Fatal exception");
|
||||
|
||||
do_exit(SIGSEGV);
|
||||
}
|
||||
|
||||
void die_if_kernel(const char *str, struct pt_regs *regs, long err)
|
||||
{
|
||||
if (!user_mode(regs))
|
||||
die(str, regs, err);
|
||||
}
|
||||
|
||||
/*
|
||||
* try and fix up kernelspace address errors
|
||||
* - userspace errors just cause EFAULT to be returned, resulting in SEGV
|
||||
* - kernel/userspace interfaces cause a jump to an appropriate handler
|
||||
* - other kernel errors are bad
|
||||
*/
|
||||
void die_if_no_fixup(const char *str, struct pt_regs *regs, long err)
|
||||
{
|
||||
if (!user_mode(regs)) {
|
||||
const struct exception_table_entry *fixup;
|
||||
fixup = search_exception_tables(regs->pc);
|
||||
if (fixup) {
|
||||
regs->pc = fixup->fixup;
|
||||
return;
|
||||
}
|
||||
|
||||
die(str, regs, err);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_GENERIC_BUG
|
||||
static void handle_BUG(struct pt_regs *regs)
|
||||
{
|
||||
|
|
|
@ -16,13 +16,11 @@
|
|||
#include <linux/hardirq.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/kallsyms.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/bug.h>
|
||||
#include <linux/debug_locks.h>
|
||||
#include <linux/kdebug.h>
|
||||
#include <linux/kexec.h>
|
||||
#include <linux/limits.h>
|
||||
#include <linux/sysfs.h>
|
||||
#include <linux/uaccess.h>
|
||||
|
@ -48,75 +46,6 @@
|
|||
#define TRAP_ILLEGAL_SLOT_INST 13
|
||||
#endif
|
||||
|
||||
static DEFINE_SPINLOCK(die_lock);
|
||||
|
||||
void die(const char * str, struct pt_regs * regs, long err)
|
||||
{
|
||||
static int die_counter;
|
||||
|
||||
oops_enter();
|
||||
|
||||
spin_lock_irq(&die_lock);
|
||||
console_verbose();
|
||||
bust_spinlocks(1);
|
||||
|
||||
printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
|
||||
print_modules();
|
||||
show_regs(regs);
|
||||
|
||||
printk("Process: %s (pid: %d, stack limit = %p)\n", current->comm,
|
||||
task_pid_nr(current), task_stack_page(current) + 1);
|
||||
|
||||
if (!user_mode(regs) || in_interrupt())
|
||||
dump_mem("Stack: ", regs->regs[15], THREAD_SIZE +
|
||||
(unsigned long)task_stack_page(current));
|
||||
|
||||
notify_die(DIE_OOPS, str, regs, err, 255, SIGSEGV);
|
||||
|
||||
bust_spinlocks(0);
|
||||
add_taint(TAINT_DIE);
|
||||
spin_unlock_irq(&die_lock);
|
||||
oops_exit();
|
||||
|
||||
if (kexec_should_crash(current))
|
||||
crash_kexec(regs);
|
||||
|
||||
if (in_interrupt())
|
||||
panic("Fatal exception in interrupt");
|
||||
|
||||
if (panic_on_oops)
|
||||
panic("Fatal exception");
|
||||
|
||||
do_exit(SIGSEGV);
|
||||
}
|
||||
|
||||
static inline void die_if_kernel(const char *str, struct pt_regs *regs,
|
||||
long err)
|
||||
{
|
||||
if (!user_mode(regs))
|
||||
die(str, regs, err);
|
||||
}
|
||||
|
||||
/*
|
||||
* try and fix up kernelspace address errors
|
||||
* - userspace errors just cause EFAULT to be returned, resulting in SEGV
|
||||
* - kernel/userspace interfaces cause a jump to an appropriate handler
|
||||
* - other kernel errors are bad
|
||||
*/
|
||||
static void die_if_no_fixup(const char * str, struct pt_regs * regs, long err)
|
||||
{
|
||||
if (!user_mode(regs)) {
|
||||
const struct exception_table_entry *fixup;
|
||||
fixup = search_exception_tables(regs->pc);
|
||||
if (fixup) {
|
||||
regs->pc = fixup->fixup;
|
||||
return;
|
||||
}
|
||||
|
||||
die(str, regs, err);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void sign_extend(unsigned int count, unsigned char *dst)
|
||||
{
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
|
|
|
@ -41,37 +41,6 @@ asmlinkage void do_##name(unsigned long error_code, struct pt_regs *regs) \
|
|||
do_unhandled_exception(trapnr, signr, str, __stringify(name), error_code, regs, current); \
|
||||
}
|
||||
|
||||
static DEFINE_SPINLOCK(die_lock);
|
||||
|
||||
void die(const char * str, struct pt_regs * regs, long err)
|
||||
{
|
||||
console_verbose();
|
||||
spin_lock_irq(&die_lock);
|
||||
printk("%s: %lx\n", str, (err & 0xffffff));
|
||||
show_regs(regs);
|
||||
spin_unlock_irq(&die_lock);
|
||||
do_exit(SIGSEGV);
|
||||
}
|
||||
|
||||
static inline void die_if_kernel(const char * str, struct pt_regs * regs, long err)
|
||||
{
|
||||
if (!user_mode(regs))
|
||||
die(str, regs, err);
|
||||
}
|
||||
|
||||
static void die_if_no_fixup(const char * str, struct pt_regs * regs, long err)
|
||||
{
|
||||
if (!user_mode(regs)) {
|
||||
const struct exception_table_entry *fixup;
|
||||
fixup = search_exception_tables(regs->pc);
|
||||
if (fixup) {
|
||||
regs->pc = fixup->fixup;
|
||||
return;
|
||||
}
|
||||
die(str, regs, err);
|
||||
}
|
||||
}
|
||||
|
||||
DO_ERROR(13, SIGILL, "illegal slot instruction", illegal_slot_inst, current)
|
||||
DO_ERROR(87, SIGSEGV, "address error (exec)", address_error_exec, current)
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче