[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 13/30] linux-user/microblaze: Fix SIGFPE si_codes
From: |
Laurent Vivier |
Subject: |
[PULL 13/30] linux-user/microblaze: Fix SIGFPE si_codes |
Date: |
Tue, 11 Jan 2022 20:52:30 +0100 |
From: Richard Henderson <richard.henderson@linaro.org>
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>
Message-Id: <20220107213243.212806-14-richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
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 08620d4e6899..1a2556be2c5f 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.33.1
- [PULL 00/30] Linux user for 7.0 patches, Laurent Vivier, 2022/01/11
- [PULL 03/30] linux-user/alpha: Use force_sig_fault, Laurent Vivier, 2022/01/11
- [PULL 02/30] linux-user/alpha: Set FPE_FLTUNK for gentrap ROPRAND, Laurent Vivier, 2022/01/11
- [PULL 12/30] linux-user/microblaze: Use force_sig_fault, Laurent Vivier, 2022/01/11
- [PULL 13/30] linux-user/microblaze: Fix SIGFPE si_codes,
Laurent Vivier <=
- [PULL 01/30] linux-user/alpha: Set TRAP_UNK for bugchk and unknown gentrap, Laurent Vivier, 2022/01/11
- [PULL 04/30] linux-user/cris: Use force_sig_fault, Laurent Vivier, 2022/01/11
- [PULL 06/30] linux-user/hppa: Use the proper si_code for PRIV_OPR, PRIV_REG, OVERFLOW, Laurent Vivier, 2022/01/11
- [PULL 05/30] linux-user/hppa: Use force_sig_fault, Laurent Vivier, 2022/01/11
- [PULL 18/30] linux-user/openrisc: Use force_sig_fault, Laurent Vivier, 2022/01/11
- [PULL 24/30] linux-user/xtensa: Use force_sig_fault, Laurent Vivier, 2022/01/11
- [PULL 08/30] linux-user/hppa: Set FPE_CONDTRAP for COND, Laurent Vivier, 2022/01/11
- [PULL 27/30] linux-user: Do not special-case NULL for PR_GET_PDEATHSIG, Laurent Vivier, 2022/01/11
- [PULL 14/30] linux-user/mips: Improve do_break, Laurent Vivier, 2022/01/11
- [PULL 30/30] linux-user: Implement capability prctls, Laurent Vivier, 2022/01/11