patch-2.0.31 linux/include/asm-alpha/fpu.h

Next file: linux/include/asm-alpha/processor.h
Previous file: linux/include/asm-alpha/fcntl.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.0.30/linux/include/asm-alpha/fpu.h linux/include/asm-alpha/fpu.h
@@ -57,8 +57,29 @@
 				 IEEE_STATUS_OVF | IEEE_STATUS_UNF |	\
 				 IEEE_STATUS_INE)
 
+#define IEEE_SW_MASK		(IEEE_TRAP_ENABLE_MASK | IEEE_STATUS_MASK)
+
 #define IEEE_STATUS_TO_EXCSUM_SHIFT	16
 
 #define IEEE_INHERIT    (1UL<<63)	/* inherit on thread create? */
+
+/*
+ * Convert the software IEEE trap enables and status bits into the 
+ * hardware fpcr format.
+ */
+
+static inline unsigned long
+ieee_sw_to_fpcr(unsigned long sw)
+{
+	unsigned long fpcw;
+	fpcw = (sw & IEEE_STATUS_MASK) << 35;
+	fpcw |= sw & IEEE_STATUS_MASK ? FPCR_SUM : 0;
+	fpcw |= (~sw & (IEEE_TRAP_ENABLE_INV
+			| IEEE_TRAP_ENABLE_DZE
+			| IEEE_TRAP_ENABLE_OVF)) << 48;
+	fpcw |= (~sw & (IEEE_TRAP_ENABLE_UNF | IEEE_TRAP_ENABLE_INE)) << 57;
+	return fpcw;
+}
+
 
 #endif /* __ASM_ALPHA_FPU_H */

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