diff options
author | David Daney <ddaney@caviumnetworks.com> | 2010-08-03 14:22:20 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2010-08-05 08:26:29 -0400 |
commit | c1bf207d6ee1eb72e9c10365edbdc7c9ff7fb9b0 (patch) | |
tree | 4c5875c8bd9087cd7b2193ac264c002cc384febb /arch/mips/kernel/traps.c | |
parent | 2ea6399f553bf9a47260723b44d50f747e310218 (diff) |
MIPS: kprobe: Add support.
This patch is based on previous work by Sony and Himanshu Chauhan.
I have done some cleanup and implemented JProbes and KRETPROBES. The
KRETPROBES part is pretty much copied verbatim from powerpc. A possible
future enhance might be to factor out the common code.
Signed-off-by: David Daney <ddaney@caviumnetworks.com>
Cc: Himanshu Chauhan <hschauhan@nulltrace.org>
To: linux-mips@linux-mips.org
To: ananth@in.ibm.com,
To: anil.s.keshavamurthy@intel.com
To: davem@davemloft.net
To: masami.hiramatsu.pt@hitachi.com
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/1525/
Patchwork: https://patchwork.linux-mips.org/patch/1530/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel/traps.c')
-rw-r--r-- | arch/mips/kernel/traps.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c index 1515b673179d..4c6079f24958 100644 --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/ptrace.h> | 25 | #include <linux/ptrace.h> |
26 | #include <linux/kgdb.h> | 26 | #include <linux/kgdb.h> |
27 | #include <linux/kdebug.h> | 27 | #include <linux/kdebug.h> |
28 | #include <linux/kprobes.h> | ||
28 | #include <linux/notifier.h> | 29 | #include <linux/notifier.h> |
29 | #include <linux/kdb.h> | 30 | #include <linux/kdb.h> |
30 | 31 | ||
@@ -334,7 +335,7 @@ void show_regs(struct pt_regs *regs) | |||
334 | __show_regs((struct pt_regs *)regs); | 335 | __show_regs((struct pt_regs *)regs); |
335 | } | 336 | } |
336 | 337 | ||
337 | void show_registers(const struct pt_regs *regs) | 338 | void show_registers(struct pt_regs *regs) |
338 | { | 339 | { |
339 | const int field = 2 * sizeof(unsigned long); | 340 | const int field = 2 * sizeof(unsigned long); |
340 | 341 | ||
@@ -783,6 +784,25 @@ asmlinkage void do_bp(struct pt_regs *regs) | |||
783 | if (bcode >= (1 << 10)) | 784 | if (bcode >= (1 << 10)) |
784 | bcode >>= 10; | 785 | bcode >>= 10; |
785 | 786 | ||
787 | /* | ||
788 | * notify the kprobe handlers, if instruction is likely to | ||
789 | * pertain to them. | ||
790 | */ | ||
791 | switch (bcode) { | ||
792 | case BRK_KPROBE_BP: | ||
793 | if (notify_die(DIE_BREAK, "debug", regs, bcode, 0, 0) == NOTIFY_STOP) | ||
794 | return; | ||
795 | else | ||
796 | break; | ||
797 | case BRK_KPROBE_SSTEPBP: | ||
798 | if (notify_die(DIE_SSTEPBP, "single_step", regs, bcode, 0, 0) == NOTIFY_STOP) | ||
799 | return; | ||
800 | else | ||
801 | break; | ||
802 | default: | ||
803 | break; | ||
804 | } | ||
805 | |||
786 | do_trap_or_bp(regs, bcode, "Break"); | 806 | do_trap_or_bp(regs, bcode, "Break"); |
787 | return; | 807 | return; |
788 | 808 | ||