aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2013-11-04 11:55:05 -0500
committerScott Wood <scottwood@freescale.com>2014-01-07 19:43:42 -0500
commit01c9ccee3c3051d0a37af9af2938a15a06448964 (patch)
treee14a3868f4ecac344384572cd579565bba1139db
parent28fbf1d540920ad6722fa6ac15237a307932bc9b (diff)
powerpc: fix e500 SPE float SIGFPE generation
The e500 SPE floating-point emulation code is called from SPEFloatingPointException and SPEFloatingPointRoundException in arch/powerpc/kernel/traps.c. Those functions have support for generating SIGFPE, but do_spe_mathemu and speround_handler don't generate a return value to indicate that this should be done. Such a return value should depend on whether an exception is raised that has been set via prctl to generate SIGFPE. This patch adds the relevant logic in these functions so that SIGFPE is generated as expected by the glibc testsuite. Signed-off-by: Joseph Myers <joseph@codesourcery.com> Signed-off-by: Scott Wood <scottwood@freescale.com>
-rw-r--r--arch/powerpc/math-emu/math_efp.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/powerpc/math-emu/math_efp.c b/arch/powerpc/math-emu/math_efp.c
index 01a0abb94dd6..28337c9709ae 100644
--- a/arch/powerpc/math-emu/math_efp.c
+++ b/arch/powerpc/math-emu/math_efp.c
@@ -20,6 +20,7 @@
20 */ 20 */
21 21
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/prctl.h>
23 24
24#include <asm/uaccess.h> 25#include <asm/uaccess.h>
25#include <asm/reg.h> 26#include <asm/reg.h>
@@ -691,6 +692,23 @@ update_regs:
691 pr_debug("va: %08x %08x\n", va.wp[0], va.wp[1]); 692 pr_debug("va: %08x %08x\n", va.wp[0], va.wp[1]);
692 pr_debug("vb: %08x %08x\n", vb.wp[0], vb.wp[1]); 693 pr_debug("vb: %08x %08x\n", vb.wp[0], vb.wp[1]);
693 694
695 if (current->thread.fpexc_mode & PR_FP_EXC_SW_ENABLE) {
696 if ((FP_CUR_EXCEPTIONS & FP_EX_DIVZERO)
697 && (current->thread.fpexc_mode & PR_FP_EXC_DIV))
698 return 1;
699 if ((FP_CUR_EXCEPTIONS & FP_EX_OVERFLOW)
700 && (current->thread.fpexc_mode & PR_FP_EXC_OVF))
701 return 1;
702 if ((FP_CUR_EXCEPTIONS & FP_EX_UNDERFLOW)
703 && (current->thread.fpexc_mode & PR_FP_EXC_UND))
704 return 1;
705 if ((FP_CUR_EXCEPTIONS & FP_EX_INEXACT)
706 && (current->thread.fpexc_mode & PR_FP_EXC_RES))
707 return 1;
708 if ((FP_CUR_EXCEPTIONS & FP_EX_INVALID)
709 && (current->thread.fpexc_mode & PR_FP_EXC_INV))
710 return 1;
711 }
694 return 0; 712 return 0;
695 713
696illegal: 714illegal:
@@ -867,6 +885,8 @@ int speround_handler(struct pt_regs *regs)
867 885
868 pr_debug(" to fgpr: %08x %08x\n", fgpr.wp[0], fgpr.wp[1]); 886 pr_debug(" to fgpr: %08x %08x\n", fgpr.wp[0], fgpr.wp[1]);
869 887
888 if (current->thread.fpexc_mode & PR_FP_EXC_SW_ENABLE)
889 return (current->thread.fpexc_mode & PR_FP_EXC_RES) ? 1 : 0;
870 return 0; 890 return 0;
871} 891}
872 892