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 * Probabily 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/kernel_stat.h>
20 #include <linux/errno.h>
21 #include <linux/init.h>
23 #include <asm/system.h>
25 #include <asm/traps.h>
30 * this must be called very early as the kernel might
31 * use some instruction that are emulated on the 060
34 void __init base_trap_init(void)
38 void __init trap_init (void)
42 asmlinkage void set_esp0 (unsigned long ssp)
44 current->thread.esp0 = ssp;
48 * Generic dumping code. Used for panic and debug.
51 static void dump(struct pt_regs *fp)
57 printk("\nCURRENT PROCESS:\n\n");
60 extern int swt_lastjiffies, swt_reference;
61 printk("WATCHDOG: jiffies=%d lastjiffies=%d [%d] reference=%d\n",
62 jiffies, swt_lastjiffies, (swt_lastjiffies - jiffies),
66 printk("COMM=%s PID=%d\n", current->comm, current->pid);
68 printk("TEXT=%08x-%08x DATA=%08x-%08x BSS=%08x-%08x\n",
69 (int) current->mm->start_code,
70 (int) current->mm->end_code,
71 (int) current->mm->start_data,
72 (int) current->mm->end_data,
73 (int) current->mm->end_data,
74 (int) current->mm->brk);
75 printk("USER-STACK=%08x KERNEL-STACK=%08x\n\n",
76 (int) current->mm->start_stack,
77 (int) PAGE_SIZE+(unsigned long)current);
80 printk("PC: %08lx\n", (long)fp->pc);
81 printk("CCR: %08lx SP: %08lx\n", fp->ccr, (long) fp);
82 printk("ER0: %08lx ER1: %08lx ER2: %08lx ER3: %08lx\n",
83 fp->er0, fp->er1, fp->er2, fp->er3);
85 tp = ((unsigned char *) fp->pc) - 0x20;
86 for (sp = (unsigned long *) tp, i = 0; (i < 0x40); i += 4) {
88 printk("\n%08x: ", (int) (tp + i));
89 printk("%08x ", (int) *sp++);
93 printk("\nKERNEL STACK:");
94 tp = ((unsigned char *) fp) - 0x40;
95 for (sp = (unsigned long *) tp, i = 0; (i < 0xc0); i += 4) {
97 printk("\n%08x: ", (int) (tp + i));
98 printk("%08x ", (int) *sp++);
101 if (STACK_MAGIC != *(unsigned long *)((unsigned long)current+PAGE_SIZE))
102 printk("(Possibly corrupted stack page??)\n");
107 void show_trace_task(struct task_struct *tsk)
109 /* DAVIDM: we can do better, need a proper stack dump */
110 printk("STACK ksp=0x%lx, usp=0x%lx\n", tsk->thread.ksp, tsk->thread.usp);
113 void die_if_kernel (char *str, struct pt_regs *fp, int nr)
115 extern int console_loglevel;
117 if (!(fp->ccr & PS_S))
120 console_loglevel = 15;