|
@@ -12,8 +12,12 @@
|
|
|
#include <linux/irq.h>
|
|
|
#include <linux/kdebug.h>
|
|
|
#include <linux/kgdb.h>
|
|
|
+#include <linux/uaccess.h>
|
|
|
+
|
|
|
#include <asm/traps.h>
|
|
|
|
|
|
+#include "patch.h"
|
|
|
+
|
|
|
struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] =
|
|
|
{
|
|
|
{ "r0", 4, offsetof(struct pt_regs, ARM_r0)},
|
|
@@ -244,6 +248,31 @@ void kgdb_arch_exit(void)
|
|
|
unregister_die_notifier(&kgdb_notifier);
|
|
|
}
|
|
|
|
|
|
+int kgdb_arch_set_breakpoint(struct kgdb_bkpt *bpt)
|
|
|
+{
|
|
|
+ int err;
|
|
|
+
|
|
|
+ /* patch_text() only supports int-sized breakpoints */
|
|
|
+ BUILD_BUG_ON(sizeof(int) != BREAK_INSTR_SIZE);
|
|
|
+
|
|
|
+ err = probe_kernel_read(bpt->saved_instr, (char *)bpt->bpt_addr,
|
|
|
+ BREAK_INSTR_SIZE);
|
|
|
+ if (err)
|
|
|
+ return err;
|
|
|
+
|
|
|
+ patch_text((void *)bpt->bpt_addr,
|
|
|
+ *(unsigned int *)arch_kgdb_ops.gdb_bpt_instr);
|
|
|
+
|
|
|
+ return err;
|
|
|
+}
|
|
|
+
|
|
|
+int kgdb_arch_remove_breakpoint(struct kgdb_bkpt *bpt)
|
|
|
+{
|
|
|
+ patch_text((void *)bpt->bpt_addr, *(unsigned int *)bpt->saved_instr);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
/*
|
|
|
* Register our undef instruction hooks with ARM undef core.
|
|
|
* We regsiter a hook specifically looking for the KGB break inst
|