aboutsummaryrefslogtreecommitdiff
path: root/target/alpha/helper.c
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2019-04-26 15:20:51 -0700
committerRichard Henderson <richard.henderson@linaro.org>2019-05-19 07:30:03 -0700
commit21ba856499f9c0ccdc05ed04432df059ae76b337 (patch)
tree6abdfdcadf3436ae79faf616c47f5f8fdd41d7f7 /target/alpha/helper.c
parent4a24793290e3ae08025a9a310ad74c773816d069 (diff)
target/alpha: Fix user-only floating-point exceptions
Record the software fp control register, as set by the osf_setsysinfo syscall. Add those masked exceptions to fpcr_exc_enable. Do not raise a signal for masked fp exceptions. Fixes: https://bugs.launchpad.net/bugs/1701835 Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'target/alpha/helper.c')
-rw-r--r--target/alpha/helper.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/target/alpha/helper.c b/target/alpha/helper.c
index 74a62c3d7b..2134ee1e9d 100644
--- a/target/alpha/helper.c
+++ b/target/alpha/helper.c
@@ -29,12 +29,12 @@
#define CONVERT_BIT(X, SRC, DST) \
(SRC > DST ? (X) / (SRC / DST) & (DST) : ((X) & SRC) * (DST / SRC))
-uint64_t cpu_alpha_load_fpcr (CPUAlphaState *env)
+uint64_t cpu_alpha_load_fpcr(CPUAlphaState *env)
{
return (uint64_t)env->fpcr << 32;
}
-void cpu_alpha_store_fpcr (CPUAlphaState *env, uint64_t val)
+void cpu_alpha_store_fpcr(CPUAlphaState *env, uint64_t val)
{
uint32_t fpcr = val >> 32;
uint32_t t = 0;
@@ -67,6 +67,22 @@ void cpu_alpha_store_fpcr (CPUAlphaState *env, uint64_t val)
env->fpcr_flush_to_zero = (fpcr & FPCR_UNFD) && (fpcr & FPCR_UNDZ);
env->fp_status.flush_inputs_to_zero = (fpcr & FPCR_DNZ) != 0;
+
+#ifdef CONFIG_USER_ONLY
+ /*
+ * Override some of these bits with the contents of ENV->SWCR.
+ * In system mode, some of these would trap to the kernel, at
+ * which point the kernel's handler would emulate and apply
+ * the software exception mask.
+ */
+ if (env->swcr & SWCR_MAP_DMZ) {
+ env->fp_status.flush_inputs_to_zero = 1;
+ }
+ if (env->swcr & SWCR_MAP_UMZ) {
+ env->fp_status.flush_to_zero = 1;
+ }
+ env->fpcr_exc_enable &= ~(alpha_ieee_swcr_to_fpcr(env->swcr) >> 32);
+#endif
}
uint64_t helper_load_fpcr(CPUAlphaState *env)