]>
git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - arch/h8300/kernel/traps.c
2 * linux/arch/h8300/boot/traps.c -- general exception handling code
3 * H8/300 support Yoshinori Sato <ysato@users.sourceforge.jp>
5 * Cloned from Linux/m68k.
7 * No original Copyright holder listed,
8 * Probable original (C) Roman Zippel (assigned DJD, 1999)
10 * Copyright 1999-2000 D. Jeff Dionne, <jeff@rt-control.com>
12 * This file is subject to the terms and conditions of the GNU General Public
13 * License. See the file COPYING in the main directory of this archive
17 #include <linux/types.h>
18 #include <linux/sched.h>
19 #include <linux/sched/debug.h>
20 #include <linux/kernel.h>
21 #include <linux/errno.h>
22 #include <linux/init.h>
23 #include <linux/module.h>
24 #include <linux/bug.h>
27 #include <asm/traps.h>
30 static DEFINE_SPINLOCK(die_lock
);
33 * this must be called very early as the kernel might
34 * use some instruction that are emulated on the 060
37 void __init
base_trap_init(void)
41 void __init
trap_init(void)
45 asmlinkage
void set_esp0(unsigned long ssp
)
47 current
->thread
.esp0
= ssp
;
51 * Generic dumping code. Used for panic and debug.
54 static void dump(struct pt_regs
*fp
)
60 pr_info("\nCURRENT PROCESS:\n\n");
61 pr_info("COMM=%s PID=%d\n", current
->comm
, current
->pid
);
63 pr_info("TEXT=%08x-%08x DATA=%08x-%08x BSS=%08x-%08x\n",
64 (int) current
->mm
->start_code
,
65 (int) current
->mm
->end_code
,
66 (int) current
->mm
->start_data
,
67 (int) current
->mm
->end_data
,
68 (int) current
->mm
->end_data
,
69 (int) current
->mm
->brk
);
70 pr_info("USER-STACK=%08x KERNEL-STACK=%08lx\n\n",
71 (int) current
->mm
->start_stack
,
72 (int) PAGE_SIZE
+(unsigned long)current
);
77 tp
= ((unsigned char *) fp
->pc
) - 0x20;
78 for (sp
= (unsigned long *) tp
, i
= 0; (i
< 0x40); i
+= 4) {
80 pr_info("\n%08x: ", (int) (tp
+ i
));
81 pr_info("%08x ", (int) *sp
++);
85 pr_info("\nKERNEL STACK:");
86 tp
= ((unsigned char *) fp
) - 0x40;
87 for (sp
= (unsigned long *) tp
, i
= 0; (i
< 0xc0); i
+= 4) {
89 pr_info("\n%08x: ", (int) (tp
+ i
));
90 pr_info("%08x ", (int) *sp
++);
93 if (STACK_MAGIC
!= *(unsigned long *)((unsigned long)current
+PAGE_SIZE
))
94 pr_info("(Possibly corrupted stack page??)\n");
99 void die(const char *str
, struct pt_regs
*fp
, unsigned long err
)
106 spin_lock_irq(&die_lock
);
107 report_bug(fp
->pc
, fp
);
108 pr_crit("%s: %04lx [#%d] ", str
, err
& 0xffff, ++diecount
);
111 spin_unlock_irq(&die_lock
);
115 static int kstack_depth_to_print
= 24;
117 void show_stack(struct task_struct
*task
, unsigned long *esp
)
119 unsigned long *stack
, addr
;
123 esp
= (unsigned long *) &esp
;
127 pr_info("Stack from %08lx:", (unsigned long)stack
);
128 for (i
= 0; i
< kstack_depth_to_print
; i
++) {
129 if (((unsigned long)stack
& (THREAD_SIZE
- 1)) >=
134 pr_cont(" %08lx", *stack
++);
137 pr_info("\nCall Trace:\n");
140 while (((unsigned long)stack
& (THREAD_SIZE
- 1)) < THREAD_SIZE
-4) {
143 * If the address is either in the text segment of the
144 * kernel, or in the region which contains vmalloc'ed
145 * memory, it *may* be the address of a calling
146 * routine; if so, print it so that someone tracing
147 * down the cause of the crash will be able to figure
148 * out the call path that was taken.
150 if (check_kernel_text(addr
)) {
153 pr_cont(" [<%08lx>]", addr
);