Skip to content
Snippets Groups Projects
Commit 0b25c4a1 authored by Richard Henderson's avatar Richard Henderson Committed by Laurent Vivier
Browse files

linux-user/microblaze: Fix SIGFPE si_codes


Fix a typo for ESR_EC_DIVZERO, which is integral not floating-point.
Fix the if ladder for decoding floating-point exceptions.

Reviewed-by: default avatarPeter Maydell <peter.maydell@linaro.org>
Signed-off-by: default avatarRichard Henderson <richard.henderson@linaro.org>
Message-Id: <20220107213243.212806-14-richard.henderson@linaro.org>
Signed-off-by: default avatarLaurent Vivier <laurent@vivier.eu>
parent 23ae825a
No related branches found
No related tags found
No related merge requests found
......@@ -77,15 +77,25 @@ void cpu_loop(CPUMBState *env)
env->iflags &= ~(IMM_FLAG | D_FLAG);
switch (env->esr & 31) {
case ESR_EC_DIVZERO:
si_code = TARGET_FPE_FLTDIV;
si_code = TARGET_FPE_INTDIV;
break;
case ESR_EC_FPU:
si_code = 0;
if (env->fsr & FSR_IO) {
/*
* Note that the kernel passes along fsr as si_code
* if there's no recognized bit set. Possibly this
* implies that si_code is 0, but follow the structure.
*/
si_code = env->fsr;
if (si_code & FSR_IO) {
si_code = TARGET_FPE_FLTINV;
}
if (env->fsr & FSR_DZ) {
} else if (si_code & FSR_OF) {
si_code = TARGET_FPE_FLTOVF;
} else if (si_code & FSR_UF) {
si_code = TARGET_FPE_FLTUND;
} else if (si_code & FSR_DZ) {
si_code = TARGET_FPE_FLTDIV;
} else if (si_code & FSR_DO) {
si_code = TARGET_FPE_FLTRES;
}
break;
default:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment