patch-2.1.129 linux/arch/sparc/mm/fault.c

Next file: linux/arch/sparc/mm/generic.c
Previous file: linux/arch/sparc/kernel/sun4m_smp.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.128/linux/arch/sparc/mm/fault.c linux/arch/sparc/mm/fault.c
@@ -1,4 +1,4 @@
-/* $Id: fault.c,v 1.95 1998/09/18 19:50:32 davem Exp $
+/* $Id: fault.c,v 1.96 1998/11/08 11:13:56 davem Exp $
  * fault.c:  Page fault handlers for the Sparc.
  *
  * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
@@ -231,7 +231,8 @@
 		if(!(vma->vm_flags & (VM_READ | VM_EXEC)))
 			goto bad_area;
 	}
-	handle_mm_fault(current, vma, address, write);
+	if (!handle_mm_fault(current, vma, address, write))
+		goto do_sigbus;
 	up(&mm->mmap_sem);
 	return;
 	/*
@@ -241,7 +242,7 @@
 bad_area:
 	up(&mm->mmap_sem);
 	/* Is this in ex_table? */
-	
+do_kernel_fault:
 	g2 = regs->u_regs[UREG_G2];
 	if (!from_user && (fixup = search_exception_table (regs->pc, &g2))) {
 		if (fixup > 10) { /* Values below are reserved for other things */
@@ -279,6 +280,15 @@
 		return;
 	}
 	unhandled_fault (address, tsk, regs);
+	return;
+
+do_sigbus:
+	up(&mm->mmap_sem);
+	tsk->tss.sig_address = address;
+	tsk->tss.sig_desc = SUBSIG_MISCERROR;
+	force_sig(SIGBUS, tsk);
+	if (! from_user)
+		goto do_kernel_fault;
 }
 
 asmlinkage void do_sun4c_fault(struct pt_regs *regs, int text_fault, int write,
@@ -372,7 +382,8 @@
 	else
 		if(!(vma->vm_flags & (VM_READ | VM_EXEC)))
 			goto bad_area;
-	handle_mm_fault(current, vma, address, write);
+	if (!handle_mm_fault(current, vma, address, write))
+		goto do_sigbus;
 	up(&mm->mmap_sem);
 	return;
 bad_area:
@@ -385,6 +396,12 @@
 	tsk->tss.sig_desc = SUBSIG_NOMAPPING;
 	send_sig(SIGSEGV, tsk, 1);
 	return;
+
+do_sigbus:
+	up(&mm->mmap_sem);
+	tsk->tss.sig_address = address;
+	tsk->tss.sig_desc = SUBSIG_MISCERROR;
+	force_sig(SIGBUS, tsk);
 }
 
 void window_overflow_fault(void)

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