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>
This commit is contained in:
Richard Henderson 2019-04-26 15:20:51 -07:00
parent 4a24793290
commit 21ba856499
5 changed files with 130 additions and 60 deletions

View file

@ -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);
}
}