aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/kernel')
-rw-r--r--arch/arm/kernel/kgdb.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/arch/arm/kernel/kgdb.c b/arch/arm/kernel/kgdb.c
index cf846cade354..778c2f7024ff 100644
--- a/arch/arm/kernel/kgdb.c
+++ b/arch/arm/kernel/kgdb.c
@@ -10,6 +10,7 @@
10 * Deepak Saxena <dsaxena@plexity.net> 10 * Deepak Saxena <dsaxena@plexity.net>
11 */ 11 */
12#include <linux/irq.h> 12#include <linux/irq.h>
13#include <linux/kdebug.h>
13#include <linux/kgdb.h> 14#include <linux/kgdb.h>
14#include <asm/traps.h> 15#include <asm/traps.h>
15 16
@@ -180,6 +181,33 @@ void kgdb_roundup_cpus(unsigned long flags)
180 local_irq_disable(); 181 local_irq_disable();
181} 182}
182 183
184static int __kgdb_notify(struct die_args *args, unsigned long cmd)
185{
186 struct pt_regs *regs = args->regs;
187
188 if (kgdb_handle_exception(1, args->signr, cmd, regs))
189 return NOTIFY_DONE;
190 return NOTIFY_STOP;
191}
192static int
193kgdb_notify(struct notifier_block *self, unsigned long cmd, void *ptr)
194{
195 unsigned long flags;
196 int ret;
197
198 local_irq_save(flags);
199 ret = __kgdb_notify(ptr, cmd);
200 local_irq_restore(flags);
201
202 return ret;
203}
204
205static struct notifier_block kgdb_notifier = {
206 .notifier_call = kgdb_notify,
207 .priority = -INT_MAX,
208};
209
210
183/** 211/**
184 * kgdb_arch_init - Perform any architecture specific initalization. 212 * kgdb_arch_init - Perform any architecture specific initalization.
185 * 213 *
@@ -188,6 +216,11 @@ void kgdb_roundup_cpus(unsigned long flags)
188 */ 216 */
189int kgdb_arch_init(void) 217int kgdb_arch_init(void)
190{ 218{
219 int ret = register_die_notifier(&kgdb_notifier);
220
221 if (ret != 0)
222 return ret;
223
191 register_undef_hook(&kgdb_brkpt_hook); 224 register_undef_hook(&kgdb_brkpt_hook);
192 register_undef_hook(&kgdb_compiled_brkpt_hook); 225 register_undef_hook(&kgdb_compiled_brkpt_hook);
193 226
@@ -204,6 +237,7 @@ void kgdb_arch_exit(void)
204{ 237{
205 unregister_undef_hook(&kgdb_brkpt_hook); 238 unregister_undef_hook(&kgdb_brkpt_hook);
206 unregister_undef_hook(&kgdb_compiled_brkpt_hook); 239 unregister_undef_hook(&kgdb_compiled_brkpt_hook);
240 unregister_die_notifier(&kgdb_notifier);
207} 241}
208 242
209/* 243/*