diff options
author | David Daney <ddaney@caviumnetworks.com> | 2010-08-03 11:22:20 -0700 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2010-08-05 13:26:29 +0100 |
commit | c1bf207d6ee1eb72e9c10365edbdc7c9ff7fb9b0 (patch) | |
tree | 4c5875c8bd9087cd7b2193ac264c002cc384febb /arch/mips/mm | |
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/mm')
-rw-r--r-- | arch/mips/mm/fault.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c index b4aac424b2e9..783ad0065fdf 100644 --- a/arch/mips/mm/fault.c +++ b/arch/mips/mm/fault.c @@ -17,6 +17,7 @@ #include <linux/mm.h> #include <linux/smp.h> #include <linux/module.h> +#include <linux/kprobes.h> #include <asm/branch.h> #include <asm/mmu_context.h> @@ -24,13 +25,14 @@ #include <asm/uaccess.h> #include <asm/ptrace.h> #include <asm/highmem.h> /* For VMALLOC_END */ +#include <linux/kdebug.h> /* * This routine handles page faults. It determines the address, * and the problem, and then passes it off to one of the appropriate * routines. */ -asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write, +asmlinkage void __kprobes do_page_fault(struct pt_regs *regs, unsigned long write, unsigned long address) { struct vm_area_struct * vma = NULL; @@ -46,6 +48,17 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write, field, regs->cp0_epc); #endif +#ifdef CONFIG_KPROBES + /* + * This is to notify the fault handler of the kprobes. The + * exception code is redundant as it is also carried in REGS, + * but we pass it anyhow. + */ + if (notify_die(DIE_PAGE_FAULT, "page fault", regs, -1, + (regs->cp0_cause >> 2) & 0x1f, SIGSEGV) == NOTIFY_STOP) + return; +#endif + info.si_code = SEGV_MAPERR; /* |