patch-2.2.15 linux/arch/alpha/kernel/osf_sys.c

Next file: linux/arch/alpha/kernel/process.c
Previous file: linux/arch/alpha/kernel/irq.c
Back to the patch index
Back to the overall index

diff -u --new-file --recursive --exclude-from ../../exclude v2.2.14/arch/alpha/kernel/osf_sys.c linux/arch/alpha/kernel/osf_sys.c
@@ -886,20 +886,8 @@
 		/* Return current software fp control & status bits.  */
 		/* Note that DU doesn't verify available space here.  */
 
-		/* EV6 implements most of the bits in hardware.  If
-		   UNDZ is not set, UNFD is maintained in software.  */
-		if (implver() == IMPLVER_EV6) {
-			unsigned long fpcr = rdfpcr();
-			w = ieee_fpcr_to_swcr(fpcr);
-			if (!(fpcr & FPCR_UNDZ)) {
-				w &= ~IEEE_TRAP_ENABLE_UNF;
-				w |= current->tss.flags & IEEE_TRAP_ENABLE_UNF;
-			}
-		} else {
-			/* Otherwise we are forced to do everything in sw.  */
-			w = current->tss.flags & IEEE_SW_MASK;
-		}
-
+		w = current->tss.flags & IEEE_SW_MASK;
+		w = swcr_update_status(w, rdfpcr());
 		if (put_user(w, (unsigned long *) buffer))
 			return -EFAULT;
 		return 0;
@@ -950,7 +938,7 @@
 {
 	switch (op) {
 	case SSI_IEEE_FP_CONTROL: {
-		unsigned long swcr, fpcr, undz, ev6;
+		unsigned long swcr, fpcr;
 
 		/* 
 		 * Alpha Architecture Handbook 4.7.7.3:
@@ -959,29 +947,24 @@
 		 * set in the trap shadow of a software-complete insn.
 		 */
 
-		ev6 = (implver() == IMPLVER_EV6);
-
 		/* Update softare trap enable bits.  */
 		if (get_user(swcr, (unsigned long *)buffer))
 			return -EFAULT;
 		current->tss.flags &= ~IEEE_SW_MASK;
 		current->tss.flags |= swcr & IEEE_SW_MASK;
 
-		/* Update the real fpcr.  Keep UNFD off if not UNDZ.  */
+		/* Update the real fpcr.  */
 		fpcr = rdfpcr();
-		if(ev6) {
-		    undz = (fpcr & FPCR_UNDZ);
-		    fpcr &= (~(FPCR_MASK | FPCR_UNDZ)) | FPCR_DYN_MASK;
-		}
-		else {
-		    fpcr &= (~FPCR_MASK) | FPCR_DYN_MASK;
-		}
+		fpcr &= FPCR_DYN_MASK;
 		fpcr |= ieee_swcr_to_fpcr(swcr);
-		if(ev6 && !undz) {
-		    fpcr &= ~FPCR_UNFD;
-		}
 		wrfpcr(fpcr);
-		   
+
+		/* If any exceptions are now unmasked, send a signal.  */
+		if (((swcr & IEEE_STATUS_MASK)
+		     >> IEEE_STATUS_TO_EXCSUM_SHIFT) & swcr) {
+			send_sig(SIGFPE, current, 1);
+		}
+
 		return 0;
 	}
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)