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/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 @@ | |||
17 | #include <linux/mm.h> | 17 | #include <linux/mm.h> |
18 | #include <linux/smp.h> | 18 | #include <linux/smp.h> |
19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <linux/kprobes.h> | ||
20 | 21 | ||
21 | #include <asm/branch.h> | 22 | #include <asm/branch.h> |
22 | #include <asm/mmu_context.h> | 23 | #include <asm/mmu_context.h> |
@@ -24,13 +25,14 @@ | |||
24 | #include <asm/uaccess.h> | 25 | #include <asm/uaccess.h> |
25 | #include <asm/ptrace.h> | 26 | #include <asm/ptrace.h> |
26 | #include <asm/highmem.h> /* For VMALLOC_END */ | 27 | #include <asm/highmem.h> /* For VMALLOC_END */ |
28 | #include <linux/kdebug.h> | ||
27 | 29 | ||
28 | /* | 30 | /* |
29 | * This routine handles page faults. It determines the address, | 31 | * This routine handles page faults. It determines the address, |
30 | * and the problem, and then passes it off to one of the appropriate | 32 | * and the problem, and then passes it off to one of the appropriate |
31 | * routines. | 33 | * routines. |
32 | */ | 34 | */ |
33 | asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write, | 35 | asmlinkage void __kprobes do_page_fault(struct pt_regs *regs, unsigned long write, |
34 | unsigned long address) | 36 | unsigned long address) |
35 | { | 37 | { |
36 | struct vm_area_struct * vma = NULL; | 38 | struct vm_area_struct * vma = NULL; |
@@ -46,6 +48,17 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write, | |||
46 | field, regs->cp0_epc); | 48 | field, regs->cp0_epc); |
47 | #endif | 49 | #endif |
48 | 50 | ||
51 | #ifdef CONFIG_KPROBES | ||
52 | /* | ||
53 | * This is to notify the fault handler of the kprobes. The | ||
54 | * exception code is redundant as it is also carried in REGS, | ||
55 | * but we pass it anyhow. | ||
56 | */ | ||
57 | if (notify_die(DIE_PAGE_FAULT, "page fault", regs, -1, | ||
58 | (regs->cp0_cause >> 2) & 0x1f, SIGSEGV) == NOTIFY_STOP) | ||
59 | return; | ||
60 | #endif | ||
61 | |||
49 | info.si_code = SEGV_MAPERR; | 62 | info.si_code = SEGV_MAPERR; |
50 | 63 | ||
51 | /* | 64 | /* |