|
@@ -2,7 +2,7 @@
|
|
* Page fault handler for SH with an MMU.
|
|
* Page fault handler for SH with an MMU.
|
|
*
|
|
*
|
|
* Copyright (C) 1999 Niibe Yutaka
|
|
* Copyright (C) 1999 Niibe Yutaka
|
|
- * Copyright (C) 2003 - 2007 Paul Mundt
|
|
|
|
|
|
+ * Copyright (C) 2003 - 2008 Paul Mundt
|
|
*
|
|
*
|
|
* Based on linux/arch/i386/mm/fault.c:
|
|
* Based on linux/arch/i386/mm/fault.c:
|
|
* Copyright (C) 1995 Linus Torvalds
|
|
* Copyright (C) 1995 Linus Torvalds
|
|
@@ -21,6 +21,27 @@
|
|
#include <asm/tlbflush.h>
|
|
#include <asm/tlbflush.h>
|
|
#include <asm/kgdb.h>
|
|
#include <asm/kgdb.h>
|
|
|
|
|
|
|
|
+#ifdef CONFIG_KPROBES
|
|
|
|
+static inline int notify_page_fault(struct pt_regs *regs, int trap)
|
|
|
|
+{
|
|
|
|
+ int ret = 0;
|
|
|
|
+
|
|
|
|
+ if (!user_mode(regs)) {
|
|
|
|
+ preempt_disable();
|
|
|
|
+ if (kprobe_running() && kprobe_fault_handler(regs, trap))
|
|
|
|
+ ret = 1;
|
|
|
|
+ preempt_enable();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return ret;
|
|
|
|
+}
|
|
|
|
+#else
|
|
|
|
+static inline int notify_page_fault(struct pt_regs *regs, int trap)
|
|
|
|
+{
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+#endif
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* This routine handles page faults. It determines the address,
|
|
* This routine handles page faults. It determines the address,
|
|
* and the problem, and then passes it off to one of the appropriate
|
|
* and the problem, and then passes it off to one of the appropriate
|
|
@@ -37,6 +58,9 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
|
|
int fault;
|
|
int fault;
|
|
siginfo_t info;
|
|
siginfo_t info;
|
|
|
|
|
|
|
|
+ if (notify_page_fault(regs, writeaccess))
|
|
|
|
+ return;
|
|
|
|
+
|
|
#ifdef CONFIG_SH_KGDB
|
|
#ifdef CONFIG_SH_KGDB
|
|
if (kgdb_nofault && kgdb_bus_err_hook)
|
|
if (kgdb_nofault && kgdb_bus_err_hook)
|
|
kgdb_bus_err_hook();
|
|
kgdb_bus_err_hook();
|
|
@@ -269,6 +293,9 @@ asmlinkage int __kprobes __do_page_fault(struct pt_regs *regs,
|
|
pte_t *pte;
|
|
pte_t *pte;
|
|
pte_t entry;
|
|
pte_t entry;
|
|
|
|
|
|
|
|
+ if (notify_page_fault(regs, writeaccess))
|
|
|
|
+ return 0;
|
|
|
|
+
|
|
#ifdef CONFIG_SH_KGDB
|
|
#ifdef CONFIG_SH_KGDB
|
|
if (kgdb_nofault && kgdb_bus_err_hook)
|
|
if (kgdb_nofault && kgdb_bus_err_hook)
|
|
kgdb_bus_err_hook();
|
|
kgdb_bus_err_hook();
|