patch-2.0.21-2.1.0 linux/arch/m68k/mm/fault.c

Next file: linux/arch/m68k/mm/init.c
Previous file: linux/arch/m68k/lib/semaphore.S
Back to the patch index
Back to the overall index

diff -u --recursive --new-file lx2.0/v2.0.21/linux/arch/m68k/mm/fault.c linux/arch/m68k/mm/fault.c
@@ -29,14 +29,17 @@
 			      unsigned long error_code)
 {
 	struct vm_area_struct * vma;
+	struct task_struct *tsk = current;
+	struct mm_struct *mm = tsk->mm;
 
 #ifdef DEBUG
 	printk ("regs->sr=%#x, regs->pc=%#lx, address=%#lx, %ld, %p\n",
 		regs->sr, regs->pc, address, error_code,
-		current->tss.pagedir_v);
+		tsk->tss.pagedir_v);
 #endif
 
-	vma = find_vma(current, address);
+	down(&mm->mmap_sem);
+	vma = find_vma(mm, address);
 	if (!vma)
 	  goto bad_area;
 	if (vma->vm_start <= address)
@@ -73,17 +76,18 @@
 	    goto bad_area;
 	}
 	if (error_code & 1) {
-		do_wp_page(current, vma, address, error_code & 2);
+		do_wp_page(tsk, vma, address, error_code & 2);
+		up(&mm->mmap_sem);
 		return 0;
 	}
-	do_no_page(current, vma, address, error_code & 2);
+	do_no_page(tsk, vma, address, error_code & 2);
+	up(&mm->mmap_sem);
 
 	/* There seems to be a missing invalidate somewhere in do_no_page.
 	 * Until I found it, this one cures the problem and makes
 	 * 1.2 run on the 68040 (Martin Apel).
 	 */
-	flush_tlb_all();
-
+	flush_tlb_page(vma, address);
 	return 0;
 
 /*
@@ -91,9 +95,10 @@
  * Fix it, but check if it's kernel or user first..
  */
 bad_area:
+	up(&mm->mmap_sem);
 	if (user_mode(regs)) {
 		/* User memory access */
-		force_sig (SIGSEGV, current);
+		force_sig (SIGSEGV, tsk);
 		return 1;
 	}
 
@@ -111,3 +116,4 @@
 
 	return 1;
 }
+

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov