~ubuntu-branches/ubuntu/vivid/oss4/vivid-proposed

« back to all changes in this revision

Viewing changes to debian/patches/500_kernel_fpu_begin_end.patch

  • Committer: Package Import Robot
  • Author(s): Sebastien NOEL
  • Date: 2012-12-04 20:53:17 UTC
  • Revision ID: package-import@ubuntu.com-20121204205317-49slxsfejv0wga0j
Tags: 4.2-build2007-2
* Revert changes from the previous NMU, it breaks more things
  than it fixes.
* Until a *tested* patch is proposed, VMIX is now using
  fixed point arithmetic in the kernel.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Description: Use Linux API for floating-point mode
2
 
 This patch adds kernel_fpu_begin() and kernel_fpu_end() calls to
3
 
 oss_fp_check(), oss_fp_save() and oss_fp_restore().
4
 
Author: Roland Stigge <stigge@antcom.de>
5
 
Bug-Debian: http://bugs.debian.org/693659
6
 
 
7
 
---
8
 
 setup/Linux/oss/build/osscore.c |   23 ++++++++++++++++++++---
9
 
 1 file changed, 20 insertions(+), 3 deletions(-)
10
 
 
11
 
--- oss4-4.2-build2007.orig/setup/Linux/oss/build/osscore.c
12
 
+++ oss4-4.2-build2007/setup/Linux/oss/build/osscore.c
13
 
@@ -31,6 +31,9 @@ typedef int *ioctl_arg;
14
 
 #include <linux/irq.h>
15
 
 #include <linux/sched.h>
16
 
 #include <linux/interrupt.h>
17
 
+#ifdef CONFIG_OSS_VMIX_FLOAT
18
 
+#include <asm/i387.h>
19
 
+#endif
20
 
 #undef strlen
21
 
 #undef strcpy
22
 
 #define strlen oss_strlen
23
 
@@ -1840,20 +1843,26 @@ oss_fp_check (void)
24
 
 
25
 
   oss_native_word flags_reg;
26
 
 
27
 
+  kernel_fpu_begin();
28
 
+
29
 
   local_save_flags (flags_reg);
30
 
   flags_reg &= ~FLAGS_ID;
31
 
   local_irq_restore (flags_reg);
32
 
 
33
 
   local_save_flags (flags_reg);
34
 
-  if (flags_reg & FLAGS_ID)
35
 
+  if (flags_reg & FLAGS_ID) {
36
 
+    kernel_fpu_end();
37
 
     return 0;
38
 
+  }
39
 
 
40
 
   flags_reg |= FLAGS_ID;
41
 
   local_irq_restore (flags_reg);
42
 
 
43
 
   local_save_flags (flags_reg);
44
 
-  if (!(flags_reg & FLAGS_ID))
45
 
+  if (!(flags_reg & FLAGS_ID)) {
46
 
+    kernel_fpu_end();
47
 
     return 0;
48
 
+  }
49
 
 
50
 
 #define CPUID_FXSR     (1<<24)
51
 
 #define CPUID_SSE      (1<<25)
52
 
@@ -1861,8 +1870,10 @@ oss_fp_check (void)
53
 
 
54
 
   cpuid (1, &eax, &ebx, &ecx, &edx);
55
 
 
56
 
-  if (!(edx & CPUID_FXSR))
57
 
+  if (!(edx & CPUID_FXSR)) {
58
 
+    kernel_fpu_end();
59
 
     return -1;
60
 
+  }
61
 
 
62
 
   /*
63
 
    * Older machines require different FP handling than the latest ones. Use the SSE
64
 
@@ -1871,12 +1882,15 @@ oss_fp_check (void)
65
 
   if (!(edx & CPUID_SSE))
66
 
     old_arch = 1;
67
 
 
68
 
+  kernel_fpu_end();
69
 
+
70
 
   return 1;
71
 
 }
72
 
 
73
 
 void
74
 
 oss_fp_save (short *envbuf, unsigned int flags[])
75
 
 {
76
 
+  kernel_fpu_begin();
77
 
   flags[0] = read_cr0 ();
78
 
   write_cr0 (flags[0] & ~0x0e);        /* Clear CR0.TS/MP/EM */
79
 
 
80
 
@@ -1894,11 +1908,13 @@ oss_fp_save (short *envbuf, unsigned int
81
 
       write_mxcsr (0x1f80);
82
 
     }
83
 
   flags[2] = read_cr0 ();
84
 
+  kernel_fpu_end();
85
 
 }
86
 
 
87
 
 void
88
 
 oss_fp_restore (short *envbuf, unsigned int flags[])
89
 
 {
90
 
+  kernel_fpu_begin();
91
 
   asm ("fwait");
92
 
   if (old_arch)
93
 
     {
94
 
@@ -1910,6 +1926,7 @@ oss_fp_restore (short *envbuf, unsigned
95
 
       write_cr4 (flags[1]);    /* Restore cr4 */
96
 
     }
97
 
   write_cr0 (flags[0]);                /* Restore cr0 */
98
 
+  kernel_fpu_end();
99
 
 }
100
 
 #endif
101