[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 12/23] linux-user/microblaze: Fix SIGFPE si_codes
From: |
Richard Henderson |
Subject: |
[PATCH v3 12/23] linux-user/microblaze: Fix SIGFPE si_codes |
Date: |
Wed, 3 Nov 2021 10:08:36 -0400 |
Fix a typo for ESR_EC_DIVZERO, which is integral not floating-point.
Fix the if ladder for decoding floating-point exceptions.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
linux-user/microblaze/cpu_loop.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/linux-user/microblaze/cpu_loop.c b/linux-user/microblaze/cpu_loop.c
index 263b68aea1..cf1668a45f 100644
--- a/linux-user/microblaze/cpu_loop.c
+++ b/linux-user/microblaze/cpu_loop.c
@@ -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:
--
2.25.1
- [PATCH v3 03/23] linux-user/alpha: Use force_sig_fault, (continued)
- [PATCH v3 03/23] linux-user/alpha: Use force_sig_fault, Richard Henderson, 2021/11/03
- [PATCH v3 01/23] linux-user/alpha: Set TRAP_UNK for bugchk and unknown gentrap, Richard Henderson, 2021/11/03
- [PATCH v3 02/23] linux-user/alpha: Set FPE_FLTUNK for gentrap ROPRAND, Richard Henderson, 2021/11/03
- [PATCH v3 05/23] linux-user/hppa: Use force_sig_fault, Richard Henderson, 2021/11/03
- [PATCH v3 09/23] linux-user/i386: Use force_sig, force_sig_fault, Richard Henderson, 2021/11/03
- [PATCH v3 06/23] linux-user/hppa: Use the proper si_code for PRIV_OPR, PRIV_REG, OVERFLOW, Richard Henderson, 2021/11/03
- [PATCH v3 07/23] linux-user/hppa: Set FPE_CONDTRAP for COND, Richard Henderson, 2021/11/03
- [PATCH v3 08/23] linux-user/i386: Split out maybe_handle_vm86_trap, Richard Henderson, 2021/11/03
- [PATCH v3 10/23] linux-user/m68k: Use force_sig_fault, Richard Henderson, 2021/11/03
- [PATCH v3 11/23] linux-user/microblaze: Use force_sig_fault, Richard Henderson, 2021/11/03
- [PATCH v3 12/23] linux-user/microblaze: Fix SIGFPE si_codes,
Richard Henderson <=
- [PATCH v3 14/23] linux-user/mips: Use force_sig_fault, Richard Henderson, 2021/11/03
- [PATCH v3 13/23] linux-user/mips: Improve do_break, Richard Henderson, 2021/11/03
- [PATCH v3 15/23] target/mips: Extract break code into env->error_code, Richard Henderson, 2021/11/03
- [PATCH v3 16/23] target/mips: Extract trap code into env->error_code, Richard Henderson, 2021/11/03