with no users left, remove support for 2.6.21
[openwrt/svn-archive/archive.git] / target / linux / generic-2.6 / patches-2.6.21 / 024-mips_disable_fpu.patch
1 MIPS: allow disabling the kernel FPU emulator
2
3 This patch allows turning off the in-kernel Algorithmics
4 FPU emulator support, which allows one to save a couple of
5 precious blocks on an embedded system.
6
7 Signed-off-by: Florian Fainelli <florian@openwrt.org>
8
9 --- a/arch/mips/Kconfig
10 +++ b/arch/mips/Kconfig
11 @@ -938,6 +938,17 @@ config LIMITED_DMA
12 config MIPS_BONITO64
13 bool
14
15 +config MIPS_FPU_EMU
16 + bool "Enable FPU emulation"
17 + default y
18 + help
19 + This option allows building a kernel with or without the Algorithmics
20 + FPU emulator enabled. Turning off this option results in a kernel which
21 + does not catch floating operations exceptions. Make sure that your toolchain
22 + is configured to enable software floating point emulation in that case.
23 +
24 + If unsure say Y here.
25 +
26 config MIPS_MSC
27 bool
28
29 --- a/arch/mips/math-emu/Makefile
30 +++ b/arch/mips/math-emu/Makefile
31 @@ -1,11 +1,12 @@
32 #
33 # Makefile for the Linux/MIPS kernel FPU emulation.
34 #
35 +obj-y := kernel_linkage.o dsemul.o cp1emu.o
36
37 -obj-y := cp1emu.o ieee754m.o ieee754d.o ieee754dp.o ieee754sp.o ieee754.o \
38 +obj-$(CONFIG_MIPS_FPU_EMU) += ieee754m.o ieee754d.o ieee754dp.o ieee754sp.o ieee754.o \
39 ieee754xcpt.o dp_frexp.o dp_modf.o dp_div.o dp_mul.o dp_sub.o \
40 dp_add.o dp_fsp.o dp_cmp.o dp_logb.o dp_scalb.o dp_simple.o \
41 dp_tint.o dp_fint.o dp_tlong.o dp_flong.o sp_frexp.o sp_modf.o \
42 sp_div.o sp_mul.o sp_sub.o sp_add.o sp_fdp.o sp_cmp.o sp_logb.o \
43 sp_scalb.o sp_simple.o sp_tint.o sp_fint.o sp_tlong.o sp_flong.o \
44 - dp_sqrt.o sp_sqrt.o kernel_linkage.o dsemul.o
45 + dp_sqrt.o sp_sqrt.o
46 --- a/arch/mips/math-emu/cp1emu.c
47 +++ b/arch/mips/math-emu/cp1emu.c
48 @@ -56,6 +56,12 @@
49 #endif
50 #define __mips 4
51
52 +/* Further private data for which no space exists in mips_fpu_struct */
53 +
54 +struct mips_fpu_emulator_stats fpuemustats;
55 +
56 +#ifdef CONFIG_MIPS_FPU_EMU
57 +
58 /* Function which emulates a floating point instruction. */
59
60 static int fpu_emu(struct pt_regs *, struct mips_fpu_struct *,
61 @@ -66,10 +72,6 @@ static int fpux_emu(struct pt_regs *,
62 struct mips_fpu_struct *, mips_instruction);
63 #endif
64
65 -/* Further private data for which no space exists in mips_fpu_struct */
66 -
67 -struct mips_fpu_emulator_stats fpuemustats;
68 -
69 /* Control registers */
70
71 #define FPCREG_RID 0 /* $0 = revision id */
72 @@ -1277,3 +1279,10 @@ int fpu_emulator_cop1Handler(struct pt_r
73
74 return sig;
75 }
76 +#else
77 +int fpu_emulator_cop1Handler(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
78 + int has_fpu)
79 +{
80 + return 0;
81 +}
82 +#endif /* CONFIG_MIPS_FPU_EMU */
83 --- a/arch/mips/math-emu/dsemul.c
84 +++ b/arch/mips/math-emu/dsemul.c
85 @@ -112,6 +112,7 @@ int mips_dsemul(struct pt_regs *regs, mi
86 return SIGILL; /* force out of emulation loop */
87 }
88
89 +#ifdef CONFIG_MIPS_FPU_EMU
90 int do_dsemulret(struct pt_regs *xcp)
91 {
92 struct emuframe *fr;
93 @@ -167,3 +168,9 @@ int do_dsemulret(struct pt_regs *xcp)
94
95 return 1;
96 }
97 +#else
98 +int do_dsemulret(struct pt_regs *xcp)
99 +{
100 + return 0;
101 +}
102 +#endif /* CONFIG_MIPS_FPU_EMU */
103 --- a/arch/mips/math-emu/kernel_linkage.c
104 +++ b/arch/mips/math-emu/kernel_linkage.c
105 @@ -28,6 +28,7 @@
106
107 #define SIGNALLING_NAN 0x7ff800007ff80000LL
108
109 +#ifdef CONFIG_MIPS_FPU_EMU
110 void fpu_emulator_init_fpu(void)
111 {
112 static int first = 1;
113 @@ -111,4 +112,36 @@ int fpu_emulator_restore_context32(struc
114
115 return err;
116 }
117 -#endif
118 +#endif /* CONFIG_64BIT */
119 +#else
120 +
121 +void fpu_emulator_init_fpu(void)
122 +{
123 + printk(KERN_INFO "FPU emulator disabled, make sure your toolchain"
124 + "was compiled with software floating point support (soft-float)\n");
125 + return;
126 +}
127 +
128 +int fpu_emulator_save_context(struct sigcontext __user *sc)
129 +{
130 + return 0;
131 +}
132 +
133 +int fpu_emulator_restore_context(struct sigcontext __user *sc)
134 +{
135 + return 0;
136 +}
137 +
138 +#ifdef CONFIG_64BIT
139 +int fpu_emulator_save_context32(struct sigcontext32 __user *sc)
140 +{
141 + return 0;
142 +}
143 +
144 +int fpu_emulator_restore_context32(struct sigcontext32 __user *sc)
145 +{
146 + return 0;
147 +}
148 +
149 +#endif /* CONFIG_64BIT */
150 +#endif /* CONFIG_MIPS_FPU_EMU */