aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/traps.c
diff options
context:
space:
mode:
authorPaul Burton <paul.burton@imgtec.com>2014-01-27 10:23:12 -0500
committerRalf Baechle <ralf@linux-mips.org>2014-03-26 18:09:10 -0400
commit2bcb3fbc3fc593d2ec1efbdeb3e71b9475afe320 (patch)
tree4044ed9f700fea1f26602cbe5604ba865f354c41 /arch/mips/kernel/traps.c
parent1db1af84d6df99a8e5d6ddea8c7b5c1327c9a620 (diff)
MIPS: Dumb MSA FP exception handler
This patch adds a simple handler for MSA FP exceptions which delivers a SIGFPE to the running task. In the future it should probably be extended to re-execute the instruction with the MSACSR.NX bit set in order to generate results for any elements which did not cause an exception before delivering the SIGFPE signal. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/6432/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel/traps.c')
-rw-r--r--arch/mips/kernel/traps.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 4f27cbfad1e5..7ac4d8f44cf0 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -78,6 +78,7 @@ extern asmlinkage void handle_ri_rdhwr(void);
78extern asmlinkage void handle_cpu(void); 78extern asmlinkage void handle_cpu(void);
79extern asmlinkage void handle_ov(void); 79extern asmlinkage void handle_ov(void);
80extern asmlinkage void handle_tr(void); 80extern asmlinkage void handle_tr(void);
81extern asmlinkage void handle_msa_fpe(void);
81extern asmlinkage void handle_fpe(void); 82extern asmlinkage void handle_fpe(void);
82extern asmlinkage void handle_ftlb(void); 83extern asmlinkage void handle_ftlb(void);
83extern asmlinkage void handle_msa(void); 84extern asmlinkage void handle_msa(void);
@@ -1250,6 +1251,16 @@ out:
1250 exception_exit(prev_state); 1251 exception_exit(prev_state);
1251} 1252}
1252 1253
1254asmlinkage void do_msa_fpe(struct pt_regs *regs)
1255{
1256 enum ctx_state prev_state;
1257
1258 prev_state = exception_enter();
1259 die_if_kernel("do_msa_fpe invoked from kernel context!", regs);
1260 force_sig(SIGFPE, current);
1261 exception_exit(prev_state);
1262}
1263
1253asmlinkage void do_msa(struct pt_regs *regs) 1264asmlinkage void do_msa(struct pt_regs *regs)
1254{ 1265{
1255 enum ctx_state prev_state; 1266 enum ctx_state prev_state;
@@ -2106,6 +2117,7 @@ void __init trap_init(void)
2106 set_except_vector(11, handle_cpu); 2117 set_except_vector(11, handle_cpu);
2107 set_except_vector(12, handle_ov); 2118 set_except_vector(12, handle_ov);
2108 set_except_vector(13, handle_tr); 2119 set_except_vector(13, handle_tr);
2120 set_except_vector(14, handle_msa_fpe);
2109 2121
2110 if (current_cpu_type() == CPU_R6000 || 2122 if (current_cpu_type() == CPU_R6000 ||
2111 current_cpu_type() == CPU_R6000A) { 2123 current_cpu_type() == CPU_R6000A) {