fault.c (5ad18b2e60b75c7297a998dea702451d33a052ed) fault.c (b98cca444d287a63dd96df04af7fb9793567599e)
1/*
2 * Page fault handler for SH with an MMU.
3 *
4 * Copyright (C) 1999 Niibe Yutaka
5 * Copyright (C) 2003 - 2012 Paul Mundt
6 *
7 * Based on linux/arch/i386/mm/fault.c:
8 * Copyright (C) 1995 Linus Torvalds

--- 10 unchanged lines hidden (view full) ---

19#include <linux/perf_event.h>
20#include <linux/kdebug.h>
21#include <linux/uaccess.h>
22#include <asm/io_trapped.h>
23#include <asm/mmu_context.h>
24#include <asm/tlbflush.h>
25#include <asm/traps.h>
26
1/*
2 * Page fault handler for SH with an MMU.
3 *
4 * Copyright (C) 1999 Niibe Yutaka
5 * Copyright (C) 2003 - 2012 Paul Mundt
6 *
7 * Based on linux/arch/i386/mm/fault.c:
8 * Copyright (C) 1995 Linus Torvalds

--- 10 unchanged lines hidden (view full) ---

19#include <linux/perf_event.h>
20#include <linux/kdebug.h>
21#include <linux/uaccess.h>
22#include <asm/io_trapped.h>
23#include <asm/mmu_context.h>
24#include <asm/tlbflush.h>
25#include <asm/traps.h>
26
27static inline int notify_page_fault(struct pt_regs *regs, int trap)
28{
29 int ret = 0;
30
31 if (kprobes_built_in() && !user_mode(regs)) {
32 preempt_disable();
33 if (kprobe_running() && kprobe_fault_handler(regs, trap))
34 ret = 1;
35 preempt_enable();
36 }
37
38 return ret;
39}
40
41static void
42force_sig_info_fault(int si_signo, int si_code, unsigned long address)
43{
44 force_sig_fault(si_signo, si_code, (void __user *)address);
45}
46
47/*
48 * This is useful to dump out the page tables associated with

--- 358 unchanged lines hidden (view full) ---

407 * NOTE! We MUST NOT take any locks for this case. We may
408 * be in an interrupt or a critical region, and should
409 * only copy the information from the master page table,
410 * nothing more.
411 */
412 if (unlikely(fault_in_kernel_space(address))) {
413 if (vmalloc_fault(address) >= 0)
414 return;
27static void
28force_sig_info_fault(int si_signo, int si_code, unsigned long address)
29{
30 force_sig_fault(si_signo, si_code, (void __user *)address);
31}
32
33/*
34 * This is useful to dump out the page tables associated with

--- 358 unchanged lines hidden (view full) ---

393 * NOTE! We MUST NOT take any locks for this case. We may
394 * be in an interrupt or a critical region, and should
395 * only copy the information from the master page table,
396 * nothing more.
397 */
398 if (unlikely(fault_in_kernel_space(address))) {
399 if (vmalloc_fault(address) >= 0)
400 return;
415 if (notify_page_fault(regs, vec))
401 if (kprobe_page_fault(regs, vec))
416 return;
417
418 bad_area_nosemaphore(regs, error_code, address);
419 return;
420 }
421
402 return;
403
404 bad_area_nosemaphore(regs, error_code, address);
405 return;
406 }
407
422 if (unlikely(notify_page_fault(regs, vec)))
408 if (unlikely(kprobe_page_fault(regs, vec)))
423 return;
424
425 /* Only enable interrupts if they were on before the fault */
426 if ((regs->sr & SR_IMASK) != SR_IMASK)
427 local_irq_enable();
428
429 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
430

--- 81 unchanged lines hidden ---
409 return;
410
411 /* Only enable interrupts if they were on before the fault */
412 if ((regs->sr & SR_IMASK) != SR_IMASK)
413 local_irq_enable();
414
415 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
416

--- 81 unchanged lines hidden ---