aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/mips/include/asm/fpu.h7
-rw-r--r--arch/mips/include/asm/fpu_emulator.h16
-rw-r--r--arch/mips/math-emu/Makefile2
-rw-r--r--arch/mips/math-emu/kernel_linkage.c42
4 files changed, 21 insertions, 46 deletions
diff --git a/arch/mips/include/asm/fpu.h b/arch/mips/include/asm/fpu.h
index 4d86b72750c7..a939574f8293 100644
--- a/arch/mips/include/asm/fpu.h
+++ b/arch/mips/include/asm/fpu.h
@@ -17,6 +17,7 @@
17#include <asm/mipsregs.h> 17#include <asm/mipsregs.h>
18#include <asm/cpu.h> 18#include <asm/cpu.h>
19#include <asm/cpu-features.h> 19#include <asm/cpu-features.h>
20#include <asm/fpu_emulator.h>
20#include <asm/hazards.h> 21#include <asm/hazards.h>
21#include <asm/processor.h> 22#include <asm/processor.h>
22#include <asm/current.h> 23#include <asm/current.h>
@@ -28,7 +29,6 @@
28struct sigcontext; 29struct sigcontext;
29struct sigcontext32; 30struct sigcontext32;
30 31
31extern void fpu_emulator_init_fpu(void);
32extern void _init_fpu(void); 32extern void _init_fpu(void);
33extern void _save_fp(struct task_struct *); 33extern void _save_fp(struct task_struct *);
34extern void _restore_fp(struct task_struct *); 34extern void _restore_fp(struct task_struct *);
@@ -156,15 +156,16 @@ static inline int init_fpu(void)
156 int ret = 0; 156 int ret = 0;
157 157
158 preempt_disable(); 158 preempt_disable();
159
159 if (cpu_has_fpu) { 160 if (cpu_has_fpu) {
160 ret = __own_fpu(); 161 ret = __own_fpu();
161 if (!ret) 162 if (!ret)
162 _init_fpu(); 163 _init_fpu();
163 } else { 164 } else
164 fpu_emulator_init_fpu(); 165 fpu_emulator_init_fpu();
165 }
166 166
167 preempt_enable(); 167 preempt_enable();
168
168 return ret; 169 return ret;
169} 170}
170 171
diff --git a/arch/mips/include/asm/fpu_emulator.h b/arch/mips/include/asm/fpu_emulator.h
index 2abb587d5ab4..f761719eab65 100644
--- a/arch/mips/include/asm/fpu_emulator.h
+++ b/arch/mips/include/asm/fpu_emulator.h
@@ -23,9 +23,12 @@
23#ifndef _ASM_FPU_EMULATOR_H 23#ifndef _ASM_FPU_EMULATOR_H
24#define _ASM_FPU_EMULATOR_H 24#define _ASM_FPU_EMULATOR_H
25 25
26#include <linux/sched.h>
26#include <asm/break.h> 27#include <asm/break.h>
28#include <asm/thread_info.h>
27#include <asm/inst.h> 29#include <asm/inst.h>
28#include <asm/local.h> 30#include <asm/local.h>
31#include <asm/processor.h>
29 32
30#ifdef CONFIG_DEBUG_FS 33#ifdef CONFIG_DEBUG_FS
31 34
@@ -71,4 +74,17 @@ int mm_isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn,
71 */ 74 */
72#define BREAK_MATH (0x0000000d | (BRK_MEMU << 16)) 75#define BREAK_MATH (0x0000000d | (BRK_MEMU << 16))
73 76
77#define SIGNALLING_NAN 0x7ff800007ff80000LL
78
79static inline void fpu_emulator_init_fpu(void)
80{
81 struct task_struct *t = current;
82 int i;
83
84 t->thread.fpu.fcr31 = 0;
85
86 for (i = 0; i < 32; i++)
87 set_fpr64(&t->thread.fpu.fpr[i], 0, SIGNALLING_NAN);
88}
89
74#endif /* _ASM_FPU_EMULATOR_H */ 90#endif /* _ASM_FPU_EMULATOR_H */
diff --git a/arch/mips/math-emu/Makefile b/arch/mips/math-emu/Makefile
index 383cc7889774..619cfc1a2442 100644
--- a/arch/mips/math-emu/Makefile
+++ b/arch/mips/math-emu/Makefile
@@ -6,7 +6,7 @@ obj-y += cp1emu.o ieee754dp.o ieee754sp.o ieee754.o dp_div.o dp_mul.o \
6 dp_sub.o dp_add.o dp_fsp.o dp_cmp.o dp_simple.o dp_tint.o \ 6 dp_sub.o dp_add.o dp_fsp.o dp_cmp.o dp_simple.o dp_tint.o \
7 dp_fint.o dp_tlong.o dp_flong.o sp_div.o sp_mul.o sp_sub.o \ 7 dp_fint.o dp_tlong.o dp_flong.o sp_div.o sp_mul.o sp_sub.o \
8 sp_add.o sp_fdp.o sp_cmp.o sp_simple.o sp_tint.o sp_fint.o \ 8 sp_add.o sp_fdp.o sp_cmp.o sp_simple.o sp_tint.o sp_fint.o \
9 sp_tlong.o sp_flong.o kernel_linkage.o dsemul.o 9 sp_tlong.o sp_flong.o dsemul.o
10 10
11lib-y += ieee754d.o dp_sqrt.o sp_sqrt.o 11lib-y += ieee754d.o dp_sqrt.o sp_sqrt.o
12 12
diff --git a/arch/mips/math-emu/kernel_linkage.c b/arch/mips/math-emu/kernel_linkage.c
deleted file mode 100644
index bee94196a569..000000000000
--- a/arch/mips/math-emu/kernel_linkage.c
+++ /dev/null
@@ -1,42 +0,0 @@
1/*
2 * Kevin D. Kissell, kevink@mips and Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 * Routines corresponding to Linux kernel FP context
19 * manipulation primitives for the Algorithmics MIPS
20 * FPU Emulator
21 */
22#include <linux/printk.h>
23#include <asm/current.h>
24#include <asm/fpu.h>
25#include <asm/fpu_emulator.h>
26
27#define SIGNALLING_NAN 0x7ff800007ff80000LL
28
29void fpu_emulator_init_fpu(void)
30{
31 static int first = 1;
32 int i;
33
34 if (first) {
35 first = 0;
36 printk("Algorithmics/MIPS FPU Emulator v1.5\n");
37 }
38
39 current->thread.fpu.fcr31 = 0;
40 for (i = 0; i < 32; i++)
41 set_fpr64(&current->thread.fpu.fpr[i], 0, SIGNALLING_NAN);
42}