aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-05-21 14:08:05 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-21 14:08:05 -0400
commit90b9a32d8f441369b2f97a765d2d957b531eb653 (patch)
tree3146d251a983ba12226e75c121613de6f051af8b /arch/mips
parent8b108c609adefd98577c35f0a41497a610041a6c (diff)
parent4402c153cb9c549cd21d6007ef0dfac50c8d148d (diff)
Merge branch 'kdb-merge' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb
* 'kdb-merge' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb: (25 commits) kdb,debug_core: Allow the debug core to receive a panic notification MAINTAINERS: update kgdb, kdb, and debug_core info debug_core,kdb: Allow the debug core to process a recursive debug entry printk,kdb: capture printk() when in kdb shell kgdboc,kdb: Allow kdb to work on a non open console port kgdb: Add the ability to schedule a breakpoint via a tasklet mips,kgdb: kdb low level trap catch and stack trace powerpc,kgdb: Introduce low level trap catching x86,kgdb: Add low level debug hook kgdb: remove post_primary_code references kgdb,docs: Update the kgdb docs to include kdb kgdboc,keyboard: Keyboard driver for kdb with kgdb kgdb: gdb "monitor" -> kdb passthrough sparc,sunzilog: Add console polling support for sunzilog serial driver sh,sh-sci: Use NO_POLL_CHAR in the SCIF polled console code kgdb,8250,pl011: Return immediately from console poll kgdb: core changes to support kdb kdb: core for kgdb back end (2 of 2) kdb: core for kgdb back end (1 of 2) kgdb,blackfin: Add in kgdb_arch_set_pc for blackfin ...
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/include/asm/kgdb.h2
-rw-r--r--arch/mips/kernel/kgdb.c27
-rw-r--r--arch/mips/kernel/traps.c13
3 files changed, 41 insertions, 1 deletions
diff --git a/arch/mips/include/asm/kgdb.h b/arch/mips/include/asm/kgdb.h
index 48223b09396c..19002d605ac4 100644
--- a/arch/mips/include/asm/kgdb.h
+++ b/arch/mips/include/asm/kgdb.h
@@ -38,6 +38,8 @@ extern int kgdb_early_setup;
38extern void *saved_vectors[32]; 38extern void *saved_vectors[32];
39extern void handle_exception(struct pt_regs *regs); 39extern void handle_exception(struct pt_regs *regs);
40extern void breakinst(void); 40extern void breakinst(void);
41extern int kgdb_ll_trap(int cmd, const char *str,
42 struct pt_regs *regs, long err, int trap, int sig);
41 43
42#endif /* __KERNEL__ */ 44#endif /* __KERNEL__ */
43 45
diff --git a/arch/mips/kernel/kgdb.c b/arch/mips/kernel/kgdb.c
index 50c9bb880667..9b78ff6e9b84 100644
--- a/arch/mips/kernel/kgdb.c
+++ b/arch/mips/kernel/kgdb.c
@@ -180,6 +180,11 @@ void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
180 *(ptr++) = regs->cp0_epc; 180 *(ptr++) = regs->cp0_epc;
181} 181}
182 182
183void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc)
184{
185 regs->cp0_epc = pc;
186}
187
183/* 188/*
184 * Calls linux_debug_hook before the kernel dies. If KGDB is enabled, 189 * Calls linux_debug_hook before the kernel dies. If KGDB is enabled,
185 * then try to fall into the debugger 190 * then try to fall into the debugger
@@ -198,7 +203,7 @@ static int kgdb_mips_notify(struct notifier_block *self, unsigned long cmd,
198 if (atomic_read(&kgdb_active) != -1) 203 if (atomic_read(&kgdb_active) != -1)
199 kgdb_nmicallback(smp_processor_id(), regs); 204 kgdb_nmicallback(smp_processor_id(), regs);
200 205
201 if (kgdb_handle_exception(trap, compute_signal(trap), 0, regs)) 206 if (kgdb_handle_exception(trap, compute_signal(trap), cmd, regs))
202 return NOTIFY_DONE; 207 return NOTIFY_DONE;
203 208
204 if (atomic_read(&kgdb_setting_breakpoint)) 209 if (atomic_read(&kgdb_setting_breakpoint))
@@ -212,6 +217,26 @@ static int kgdb_mips_notify(struct notifier_block *self, unsigned long cmd,
212 return NOTIFY_STOP; 217 return NOTIFY_STOP;
213} 218}
214 219
220#ifdef CONFIG_KGDB_LOW_LEVEL_TRAP
221int kgdb_ll_trap(int cmd, const char *str,
222 struct pt_regs *regs, long err, int trap, int sig)
223{
224 struct die_args args = {
225 .regs = regs,
226 .str = str,
227 .err = err,
228 .trapnr = trap,
229 .signr = sig,
230
231 };
232
233 if (!kgdb_io_module_registered)
234 return NOTIFY_DONE;
235
236 return kgdb_mips_notify(NULL, cmd, &args);
237}
238#endif /* CONFIG_KGDB_LOW_LEVEL_TRAP */
239
215static struct notifier_block kgdb_notifier = { 240static struct notifier_block kgdb_notifier = {
216 .notifier_call = kgdb_mips_notify, 241 .notifier_call = kgdb_mips_notify,
217}; 242};
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index d612c6dcb746..950bde8813fc 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -26,6 +26,7 @@
26#include <linux/kgdb.h> 26#include <linux/kgdb.h>
27#include <linux/kdebug.h> 27#include <linux/kdebug.h>
28#include <linux/notifier.h> 28#include <linux/notifier.h>
29#include <linux/kdb.h>
29 30
30#include <asm/bootinfo.h> 31#include <asm/bootinfo.h>
31#include <asm/branch.h> 32#include <asm/branch.h>
@@ -185,6 +186,11 @@ void show_stack(struct task_struct *task, unsigned long *sp)
185 regs.regs[29] = task->thread.reg29; 186 regs.regs[29] = task->thread.reg29;
186 regs.regs[31] = 0; 187 regs.regs[31] = 0;
187 regs.cp0_epc = task->thread.reg31; 188 regs.cp0_epc = task->thread.reg31;
189#ifdef CONFIG_KGDB_KDB
190 } else if (atomic_read(&kgdb_active) != -1 &&
191 kdb_current_regs) {
192 memcpy(&regs, kdb_current_regs, sizeof(regs));
193#endif /* CONFIG_KGDB_KDB */
188 } else { 194 } else {
189 prepare_frametrace(&regs); 195 prepare_frametrace(&regs);
190 } 196 }
@@ -360,6 +366,8 @@ void __noreturn die(const char * str, struct pt_regs * regs)
360 unsigned long dvpret = dvpe(); 366 unsigned long dvpret = dvpe();
361#endif /* CONFIG_MIPS_MT_SMTC */ 367#endif /* CONFIG_MIPS_MT_SMTC */
362 368
369 notify_die(DIE_OOPS, str, (struct pt_regs *)regs, SIGSEGV, 0, 0);
370
363 console_verbose(); 371 console_verbose();
364 spin_lock_irq(&die_lock); 372 spin_lock_irq(&die_lock);
365 bust_spinlocks(1); 373 bust_spinlocks(1);
@@ -704,6 +712,11 @@ static void do_trap_or_bp(struct pt_regs *regs, unsigned int code,
704 siginfo_t info; 712 siginfo_t info;
705 char b[40]; 713 char b[40];
706 714
715#ifdef CONFIG_KGDB_LOW_LEVEL_TRAP
716 if (kgdb_ll_trap(DIE_TRAP, str, regs, code, 0, 0) == NOTIFY_STOP)
717 return;
718#endif /* CONFIG_KGDB_LOW_LEVEL_TRAP */
719
707 if (notify_die(DIE_TRAP, str, regs, code, 0, 0) == NOTIFY_STOP) 720 if (notify_die(DIE_TRAP, str, regs, code, 0, 0) == NOTIFY_STOP)
708 return; 721 return;
709 722