diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-08 20:32:43 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-08 20:32:43 -0700 |
commit | 0c23664ee8c42f247dba7ceb620baabd892cef88 (patch) | |
tree | e3f37e3260bd938b293cfb8f70f8969b19539973 /arch/sparc64/mm/fault.c | |
parent | 6ec129c3a2f8b38bc37e42348470ccfcb7460146 (diff) | |
parent | 127cda1e8cc282de1ca7a9dcc3866841977b9fcc (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6:
[SPARC64]: Optimize fault kprobe handling just like powerpc.
[SPARC]: Wire up utimensat syscall.
[SPARC64]: Fix request_irq() ignored result warnings in PCI controller code.
[SPARC64]: Kill asm-sparc64/pbm.h
[ATYFB]: Fix sparc includes.
[QLA2XXX]: Fix build on sparc.
[SPARC64]: Removal of trivial pci_controller_info uses.
[SPARC64]: Move index info pci_pbm_info.
[SPARC64]: Move {setup,teardown}_msi_irq into pci_pbm_info.
[SPARC64]: Move pci_ops into pci_pbm_info.
[SPARC64] SBUS: Error interrupt registry cleanups.
[SPARC64] PCI: Use root list of pbm's instead of pci_controller_info's
[SPARC64] PCI: Kill PROM_PCIRNG_MAX and PROM_PCIIMAP_MAX.
[SPARC64] PCI: Use common routine to fetch PBM properties.
Diffstat (limited to 'arch/sparc64/mm/fault.c')
-rw-r--r-- | arch/sparc64/mm/fault.c | 45 |
1 files changed, 14 insertions, 31 deletions
diff --git a/arch/sparc64/mm/fault.c b/arch/sparc64/mm/fault.c index c32e309f778..b582024d219 100644 --- a/arch/sparc64/mm/fault.c +++ b/arch/sparc64/mm/fault.c @@ -32,36 +32,23 @@ #include <asm/mmu_context.h> #ifdef CONFIG_KPROBES -ATOMIC_NOTIFIER_HEAD(notify_page_fault_chain); - -/* Hook to register for page fault notifications */ -int register_page_fault_notifier(struct notifier_block *nb) +static inline int notify_page_fault(struct pt_regs *regs) { - return atomic_notifier_chain_register(¬ify_page_fault_chain, nb); -} - -int unregister_page_fault_notifier(struct notifier_block *nb) -{ - return atomic_notifier_chain_unregister(¬ify_page_fault_chain, nb); -} - -static inline int notify_page_fault(enum die_val val, const char *str, - struct pt_regs *regs, long err, int trap, int sig) -{ - struct die_args args = { - .regs = regs, - .str = str, - .err = err, - .trapnr = trap, - .signr = sig - }; - return atomic_notifier_call_chain(¬ify_page_fault_chain, val, &args); + int ret = 0; + + /* kprobe_running() needs smp_processor_id() */ + if (!user_mode(regs)) { + preempt_disable(); + if (kprobe_running() && kprobe_fault_handler(regs, 0)) + ret = 1; + preempt_enable(); + } + return ret; } #else -static inline int notify_page_fault(enum die_val val, const char *str, - struct pt_regs *regs, long err, int trap, int sig) +static inline int notify_page_fault(struct pt_regs *regs) { - return NOTIFY_DONE; + return 0; } #endif @@ -120,9 +107,6 @@ static void __kprobes unhandled_fault(unsigned long address, printk(KERN_ALERT "tsk->{mm,active_mm}->pgd = %016lx\n", (tsk->mm ? (unsigned long) tsk->mm->pgd : (unsigned long) tsk->active_mm->pgd)); - if (notify_die(DIE_GPF, "general protection fault", regs, - 0, 0, SIGSEGV) == NOTIFY_STOP) - return; die_if_kernel("Oops", regs); } @@ -299,8 +283,7 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs) fault_code = get_thread_fault_code(); - if (notify_page_fault(DIE_PAGE_FAULT, "page_fault", regs, - fault_code, 0, SIGSEGV) == NOTIFY_STOP) + if (notify_page_fault(regs)) return; si_code = SEGV_MAPERR; |