summaryrefslogtreecommitdiffstats
path: root/target/alpha/fpu_helper.c
diff options
context:
space:
mode:
authorRichard Henderson2019-04-27 00:20:51 +0200
committerRichard Henderson2019-05-19 16:30:03 +0200
commit21ba856499f9c0ccdc05ed04432df059ae76b337 (patch)
tree6abdfdcadf3436ae79faf616c47f5f8fdd41d7f7 /target/alpha/fpu_helper.c
parenttarget/alpha: Clean up alpha_cpu_dump_state (diff)
downloadqemu-21ba856499f9c0ccdc05ed04432df059ae76b337.tar.gz
qemu-21ba856499f9c0ccdc05ed04432df059ae76b337.tar.xz
qemu-21ba856499f9c0ccdc05ed04432df059ae76b337.zip
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/fpu_helper.c')
-rw-r--r--target/alpha/fpu_helper.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/target/alpha/fpu_helper.c b/target/alpha/fpu_helper.c
index 9645978aaa..62a066d902 100644
--- a/target/alpha/fpu_helper.c
+++ b/target/alpha/fpu_helper.c
@@ -91,10 +91,25 @@ void helper_fp_exc_raise_s(CPUAlphaState *env, uint32_t ignore, uint32_t regno)
if (exc) {
env->fpcr |= exc;
exc &= ~ignore;
- if (exc) {
- exc &= env->fpcr_exc_enable;
- fp_exc_raise1(env, GETPC(), exc, regno, EXC_M_SWC);
+#ifdef CONFIG_USER_ONLY
+ /*
+ * In user mode, the kernel's software handler only
+ * delivers a signal if the exception is enabled.
+ */
+ if (!(exc & env->fpcr_exc_enable)) {
+ return;
+ }
+#else
+ /*
+ * In system mode, the software handler gets invoked
+ * for any non-ignored exception.
+ */
+ if (!exc) {
+ return;
}
+#endif
+ exc &= env->fpcr_exc_enable;
+ fp_exc_raise1(env, GETPC(), exc, regno, EXC_M_SWC);
}
}