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
8
setup/Linux/oss/build/osscore.c | 23 ++++++++++++++++++++---
9
1 file changed, 20 insertions(+), 3 deletions(-)
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>
22
#define strlen oss_strlen
23
@@ -1840,20 +1843,26 @@ oss_fp_check (void)
25
oss_native_word flags_reg;
29
local_save_flags (flags_reg);
30
flags_reg &= ~FLAGS_ID;
31
local_irq_restore (flags_reg);
33
local_save_flags (flags_reg);
34
- if (flags_reg & FLAGS_ID)
35
+ if (flags_reg & FLAGS_ID) {
40
flags_reg |= FLAGS_ID;
41
local_irq_restore (flags_reg);
43
local_save_flags (flags_reg);
44
- if (!(flags_reg & FLAGS_ID))
45
+ if (!(flags_reg & FLAGS_ID)) {
50
#define CPUID_FXSR (1<<24)
51
#define CPUID_SSE (1<<25)
52
@@ -1861,8 +1870,10 @@ oss_fp_check (void)
54
cpuid (1, &eax, &ebx, &ecx, &edx);
56
- if (!(edx & CPUID_FXSR))
57
+ if (!(edx & CPUID_FXSR)) {
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))
74
oss_fp_save (short *envbuf, unsigned int flags[])
77
flags[0] = read_cr0 ();
78
write_cr0 (flags[0] & ~0x0e); /* Clear CR0.TS/MP/EM */
80
@@ -1894,11 +1908,13 @@ oss_fp_save (short *envbuf, unsigned int
83
flags[2] = read_cr0 ();
88
oss_fp_restore (short *envbuf, unsigned int flags[])
94
@@ -1910,6 +1926,7 @@ oss_fp_restore (short *envbuf, unsigned
95
write_cr4 (flags[1]); /* Restore cr4 */
97
write_cr0 (flags[0]); /* Restore cr0 */