From: Dave A. <ai...@us...> - 2001-03-14 23:06:50
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/vax/mm In directory usw-pr-cvs1:/tmp/cvs-serv1798/mm Modified Files: fault.c Log Message: make fault.c look more like everyone elses Index: fault.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/mm/fault.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- fault.c 2001/01/29 01:00:48 1.2 +++ fault.c 2001/03/14 23:08:49 1.3 @@ -20,6 +20,7 @@ #include <linux/reboot.h> #include <linux/smp.h> #include <linux/smp_lock.h> +#include <asm/hardirq.h> #include <asm/system.h> #include <asm/uaccess.h> @@ -48,20 +49,23 @@ unsigned long address = info->addr; unsigned int reason = info->reason; struct vm_area_struct * vma; + struct task_struct *tsk = current; struct mm_struct *mm = NULL; unsigned fixup; + printk("mmfault: fault at %p\n", address); /* This check, and the mm != NULL checks later, will be removed later, once we actually have a 'current' properly defined */ - if (current != NULL) { - mm = current->mm; + if (tsk != NULL) { + mm = tsk->mm; } - if (mm != NULL) { - down(&mm->mmap_sem); - } - - lock_kernel(); + /* If we're in an interrupt context, or have no user context, + we must not take the fault. */ + if (in_interrupt() || !mm) + goto no_context; + + down (&mm->mmap_sem); vma = find_vma(mm, address); if (!vma) goto bad_area; @@ -93,8 +97,6 @@ goto out_of_memory; } up(&mm->mmap_sem); - out_unlock: - unlock_kernel(); return; /* @@ -102,20 +104,19 @@ * Fix it, but check if it's kernel or user first.. */ bad_area: - if (mm != NULL) { - up(&mm->mmap_sem); - } + up(&mm->mmap_sem); if (user_mode(regs)) { + printk("do_page_fault: sending SIGSEGV\n"); force_sig(SIGSEGV, current); - goto out_unlock; + return; } no_context: /* Are we prepared to handle this fault as an exception? */ if ((fixup = search_exception_table(regs->pc)) != 0) { regs->pc = fixup; - goto out_unlock; + return; } /* @@ -165,7 +166,7 @@ /* Kernel mode? Handle exceptions or die */ if (!user_mode(regs)) goto no_context; - goto out_unlock; + } /* This is the access violation handler */ @@ -209,8 +210,9 @@ accvios in the page fault handler. It will have to go eventually as it's not SMP safe */ if (!active) { - active = 1; + /* active = 1;*/ do_page_fault(info, regs); + printk("finished fault\n"); active = 0; } else { |