Control: tag -1 patch

Hi,

consider the attached patch.

Thanks,

Roland
Description: Use Linux API for floating-point mode
 This patch adds kernel_fpu_begin() and kernel_fpu_end() calls to
 oss_fp_check(), oss_fp_save() and oss_fp_restore().
Author: Roland Stigge <sti...@antcom.de>
Bug-Debian: http://bugs.debian.org/693659

---
 setup/Linux/oss/build/osscore.c |   23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

--- oss4-4.2-build2007.orig/setup/Linux/oss/build/osscore.c
+++ oss4-4.2-build2007/setup/Linux/oss/build/osscore.c
@@ -31,6 +31,9 @@ typedef int *ioctl_arg;
 #include <linux/irq.h>
 #include <linux/sched.h>
 #include <linux/interrupt.h>
+#ifdef CONFIG_OSS_VMIX_FLOAT
+#include <asm/i387.h>
+#endif
 #undef strlen
 #undef strcpy
 #define strlen oss_strlen
@@ -1840,20 +1843,26 @@ oss_fp_check (void)
 
   oss_native_word flags_reg;
 
+  kernel_fpu_begin();
+
   local_save_flags (flags_reg);
   flags_reg &= ~FLAGS_ID;
   local_irq_restore (flags_reg);
 
   local_save_flags (flags_reg);
-  if (flags_reg & FLAGS_ID)
+  if (flags_reg & FLAGS_ID) {
+    kernel_fpu_end();
     return 0;
+  }
 
   flags_reg |= FLAGS_ID;
   local_irq_restore (flags_reg);
 
   local_save_flags (flags_reg);
-  if (!(flags_reg & FLAGS_ID))
+  if (!(flags_reg & FLAGS_ID)) {
+    kernel_fpu_end();
     return 0;
+  }
 
 #define CPUID_FXSR	(1<<24)
 #define CPUID_SSE	(1<<25)
@@ -1861,8 +1870,10 @@ oss_fp_check (void)
 
   cpuid (1, &eax, &ebx, &ecx, &edx);
 
-  if (!(edx & CPUID_FXSR))
+  if (!(edx & CPUID_FXSR)) {
+    kernel_fpu_end();
     return -1;
+  }
 
   /*
    * Older machines require different FP handling than the latest ones. Use the SSE
@@ -1871,12 +1882,15 @@ oss_fp_check (void)
   if (!(edx & CPUID_SSE))
     old_arch = 1;
 
+  kernel_fpu_end();
+
   return 1;
 }
 
 void
 oss_fp_save (short *envbuf, unsigned int flags[])
 {
+  kernel_fpu_begin();
   flags[0] = read_cr0 ();
   write_cr0 (flags[0] & ~0x0e);	/* Clear CR0.TS/MP/EM */
 
@@ -1894,11 +1908,13 @@ oss_fp_save (short *envbuf, unsigned int
       write_mxcsr (0x1f80);
     }
   flags[2] = read_cr0 ();
+  kernel_fpu_end();
 }
 
 void
 oss_fp_restore (short *envbuf, unsigned int flags[])
 {
+  kernel_fpu_begin();
   asm ("fwait");
   if (old_arch)
     {
@@ -1910,6 +1926,7 @@ oss_fp_restore (short *envbuf, unsigned
       write_cr4 (flags[1]);	/* Restore cr4 */
     }
   write_cr0 (flags[0]);		/* Restore cr0 */
+  kernel_fpu_end();
 }
 #endif
 

Reply via email to