diff options
-rw-r--r-- | arch/microblaze/include/asm/exceptions.h | 24 | ||||
-rw-r--r-- | arch/microblaze/kernel/traps.c | 34 |
2 files changed, 42 insertions, 16 deletions
diff --git a/arch/microblaze/include/asm/exceptions.h b/arch/microblaze/include/asm/exceptions.h index 24ca540e77c0..90731df9e574 100644 --- a/arch/microblaze/include/asm/exceptions.h +++ b/arch/microblaze/include/asm/exceptions.h | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * Preliminary support for HW exception handing for Microblaze | 2 | * Preliminary support for HW exception handing for Microblaze |
3 | * | 3 | * |
4 | * Copyright (C) 2008 Michal Simek | 4 | * Copyright (C) 2008-2009 Michal Simek <monstr@monstr.eu> |
5 | * Copyright (C) 2008 PetaLogix | 5 | * Copyright (C) 2008-2009 PetaLogix |
6 | * Copyright (C) 2005 John Williams <jwilliams@itee.uq.edu.au> | 6 | * Copyright (C) 2005 John Williams <jwilliams@itee.uq.edu.au> |
7 | * | 7 | * |
8 | * This file is subject to the terms and conditions of the GNU General | 8 | * This file is subject to the terms and conditions of the GNU General |
@@ -64,21 +64,13 @@ asmlinkage void full_exception(struct pt_regs *regs, unsigned int type, | |||
64 | void die(const char *str, struct pt_regs *fp, long err); | 64 | void die(const char *str, struct pt_regs *fp, long err); |
65 | void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr); | 65 | void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr); |
66 | 66 | ||
67 | #if defined(CONFIG_XMON) | 67 | #ifdef CONFIG_MMU |
68 | extern void xmon(struct pt_regs *regs); | 68 | void __bug(const char *file, int line, void *data); |
69 | extern int xmon_bpt(struct pt_regs *regs); | 69 | int bad_trap(int trap_num, struct pt_regs *regs); |
70 | extern int xmon_sstep(struct pt_regs *regs); | 70 | int debug_trap(struct pt_regs *regs); |
71 | extern int xmon_iabr_match(struct pt_regs *regs); | 71 | #endif /* CONFIG_MMU */ |
72 | extern int xmon_dabr_match(struct pt_regs *regs); | ||
73 | extern void (*xmon_fault_handler)(struct pt_regs *regs); | ||
74 | 72 | ||
75 | void (*debugger)(struct pt_regs *regs) = xmon; | 73 | #if defined(CONFIG_KGDB) |
76 | int (*debugger_bpt)(struct pt_regs *regs) = xmon_bpt; | ||
77 | int (*debugger_sstep)(struct pt_regs *regs) = xmon_sstep; | ||
78 | int (*debugger_iabr_match)(struct pt_regs *regs) = xmon_iabr_match; | ||
79 | int (*debugger_dabr_match)(struct pt_regs *regs) = xmon_dabr_match; | ||
80 | void (*debugger_fault_handler)(struct pt_regs *regs); | ||
81 | #elif defined(CONFIG_KGDB) | ||
82 | void (*debugger)(struct pt_regs *regs); | 74 | void (*debugger)(struct pt_regs *regs); |
83 | int (*debugger_bpt)(struct pt_regs *regs); | 75 | int (*debugger_bpt)(struct pt_regs *regs); |
84 | int (*debugger_sstep)(struct pt_regs *regs); | 76 | int (*debugger_sstep)(struct pt_regs *regs); |
diff --git a/arch/microblaze/kernel/traps.c b/arch/microblaze/kernel/traps.c index 6322cc174474..eaaaf805f31b 100644 --- a/arch/microblaze/kernel/traps.c +++ b/arch/microblaze/kernel/traps.c | |||
@@ -97,3 +97,37 @@ void dump_stack(void) | |||
97 | show_stack(NULL, NULL); | 97 | show_stack(NULL, NULL); |
98 | } | 98 | } |
99 | EXPORT_SYMBOL(dump_stack); | 99 | EXPORT_SYMBOL(dump_stack); |
100 | |||
101 | #ifdef CONFIG_MMU | ||
102 | void __bug(const char *file, int line, void *data) | ||
103 | { | ||
104 | if (data) | ||
105 | printk(KERN_CRIT "kernel BUG at %s:%d (data = %p)!\n", | ||
106 | file, line, data); | ||
107 | else | ||
108 | printk(KERN_CRIT "kernel BUG at %s:%d!\n", file, line); | ||
109 | |||
110 | machine_halt(); | ||
111 | } | ||
112 | |||
113 | int bad_trap(int trap_num, struct pt_regs *regs) | ||
114 | { | ||
115 | printk(KERN_CRIT | ||
116 | "unimplemented trap %d called at 0x%08lx, pid %d!\n", | ||
117 | trap_num, regs->pc, current->pid); | ||
118 | return -ENOSYS; | ||
119 | } | ||
120 | |||
121 | int debug_trap(struct pt_regs *regs) | ||
122 | { | ||
123 | int i; | ||
124 | printk(KERN_CRIT "debug trap\n"); | ||
125 | for (i = 0; i < 32; i++) { | ||
126 | /* printk("r%i:%08X\t",i,regs->gpr[i]); */ | ||
127 | if ((i % 4) == 3) | ||
128 | printk(KERN_CRIT "\n"); | ||
129 | } | ||
130 | printk(KERN_CRIT "pc:%08lX\tmsr:%08lX\n", regs->pc, regs->msr); | ||
131 | return -ENOSYS; | ||
132 | } | ||
133 | #endif | ||